This repository was archived by the owner on Jan 23, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +6
-20
lines changed Expand file tree Collapse file tree 4 files changed +6
-20
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import { tasks } from './Tasks'
16
16
import { greet } from './src/Chalk/greet'
17
17
import { showArt } from './src/Chalk/art'
18
18
import { getHelp } from './src/Chalk/help'
19
- import { getState , packageManager } from './src/Helpers'
19
+ import { getState } from './src/Helpers'
20
20
21
21
/**
22
22
* Running all the tasks to create a new project.
@@ -42,7 +42,7 @@ export async function runTasks(args: string[]) {
42
42
* Show help when no arguments are passed
43
43
*/
44
44
if ( ! argv . _ . length ) {
45
- console . log ( getHelp ( packageManager ) )
45
+ console . log ( getHelp ( utils . getPackageManager ( process . cwd ( ) ) ) )
46
46
return
47
47
}
48
48
@@ -58,7 +58,7 @@ export async function runTasks(args: string[]) {
58
58
* Setup state
59
59
*/
60
60
const state = await getState ( projectPath , {
61
- client : packageManager ,
61
+ client : utils . getPackageManager ( projectPath ) ,
62
62
projectName : argv . name ,
63
63
debug : argv . debug ,
64
64
boilerplate : argv . boilerplate ,
Original file line number Diff line number Diff line change 8
8
*/
9
9
10
10
import { logger } from '@adonisjs/sink'
11
- import type { SupportedPackageManager } from '../Helpers'
12
11
13
12
/**
14
13
* Text to show on the help screen. Its simple and hence writing it
15
14
* by hand is fine
16
15
*/
17
- export const getHelp = ( packageManager : SupportedPackageManager ) => {
16
+ export const getHelp = ( packageManager : 'npm' | 'pnpm' | 'yarn' ) => {
18
17
const runSentence =
19
18
packageManager === 'yarn'
20
19
? 'yarn create adonis-ts-app'
Original file line number Diff line number Diff line change 9
9
10
10
import { logger as sinkLogger , files } from '@adonisjs/sink'
11
11
import { ApplicationContract } from '@ioc:Adonis/Core/Application'
12
- import type { SupportedPackageManager } from '../Helpers'
13
12
14
13
/**
15
14
* Shape of task functions
@@ -27,7 +26,7 @@ export type CliState = {
27
26
baseName : string
28
27
absPath : string
29
28
debug : boolean
30
- client : SupportedPackageManager
29
+ client : 'npm' | 'pnpm' | 'yarn'
31
30
boilerplate : 'web' | 'api' | 'slim'
32
31
projectName : string
33
32
eslint : boolean
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ export async function getState(
30
30
projectName ?: string
31
31
eslint ?: boolean
32
32
prettier ?: boolean
33
- client : SupportedPackageManager
33
+ client : 'npm' | 'pnpm' | 'yarn'
34
34
encore ?: boolean
35
35
}
36
36
) : Promise < CliState > {
@@ -196,15 +196,3 @@ export function getInstallMessage(list: string[]): string {
196
196
197
197
return dependencies . join ( ', ' )
198
198
}
199
-
200
- export type SupportedPackageManager = typeof packageManager
201
-
202
- /**
203
- * Detect what package manager is in used, fallback to npm.
204
- */
205
- export const packageManager =
206
- process . env . npm_execpath && process . env . npm_execpath . includes ( 'yarn' )
207
- ? 'yarn'
208
- : process . env . npm_execpath && process . env . npm_execpath . includes ( 'pnpm' )
209
- ? 'pnpm'
210
- : 'npm'
You can’t perform that action at this time.
0 commit comments