@@ -24,21 +24,22 @@ const codeceptPackages = [
24
24
const CFonts = require ( 'cfonts' ) ;
25
25
26
26
CFonts . say ( 'Create|CodeceptJS' , {
27
- font : 'chrome' , // define the font face
28
- align : 'left' , // define text alignment
29
- colors : [ 'system' ] , // define all colors
30
- background : 'transparent' , // define the background color, you can also use `backgroundColor` here as key
31
- space : true , // define if the output text should have empty lines on top and on the bottom
32
- maxLength : '0' , // define how many character can be on one line
33
- gradient : [ 'yellow' , "#805ad5" ] , // define your two gradient colors
34
- independentGradient : true , // define if you want to recalculate the gradient for each new line
35
- transitionGradient : false , // define if this is a transition between colors directly
36
- env : 'node' // define the environment CFonts is being executed in
27
+ font : 'chrome' ,
28
+ align : 'left' ,
29
+ colors : [ 'system' ] ,
30
+ background : 'transparent' ,
31
+ space : true ,
32
+ maxLength : '0' ,
33
+ gradient : [ 'yellow' , "#805ad5" ] ,
34
+ independentGradient : true ,
35
+ transitionGradient : false ,
36
+ env : 'node'
37
37
} ) ;
38
38
console . log ( ' 🔌 Supercharged End 2 End Testing 🌟' ) ;
39
39
40
40
let projectName ;
41
41
let useYarn ;
42
+ let usePnpm ;
42
43
let packageJson ;
43
44
44
45
const program = new commander . Command ( 'Create CodeceptJS' )
@@ -49,6 +50,7 @@ const program = new commander.Command('Create CodeceptJS')
49
50
projectName = name ;
50
51
} )
51
52
. option ( '--use-yarn' )
53
+ . option ( '--use-pnpm' )
52
54
. option ( '--verbose' , 'print additional logs' )
53
55
. option ( '--info' , 'print environment debug info' )
54
56
@@ -100,6 +102,7 @@ async function createCodecept(opts) {
100
102
}
101
103
102
104
useYarn = opts . useYarn ;
105
+ usePnpm = opts . usePnpm ;
103
106
104
107
const root = path . join ( process . cwd ( ) , projectName || '' ) ;
105
108
fs . ensureDirSync ( root ) ;
@@ -136,7 +139,7 @@ async function createCodecept(opts) {
136
139
if ( opts . force ) {
137
140
deps . push ( '--force' ) ;
138
141
}
139
-
142
+
140
143
141
144
if ( ! existsSync ( 'package.json' ) ) {
142
145
console . log ( 'package.json file does not exist in current dir, creating it...' ) ;
@@ -200,14 +203,13 @@ async function install(root, dependencies, verbose) {
200
203
args = [ 'add' , '-D' , '--exact' ] ;
201
204
[ ] . push . apply ( args , dependencies ) ;
202
205
203
- // Explicitly set cwd() to work around issues like
204
- // https://github.com/facebook/create-react-app/issues/3326.
205
- // Unfortunately we can only do this for Yarn because npm support for
206
- // equivalent --prefix flag doesn't help with this issue.
207
- // This is why for npm, we run checkThatNpmCanReadCwd() early instead.
208
206
args . push ( '--cwd' ) ;
209
207
args . push ( root ) ;
210
208
209
+ } else if ( usePnpm ) {
210
+ command = 'pnpm' ;
211
+ args = [ 'add' , '--save-dev' ] ;
212
+ [ ] . push . apply ( args , dependencies ) ;
211
213
} else {
212
214
command = 'npm' ;
213
215
args = [
@@ -216,15 +218,13 @@ async function install(root, dependencies, verbose) {
216
218
'--loglevel' ,
217
219
'error' ,
218
220
] . concat ( dependencies ) ;
219
-
220
221
}
221
222
222
223
const child = spawn ( command , args , { stdio : 'inherit' } ) ;
223
224
child . on ( 'close' , code => {
224
225
if ( code !== 0 ) {
225
- // if using Playwright, run the command to install the browser drivers
226
226
reject ( {
227
- command : `${ args . join ( ' ' ) . includes ( 'playwright' ) } ? ${ command } ${ args . join ( ' ' ) } ; npx playwright install : ${ command } ${ args . join ( ' ' ) } ` ,
227
+ command : `${ command } ${ args . join ( ' ' ) } ` ,
228
228
} ) ;
229
229
return ;
230
230
}
0 commit comments