Skip to content

Commit 2e9941e

Browse files
authored
feat: support pnpm
1 parent 199c99f commit 2e9941e

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

index.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,22 @@ const codeceptPackages = [
2424
const CFonts = require('cfonts');
2525

2626
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'
3737
});
3838
console.log(' 🔌 Supercharged End 2 End Testing 🌟');
3939

4040
let projectName;
4141
let useYarn;
42+
let usePnpm;
4243
let packageJson;
4344

4445
const program = new commander.Command('Create CodeceptJS')
@@ -49,6 +50,7 @@ const program = new commander.Command('Create CodeceptJS')
4950
projectName = name;
5051
})
5152
.option('--use-yarn')
53+
.option('--use-pnpm')
5254
.option('--verbose', 'print additional logs')
5355
.option('--info', 'print environment debug info')
5456

@@ -100,6 +102,7 @@ async function createCodecept(opts) {
100102
}
101103

102104
useYarn = opts.useYarn;
105+
usePnpm = opts.usePnpm;
103106

104107
const root = path.join(process.cwd(), projectName || '');
105108
fs.ensureDirSync(root);
@@ -136,7 +139,7 @@ async function createCodecept(opts) {
136139
if (opts.force) {
137140
deps.push('--force');
138141
}
139-
142+
140143

141144
if (!existsSync('package.json')) {
142145
console.log('package.json file does not exist in current dir, creating it...');
@@ -200,14 +203,13 @@ async function install(root, dependencies, verbose) {
200203
args = ['add','-D', '--exact'];
201204
[].push.apply(args, dependencies);
202205

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.
208206
args.push('--cwd');
209207
args.push(root);
210208

209+
} else if (usePnpm) {
210+
command = 'pnpm';
211+
args = ['add','--save-dev'];
212+
[].push.apply(args, dependencies);
211213
} else {
212214
command = 'npm';
213215
args = [
@@ -216,15 +218,13 @@ async function install(root, dependencies, verbose) {
216218
'--loglevel',
217219
'error',
218220
].concat(dependencies);
219-
220221
}
221222

222223
const child = spawn(command, args, { stdio: 'inherit' });
223224
child.on('close', code => {
224225
if (code !== 0) {
225-
// if using Playwright, run the command to install the browser drivers
226226
reject({
227-
command: `${args.join(' ').includes('playwright')} ? ${command} ${args.join(' ')}; npx playwright install : ${command} ${args.join(' ')}`,
227+
command: `${command} ${args.join(' ')}`,
228228
});
229229
return;
230230
}

0 commit comments

Comments
 (0)