@jeportie/create-checks 1.3.0 ā 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +14 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -8,9 +8,21 @@ import { fileURLToPath } from 'node:url';
|
|
|
8
8
|
|
|
9
9
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
10
10
|
const cwd = process.cwd();
|
|
11
|
+
const pkgPath = path.join(cwd, 'package.json');
|
|
11
12
|
|
|
12
13
|
console.log(pc.cyan('\nš§ create-checks ā setting up ESLint + Prettier\n'));
|
|
13
14
|
|
|
15
|
+
/* ---------------- ENSURE package.json EXISTS ---------------- */
|
|
16
|
+
|
|
17
|
+
if (!(await fs.pathExists(pkgPath))) {
|
|
18
|
+
console.log(pc.yellow(' No package.json found ā running npm init -y...'));
|
|
19
|
+
await execa('npm', ['init', '-y'], { stdio: 'inherit' });
|
|
20
|
+
const pkg = await fs.readJson(pkgPath);
|
|
21
|
+
pkg.type = 'module';
|
|
22
|
+
await fs.writeJson(pkgPath, pkg, { spaces: 2 });
|
|
23
|
+
console.log(pc.green(' ā') + ' package.json created with "type": "module"');
|
|
24
|
+
}
|
|
25
|
+
|
|
14
26
|
/* ---------------- INSTALL DEPENDENCIES ---------------- */
|
|
15
27
|
|
|
16
28
|
if (!process.env.NO_INSTALL) {
|
|
@@ -20,7 +32,8 @@ if (!process.env.NO_INSTALL) {
|
|
|
20
32
|
[
|
|
21
33
|
'install',
|
|
22
34
|
'-D',
|
|
23
|
-
|
|
35
|
+
|
|
36
|
+
'eslint@^9',
|
|
24
37
|
'prettier',
|
|
25
38
|
'eslint-config-prettier@^9.1.0',
|
|
26
39
|
'@eslint/js',
|
|
@@ -66,7 +79,6 @@ if (!(await fs.pathExists(path.join(cwd, 'tsconfig.json')))) {
|
|
|
66
79
|
|
|
67
80
|
/* ---------------- UPDATE package.json ---------------- */
|
|
68
81
|
|
|
69
|
-
const pkgPath = path.join(cwd, 'package.json');
|
|
70
82
|
const pkg = await fs.readJson(pkgPath);
|
|
71
83
|
|
|
72
84
|
pkg.scripts = {
|