Skip to content

Commit 187339c

Browse files
Mykhailo BodnarchukMykhailo Bodnarchuk
authored andcommitted
added pretty print for json
1 parent 64e0cef commit 187339c

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

Readme.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,19 @@ Create CodeceptJS project easily, having all dependencies installed with one com
1111
1212
```
1313

14+
15+
This script will install all required depdnedncies for CodeceptJS project.
16+
It is not required to use `create-codeceptjs` on any project, you can install them on your own, but it is very easy to start from scratch.
17+
18+
This script will also update `scripts` section of `package.json` so you could execute tests faster without learning Codeceptjs commands.
19+
1420
## Installation
1521

1622
No installation needed 🤗
1723

1824
## Usage
1925

26+
2027
Install CodeceptJS + Playwright into current project
2128

2229
```
@@ -41,8 +48,10 @@ Install CodeceptJS + webdriverio into "tests" directory
4148
npx create-codeceptjs tests --webdriverio
4249
```
4350

44-
Other options:
51+
Supported options:
4552

4653
* `--puppeteer` - install puppeteer as default helper
4754
* `--testcafe` - install testcafe as default helper
55+
* `--yarn` - yes, we support yarn too!
56+
4857

index.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ console.log(' 🔌 Supercharged End 2 End Testing 🌟');
3939

4040
let projectName;
4141
let useYarn;
42-
let packageJson = fs.readJsonSync('package.json');
4342

4443
const program = new commander.Command('Create CodeceptJS')
4544
.version(packageJson.version)
@@ -84,8 +83,6 @@ if (typeof projectName === 'undefined' && !existsSync('package.json')) {
8483
process.exit(1);
8584
}
8685

87-
// npx create-codeceptjs --template typescript --playwright codecept-tests
88-
8986
createCodecept(program.opts());
9087

9188
async function createCodecept(opts) {
@@ -136,10 +133,11 @@ async function createCodecept(opts) {
136133
version: '0.1.0',
137134
private: true,
138135
};
139-
fs.writeJsonSync('package.json', packageJson);
136+
fs.writeJsonSync('package.json', packageJson, { spaces: 4 });
140137
} else {
141138
console.log('package.json found, adding codeceptjs dependencies & scripts into it');
142139
}
140+
packageJson = fs.readJsonSync('package.json');
143141

144142

145143
if (!packageJson.scripts) packageJson.scripts = {};
@@ -154,7 +152,7 @@ async function createCodecept(opts) {
154152
packageJson.scripts['codecept:demo:app'] = 'codecept-ui --app -c node_modules/@codeceptjs/examples';
155153
packageJson.scripts['codecept:demo:server'] = 'codecept-ui -c node_modules/@codeceptjs/examples';
156154

157-
fs.writeJsonSync('package.json', packageJson);
155+
fs.writeJsonSync('package.json', packageJson, { spaces: 4 });
158156

159157

160158
await install(deps.flat());

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "create-codeceptjs",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Install CodeceptJS with all its dependencies in a single run",
55
"main": "index.js",
66
"scripts": {
@@ -45,7 +45,7 @@
4545
"@codeceptjs/configure": "^0.5.2",
4646
"@codeceptjs/examples": "^1.2.1",
4747
"@codeceptjs/ui": "^0.3.8",
48-
"codeceptjs": "^2.6.6",
48+
"codeceptjs": "^3.0.0-beta.4",
4949
"playwright": "^1.2.1"
5050
}
51-
}
51+
}

0 commit comments

Comments
 (0)