File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,15 @@ const INSTALL_COMMANDS = [
7
7
[ "yarn" , "add" ] ,
8
8
[ "pnpm" , "install" ] ,
9
9
[ "bun" , "install" ] ,
10
- ] ;
10
+ ] as const ;
11
+
12
+ const NYPM_COMMAND = [ "npx nypm" , "install" ] as const ;
11
13
12
14
const RUN_COMMANDS = [
13
15
[ "npm" , "npx" ] ,
14
16
[ "pnpm" , "pnpm dlx" ] ,
15
17
[ "bun" , "bunx" ] ,
16
- ] ;
18
+ ] as const ;
17
19
18
20
export const pmInstall = defineGenerator ( {
19
21
name : "pm-install" ,
@@ -26,17 +28,18 @@ export const pmInstall = defineGenerator({
26
28
} ;
27
29
}
28
30
29
- if ( args . auto ?? true ) {
30
- INSTALL_COMMANDS . unshift ( [ "npx nypm" , "i" ] ) ;
31
- }
32
-
33
31
let versionSuffix = "" ;
34
32
if ( args . version ) {
35
33
versionSuffix =
36
34
typeof args . version === "string" ? `@${ args . version } ` : `@^${ version } ` ;
37
35
}
38
36
39
- const contents = INSTALL_COMMANDS . map (
37
+ const commands =
38
+ args . auto === false
39
+ ? INSTALL_COMMANDS
40
+ : [ NYPM_COMMAND , ...INSTALL_COMMANDS ] ;
41
+
42
+ const contents = commands . map (
40
43
( [ cmd , install ] ) =>
41
44
`# ${ cmd . includes ( "nypm" ) ? "✨ Auto-detect" : cmd } \n${ cmd } ${ install } ${ args . dev ? " -D" : "" } ${ name } ${ versionSuffix } ` ,
42
45
) ;
You can’t perform that action at this time.
0 commit comments