Skip to content

fix: some improvements #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,7 @@ dist

# TernJS port file
.tern-port

#IDE
.vscode
.idea
17 changes: 9 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const semver = require('semver');
const spawn = require('cross-spawn');

const enginePackages = {
puppeteer: ['puppeteer@5'],
puppeteer: ['puppeteer@21.1.1'],
playwright: ['playwright@1'],
testcafe: ['testcafe@1'],
webdriverio: ['webdriverio@6'],
webdriverio: ['webdriverio@8'],
};

const codeceptPackages = [
Expand Down Expand Up @@ -128,7 +128,7 @@ async function createCodecept(opts) {
} else {
console.log(`Powered by ${chalk.yellow('Playwright')} engine`);
deps.push(enginePackages.playwright);
}
}

if (!existsSync('package.json')) {
console.log('package.json file does not exist in current dir, creating it...');
Expand All @@ -148,11 +148,11 @@ async function createCodecept(opts) {
packageJson.scripts['codeceptjs'] = 'codeceptjs run --steps';
packageJson.scripts['codeceptjs:headless'] = 'HEADLESS=true codeceptjs run --steps';
packageJson.scripts['codeceptjs:ui'] = 'codecept-ui --app';

packageJson.scripts['codeceptjs:demo'] = `codeceptjs run --steps -c ${demoConfigFile}`;
packageJson.scripts['codeceptjs:demo:headless'] = `HEADLESS=true codeceptjs run --steps -c ${demoConfigFile}`;
packageJson.scripts['codeceptjs:demo:ui'] = `codecept-ui --app -c ${demoConfigFile}`;

fs.writeJsonSync('package.json', packageJson, { spaces: 4 });


Expand Down Expand Up @@ -191,15 +191,15 @@ async function install(dependencies, verbose) {
command = 'yarnpkg';
args = ['add','-D', '--exact'];
[].push.apply(args, dependencies);

// Explicitly set cwd() to work around issues like
// https://github.com/facebook/create-react-app/issues/3326.
// Unfortunately we can only do this for Yarn because npm support for
// equivalent --prefix flag doesn't help with this issue.
// This is why for npm, we run checkThatNpmCanReadCwd() early instead.
args.push('--cwd');
args.push(root);

} else {
command = 'npm';
args = [
Expand All @@ -214,8 +214,9 @@ async function install(dependencies, verbose) {
const child = spawn(command, args, { stdio: 'inherit' });
child.on('close', code => {
if (code !== 0) {
// if using Playwright, run the command to install the browser drivers
reject({
command: `${command} ${args.join(' ')}`,
command: `${args.join(' ').includes('playwright')} ? ${command} ${args.join(' ')}; npx playwright install : ${command} ${args.join(' ')}`,
});
return;
}
Expand Down
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "create-codeceptjs",
"version": "0.1.7",
"version": "0.1.8",
"description": "Install CodeceptJS with all its dependencies in a single run",
"main": "index.js",
"bin": {
"create-codeceptjs": "index.js"
},
"create-codeceptjs": "index.js"
},
"scripts": {
},
"repository": {
Expand All @@ -25,18 +25,18 @@
},
"homepage": "https://github.com/codecept-js/create-codeceptjs#readme",
"dependencies": {
"cfonts": "^2.8.5",
"chalk": "^4.1.0",
"commander": "^5.1.0",
"cross-spawn": "^7.0.3",
"fs-extra": "^9.0.1",
"semver": "^7.3.2"
"cfonts": "2.8.5",
"chalk": "4.1.0",
"commander": "5.1.0",
"cross-spawn": "7.0.3",
"fs-extra": "9.0.1",
"semver": "7.3.2"
},
"devDependencies": {
"@codeceptjs/configure": "^0.5.2",
"@codeceptjs/examples": "^1.2.1",
"@codeceptjs/ui": "^0.3.8",
"codeceptjs": "^3.0.1",
"playwright": "^1.2.1"
"@codeceptjs/configure": "0.10.0",
"@codeceptjs/examples": "1.2.1",
"@codeceptjs/ui": "0.7.0",
"codeceptjs": "3.5.11",
"playwright": "1.40.1"
}
}