juisy 2.0.0-beta.9 → 2.0.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/LICENSE +661 -0
- package/bin/cli/cmds/index.js +1 -3
- package/bin/cli/cmds/public/print-globals.js +1 -1
- package/bin/cli/index.js +1 -1
- package/dist/cli/CLIFactory.d.ts +2 -0
- package/dist/cli/Command.d.ts +46 -6
- package/dist/cli/GlobalSettings.schema.json +1 -1
- package/dist/cli/InterfaceUtils.d.ts +17 -13
- package/dist/cli/OutputUtils.d.ts +1 -12
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +504 -456
- package/dist/cli/plugins/register-bump-version-command/cmds/index.d.ts +14 -2
- package/dist/cli/plugins/register-lint-commands/augment.d.ts +2 -3
- package/dist/cli/plugins/register-lint-commands/settings.d.ts +1 -1
- package/dist/cli/plugins/register-release-command/augment.d.ts +2 -2
- package/dist/cli/types.d.ts +6 -2
- package/dist/cli/utils.d.ts +1 -10
- package/dist/eject.d.ts +2 -0
- package/dist/index.js +8 -3
- package/dist/project-globals.d.ts +7 -26
- package/dist/templater/index.js +2 -2
- package/dist/vite/plugins/inject-css-variables/index.d.ts +23 -0
- package/dist/vite/plugins/inject-css-variables/index.js +60 -0
- package/dist/vite/plugins/inject-project-globals/index.d.ts +19 -0
- package/dist/vite/plugins/inject-project-globals/index.js +58 -0
- package/package.json +198 -190
- package/bin/cli/cmds/public/squeeze.js +0 -269
- package/dist/cli/plugins/command-handler-injections/augment.d.ts +0 -29
- package/dist/cli/plugins/command-handler-injections/command-visitors/command-handler-injections.d.ts +0 -10
- package/dist/cli/plugins/command-handler-injections/index.d.ts +0 -3
package/package.json
CHANGED
|
@@ -1,201 +1,209 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
|
|
2
|
+
"name": "juisy",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Make you JavaScript (and/or TypeScript) project juicy!",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"bin",
|
|
8
|
+
"dist",
|
|
9
|
+
"LICENSE",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
|
|
14
|
+
},
|
|
15
|
+
"imports": {
|
|
16
|
+
"#juisy": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
12
19
|
},
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"import": "./dist/index.js"
|
|
17
|
-
},
|
|
18
|
-
"#juisy/cli": {
|
|
19
|
-
"types": "./dist/cli/index.d.ts",
|
|
20
|
-
"import": "./dist/cli/index.js"
|
|
21
|
-
},
|
|
22
|
-
"#juisy/templater": {
|
|
23
|
-
"types": "./dist/templater/index.d.ts",
|
|
24
|
-
"import": "./dist/templater/index.js"
|
|
25
|
-
}
|
|
20
|
+
"#juisy/cli": {
|
|
21
|
+
"types": "./dist/cli/index.d.ts",
|
|
22
|
+
"import": "./dist/cli/index.js"
|
|
26
23
|
},
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"./templater": {
|
|
37
|
-
"types": "./dist/templater/index.d.ts",
|
|
38
|
-
"import": "./dist/templater/index.js"
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"publishConfig": {
|
|
42
|
-
"access": "public"
|
|
43
|
-
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"build": "vite build",
|
|
46
|
-
"audit": "ncu && npm audit",
|
|
47
|
-
"audit:fix": "ncu --interactive",
|
|
48
|
-
"docs": "npm run docs:cli && npm run docs:api",
|
|
49
|
-
"docs:api": "node ./bin/cli docs generate:api",
|
|
50
|
-
"docs:cli": "npm run docs:cli:private && npm run docs:cli:public",
|
|
51
|
-
"docs:cli:private": "node ./bin/cli docs generate:cli -c ./docs/cli/private/config.js",
|
|
52
|
-
"docs:cli:public": "node ./bin/cli docs generate:cli -c ./docs/cli/public/config.js",
|
|
53
|
-
"example:reset": "git checkout --no-overlay -- example && cd example && git clean -fdX",
|
|
54
|
-
"example:test": "npm run example:reset && cd example && npm install -D juisy@file:../ && npx juisy squeeze && npm run docs:readme",
|
|
55
|
-
"print:globals": "node --no-warnings ./bin/cli print:globals",
|
|
56
|
-
"release": "release-it",
|
|
57
|
-
"test": "node ./bin/cli test",
|
|
58
|
-
"test:dev": "npm test -- --watch",
|
|
59
|
-
"test:ui": "npm test -- --ui"
|
|
60
|
-
},
|
|
61
|
-
"repository": {
|
|
62
|
-
"type": "git",
|
|
63
|
-
"url": "git+https://gitlab.com/hperchec/juisy.git"
|
|
64
|
-
},
|
|
65
|
-
"keywords": [
|
|
66
|
-
"js",
|
|
67
|
-
"build",
|
|
68
|
-
"release",
|
|
69
|
-
"changelog",
|
|
70
|
-
"bin",
|
|
71
|
-
"cmd",
|
|
72
|
-
"easy"
|
|
73
|
-
],
|
|
74
|
-
"author": {
|
|
75
|
-
"name": "Hervé Perchec",
|
|
76
|
-
"email": "contact@herve-perchec.com",
|
|
77
|
-
"url": "https://gitlab.com/herveperchec"
|
|
78
|
-
},
|
|
79
|
-
"license": "GPL-3.0-only",
|
|
80
|
-
"bugs": {
|
|
81
|
-
"url": "https://gitlab.com/hperchec/juisy/issues"
|
|
24
|
+
"#juisy/templater": {
|
|
25
|
+
"types": "./dist/templater/index.d.ts",
|
|
26
|
+
"import": "./dist/templater/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js"
|
|
82
33
|
},
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
|
|
34
|
+
"./cli": {
|
|
35
|
+
"types": "./dist/cli/index.d.ts",
|
|
36
|
+
"import": "./dist/cli/index.js"
|
|
86
37
|
},
|
|
87
|
-
"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
"@github/markdownlint-github": "^0.7.0",
|
|
91
|
-
"@release-it/bumper": "6.0.1",
|
|
92
|
-
"@release-it/conventional-changelog": "^9.0.4",
|
|
93
|
-
"@stylistic/eslint-plugin": "^2",
|
|
94
|
-
"@typescript-eslint/eslint-plugin": "^8",
|
|
95
|
-
"chalk": "^4.1.2",
|
|
96
|
-
"conventional-changelog-cli": "^5.0.0",
|
|
97
|
-
"eslint": "^9",
|
|
98
|
-
"lint-staged": "^14.0.1",
|
|
99
|
-
"markdownlint-cli2": "^0.12.0",
|
|
100
|
-
"markdownlint-cli2-formatter-pretty": "^0.0.7",
|
|
101
|
-
"prompts": "^2.4.2",
|
|
102
|
-
"release-it": "^17.11.0",
|
|
103
|
-
"simple-git-hooks": "^2.9.0",
|
|
104
|
-
"yargs": "^17.7.2"
|
|
38
|
+
"./templater": {
|
|
39
|
+
"types": "./dist/templater/index.d.ts",
|
|
40
|
+
"import": "./dist/templater/index.js"
|
|
105
41
|
},
|
|
106
|
-
"
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
},
|
|
110
|
-
"@release-it/bumper": {
|
|
111
|
-
"optional": true
|
|
112
|
-
},
|
|
113
|
-
"@release-it/conventional-changelog": {
|
|
114
|
-
"optional": true
|
|
115
|
-
},
|
|
116
|
-
"markdownlint-cli2-formatter-pretty": {
|
|
117
|
-
"optional": true
|
|
118
|
-
}
|
|
42
|
+
"./vite-plugin-inject-css-variables": {
|
|
43
|
+
"types": "./dist/vite/plugins/inject-css-variables/index.d.ts",
|
|
44
|
+
"import": "./dist/vite/plugins/inject-css-variables/index.js"
|
|
119
45
|
},
|
|
120
|
-
"
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
46
|
+
"./vite-plugin-inject-project-globals": {
|
|
47
|
+
"types": "./dist/vite/plugins/inject-project-globals/index.d.ts",
|
|
48
|
+
"import": "./dist/vite/plugins/inject-project-globals/index.js"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"publishConfig": {
|
|
52
|
+
"access": "public"
|
|
53
|
+
},
|
|
54
|
+
"scripts": {
|
|
55
|
+
"build": "vite build",
|
|
56
|
+
"audit": "ncu && npm audit",
|
|
57
|
+
"audit:fix": "ncu --interactive",
|
|
58
|
+
"docs": "npm run docs:cli && npm run docs:api",
|
|
59
|
+
"docs:api": "node ./bin/cli docs generate:api",
|
|
60
|
+
"docs:cli": "npm run docs:cli:private && npm run docs:cli:public",
|
|
61
|
+
"docs:cli:private": "node ./bin/cli docs generate:cli -c ./docs/cli/private/config.js",
|
|
62
|
+
"docs:cli:public": "node ./bin/cli docs generate:cli -c ./docs/cli/public/config.js",
|
|
63
|
+
"example:reset": "git checkout --no-overlay -- example && cd example && git clean -fdX",
|
|
64
|
+
"example:test": "npm run example:reset && cd example && npm install -D juisy@file:../ && npx juisy squeeze && npm run docs:readme",
|
|
65
|
+
"print:globals": "node --no-warnings ./bin/cli print:globals",
|
|
66
|
+
"release": "release-it --no-increment",
|
|
67
|
+
"test": "node ./bin/cli test",
|
|
68
|
+
"test:dev": "npm test -- --watch",
|
|
69
|
+
"test:ui": "vitest --ui"
|
|
70
|
+
},
|
|
71
|
+
"repository": {
|
|
72
|
+
"type": "git",
|
|
73
|
+
"url": "git+https://gitlab.com/hperchec/juisy.git"
|
|
74
|
+
},
|
|
75
|
+
"keywords": [
|
|
76
|
+
"js",
|
|
77
|
+
"build",
|
|
78
|
+
"release",
|
|
79
|
+
"changelog",
|
|
80
|
+
"bin",
|
|
81
|
+
"cmd",
|
|
82
|
+
"easy"
|
|
83
|
+
],
|
|
84
|
+
"author": {
|
|
85
|
+
"name": "Hervé Perchec",
|
|
86
|
+
"email": "contact@herve-perchec.com",
|
|
87
|
+
"url": "https://gitlab.com/herveperchec"
|
|
88
|
+
},
|
|
89
|
+
"license": "GPL-3.0-only",
|
|
90
|
+
"bugs": {
|
|
91
|
+
"url": "https://gitlab.com/hperchec/juisy/issues"
|
|
92
|
+
},
|
|
93
|
+
"homepage": "https://hperchec.gitlab.io/juisy",
|
|
94
|
+
"bin": {
|
|
95
|
+
"juisy": "./bin/cli/index.js"
|
|
96
|
+
},
|
|
97
|
+
"peerDependencies": {
|
|
98
|
+
"@commitlint/cli": "^19.6.1",
|
|
99
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
100
|
+
"@github/markdownlint-github": "^0.6.3",
|
|
101
|
+
"@release-it/bumper": "6.0.1",
|
|
102
|
+
"@release-it/conventional-changelog": "^9.0.4",
|
|
103
|
+
"@stylistic/eslint-plugin": "^2",
|
|
104
|
+
"@typescript-eslint/eslint-plugin": "^8",
|
|
105
|
+
"chalk": "^5.4.1",
|
|
106
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
107
|
+
"eslint": "^9",
|
|
108
|
+
"globals": "^15",
|
|
109
|
+
"lint-staged": "^14.0.1",
|
|
110
|
+
"markdownlint-cli2": "^0.12.0",
|
|
111
|
+
"markdownlint-cli2-formatter-pretty": "^0.0.7",
|
|
112
|
+
"prompts": "^2.4.2",
|
|
113
|
+
"release-it": "^17.11.0",
|
|
114
|
+
"simple-git-hooks": "^2.9.0",
|
|
115
|
+
"yargs": "^17.7.2"
|
|
116
|
+
},
|
|
117
|
+
"peerDependenciesMeta": {
|
|
118
|
+
"@release-it/bumper": {
|
|
119
|
+
"optional": true
|
|
155
120
|
},
|
|
156
|
-
"
|
|
157
|
-
|
|
158
|
-
"ascii-tree": "^0.3.0",
|
|
159
|
-
"chalk": "^4.1.2",
|
|
160
|
-
"conventional-recommended-bump": "^10.0.0",
|
|
161
|
-
"deepmerge": "^4.3.1",
|
|
162
|
-
"ejs": "^3.1.10",
|
|
163
|
-
"execa": "^8",
|
|
164
|
-
"find-up": "^7.0.0",
|
|
165
|
-
"fs-extra": "^11.2.0",
|
|
166
|
-
"github-slugger": "^2.0.0",
|
|
167
|
-
"glob": "^11.0.0",
|
|
168
|
-
"handlebars": "^4.7.8",
|
|
169
|
-
"import-single-ts": "^1.2.0",
|
|
170
|
-
"indent-string": "^5.0.0",
|
|
171
|
-
"json-2-csv": "^5.5.7",
|
|
172
|
-
"jstoxml": "^5.0.2",
|
|
173
|
-
"lodash.get": "^4.4.2",
|
|
174
|
-
"lodash.kebabcase": "^4.1.1",
|
|
175
|
-
"lodash.merge": "^4.6.2",
|
|
176
|
-
"lodash.set": "^4.3.2",
|
|
177
|
-
"loglevel": "^1.9.2",
|
|
178
|
-
"markdown-toc": "^1.2.0",
|
|
179
|
-
"markdown-utils": "^1.0.0",
|
|
180
|
-
"package-json-type": "^1.0.3",
|
|
181
|
-
"pkg-dir": "^8.0.0",
|
|
182
|
-
"prompts": "^2.4.2",
|
|
183
|
-
"remark": "^15.0.1",
|
|
184
|
-
"remark-frontmatter": "^5.0.0",
|
|
185
|
-
"remark-toc": "^9.0.0",
|
|
186
|
-
"semver": "^7.7.1",
|
|
187
|
-
"simple-git-hooks": "^2.9.0",
|
|
188
|
-
"strip-ansi": "^7.1.0",
|
|
189
|
-
"ts-json-schema-generator": "^2.3.0",
|
|
190
|
-
"typedoc": "^0.27.5",
|
|
191
|
-
"typedoc-plugin-frontmatter": "^1.1.2",
|
|
192
|
-
"typedoc-plugin-markdown": "^4.3.3",
|
|
193
|
-
"typedoc-vitepress-theme": "^1.1.1",
|
|
194
|
-
"yaml": "^2.6.1",
|
|
195
|
-
"yargs": "^17.7.2",
|
|
196
|
-
"yargs-parser": "^21.1.1"
|
|
121
|
+
"@release-it/conventional-changelog": {
|
|
122
|
+
"optional": true
|
|
197
123
|
},
|
|
198
|
-
"
|
|
199
|
-
|
|
124
|
+
"simple-git-hooks": {
|
|
125
|
+
"optional": true
|
|
200
126
|
}
|
|
127
|
+
},
|
|
128
|
+
"devDependencies": {
|
|
129
|
+
"@babel/eslint-parser": "^7.25.9",
|
|
130
|
+
"@conventional-changelog/git-client": "^1.0.1",
|
|
131
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
132
|
+
"@stylistic/eslint-plugin": "^2.12.1",
|
|
133
|
+
"@types/conventional-changelog": "^3.1.5",
|
|
134
|
+
"@types/conventional-changelog-config-spec": "^2.1.5",
|
|
135
|
+
"@types/ejs": "^3.1.5",
|
|
136
|
+
"@types/fs-extra": "^11.0.4",
|
|
137
|
+
"@types/lint-staged": "^13.3.0",
|
|
138
|
+
"@types/lodash.get": "^4.4.9",
|
|
139
|
+
"@types/lodash.kebabcase": "^4.1.9",
|
|
140
|
+
"@types/lodash.merge": "^4.6.9",
|
|
141
|
+
"@types/lodash.set": "^4.3.9",
|
|
142
|
+
"@types/node": "^22.10.2",
|
|
143
|
+
"@types/prompts": "^2.4.9",
|
|
144
|
+
"@types/semver": "^7.5.8",
|
|
145
|
+
"@types/yargs": "^17.0.33",
|
|
146
|
+
"@types/yargs-parser": "^21.0.3",
|
|
147
|
+
"@typescript-eslint/eslint-plugin": "^8.18.1",
|
|
148
|
+
"@vitest/coverage-v8": "^2.1.8",
|
|
149
|
+
"@vitest/ui": "^2.1.8",
|
|
150
|
+
"cpy-cli": "^5.0.0",
|
|
151
|
+
"eslint": "^9.17.0",
|
|
152
|
+
"happy-dom": "^15.11.7",
|
|
153
|
+
"json-schema-to-ts": "^3.1.1",
|
|
154
|
+
"lint-staged": "^14.0.1",
|
|
155
|
+
"npm-check-updates": "^17.1.12",
|
|
156
|
+
"quicktype": "^23.0.170",
|
|
157
|
+
"typedoc": "^0.28.1",
|
|
158
|
+
"typedoc-plugin-frontmatter": "^1.3.0",
|
|
159
|
+
"typedoc-plugin-markdown": "^4.5.2",
|
|
160
|
+
"typedoc-vitepress-theme": "^1.1.2",
|
|
161
|
+
"typescript": "^5.7.2",
|
|
162
|
+
"vite": "^5.4.11",
|
|
163
|
+
"vite-plugin-dts": "^4.3.0",
|
|
164
|
+
"vite-plugin-generate-file": "^0.2.0",
|
|
165
|
+
"vitest": "^2.1.8"
|
|
166
|
+
},
|
|
167
|
+
"dependencies": {
|
|
168
|
+
"@commitlint/types": "^19.8.0",
|
|
169
|
+
"@dotenvx/dotenvx": "^1.31.0",
|
|
170
|
+
"ascii-tree": "^0.3.0",
|
|
171
|
+
"chalk": "^5.4.1",
|
|
172
|
+
"conventional-recommended-bump": "^10.0.0",
|
|
173
|
+
"deepmerge": "^4.3.1",
|
|
174
|
+
"ejs": "^3.1.10",
|
|
175
|
+
"execa": "^9.5.2",
|
|
176
|
+
"find-up": "^7.0.0",
|
|
177
|
+
"fs-extra": "^11.2.0",
|
|
178
|
+
"github-slugger": "^2.0.0",
|
|
179
|
+
"glob": "^11.0.0",
|
|
180
|
+
"handlebars": "^4.7.8",
|
|
181
|
+
"import-single-ts": "^1.2.0",
|
|
182
|
+
"indent-string": "^5.0.0",
|
|
183
|
+
"json-2-csv": "^5.5.7",
|
|
184
|
+
"jstoxml": "^5.0.2",
|
|
185
|
+
"lodash.get": "^4.4.2",
|
|
186
|
+
"lodash.kebabcase": "^4.1.1",
|
|
187
|
+
"lodash.merge": "^4.6.2",
|
|
188
|
+
"lodash.set": "^4.3.2",
|
|
189
|
+
"loglevel": "^1.9.2",
|
|
190
|
+
"markdown-table": "^3.0.4",
|
|
191
|
+
"markdown-toc": "^1.2.0",
|
|
192
|
+
"markdown-utils": "^1.0.0",
|
|
193
|
+
"package-json-type": "^1.0.3",
|
|
194
|
+
"pkg-dir": "^8.0.0",
|
|
195
|
+
"prompts": "^2.4.2",
|
|
196
|
+
"remark": "^15.0.1",
|
|
197
|
+
"remark-frontmatter": "^5.0.0",
|
|
198
|
+
"remark-toc": "^9.0.0",
|
|
199
|
+
"semver": "^7.7.1",
|
|
200
|
+
"strip-ansi": "^7.1.0",
|
|
201
|
+
"ts-json-schema-generator": "^2.3.0",
|
|
202
|
+
"yaml": "^2.6.1",
|
|
203
|
+
"yargs": "^17.7.2",
|
|
204
|
+
"yargs-parser": "^21.1.1"
|
|
205
|
+
},
|
|
206
|
+
"release-it": {
|
|
207
|
+
"git": false
|
|
208
|
+
}
|
|
201
209
|
}
|
|
@@ -1,269 +0,0 @@
|
|
|
1
|
-
import path, { dirname } from 'node:path'
|
|
2
|
-
import { fileURLToPath } from 'node:url'
|
|
3
|
-
|
|
4
|
-
import { getPackageInfo, eject } from '#juisy'
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url)
|
|
7
|
-
const __dirname = dirname(__filename)
|
|
8
|
-
|
|
9
|
-
const isDef = value => value !== undefined
|
|
10
|
-
|
|
11
|
-
/** @type {import('#juisy/cli').Command} */
|
|
12
|
-
export default new CLI.Command({
|
|
13
|
-
command: 'squeeze',
|
|
14
|
-
describe: 'Initialize project folder',
|
|
15
|
-
builder (yargs) {
|
|
16
|
-
yargs.option('f', {
|
|
17
|
-
alias: 'force',
|
|
18
|
-
type: 'boolean',
|
|
19
|
-
default: false,
|
|
20
|
-
describe: 'Overwrites existing files / scripts / ...'
|
|
21
|
-
})
|
|
22
|
-
return yargs
|
|
23
|
-
},
|
|
24
|
-
async handler (argv) {
|
|
25
|
-
const {
|
|
26
|
-
rootDir: targetProjectRootDir, // rootDir is parent project
|
|
27
|
-
prompts,
|
|
28
|
-
run
|
|
29
|
-
} = CLI.InterfaceUtils
|
|
30
|
-
const {
|
|
31
|
-
$style,
|
|
32
|
-
log,
|
|
33
|
-
step,
|
|
34
|
-
substep
|
|
35
|
-
} = CLI.OutputUtils
|
|
36
|
-
|
|
37
|
-
const templateDir = 'template'
|
|
38
|
-
const getTemplatePath = target => path.resolve(__dirname, '../../../', templateDir, target)
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Eject files from template
|
|
42
|
-
*/
|
|
43
|
-
step('Copying files')
|
|
44
|
-
|
|
45
|
-
await eject('**/*', {
|
|
46
|
-
force: argv.force,
|
|
47
|
-
logLevel: 'warn'
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
substep($style.green(`✔ Successfuly copied`), { last: true })
|
|
51
|
-
log() // Blank line
|
|
52
|
-
|
|
53
|
-
// substep($style.yellow('Target directory "bin" already exists. Skipped... Use --force option to overwrite'), { last: true })
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Update package.json file
|
|
57
|
-
*/
|
|
58
|
-
// const scripts = {
|
|
59
|
-
// 'docs:api': 'node ./bin/cli docs generate -c ./docs/docs.config.js',
|
|
60
|
-
// 'docs:readme': 'node ./bin/cli docs generate:readme',
|
|
61
|
-
// 'docs:lint': 'node ./bin/cli docs lint',
|
|
62
|
-
// 'docs:lint:fix': 'npm run docs:lint -- --fix',
|
|
63
|
-
// 'docs': 'npm run docs:readme && npm run docs:api && npm run docs:lint',
|
|
64
|
-
// 'lint': 'npx eslint . --ext .js',
|
|
65
|
-
// 'lint:fix': 'npm run lint -- --fix',
|
|
66
|
-
// 'lint:markdown': 'npm run docs:lint',
|
|
67
|
-
// 'lint:markdown:fix': 'npm run docs:lint:fix',
|
|
68
|
-
// 'release': 'node ./bin/cli release',
|
|
69
|
-
// 'changelog': 'node ./bin/cli changelog',
|
|
70
|
-
// 'git-hooks:reset': 'node ./bin/cli git-hooks reset',
|
|
71
|
-
// 'git-hooks:sync': 'node ./bin/cli git-hooks sync',
|
|
72
|
-
// 'test': 'node ./bin/cli test',
|
|
73
|
-
// 'postinstall': 'npm run git-hooks:sync'
|
|
74
|
-
// }
|
|
75
|
-
|
|
76
|
-
const targetCliCommand = 'node ./bin/cli'
|
|
77
|
-
|
|
78
|
-
step('Adding scripts to package.json')
|
|
79
|
-
const packageJson = getPackageInfo()
|
|
80
|
-
packageJson.scripts = packageJson.scripts || {}
|
|
81
|
-
|
|
82
|
-
// "docs:api": "node ./bin/cli docs generate:api"
|
|
83
|
-
let setScript = isDef(packageJson.scripts['docs:api'])
|
|
84
|
-
? argv.force
|
|
85
|
-
: true
|
|
86
|
-
if (setScript) {
|
|
87
|
-
await run('npm', [ 'set-script', 'docs:api', `${targetCliCommand} docs generate:api` ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
88
|
-
substep($style.green('✔ Script "docs:api" successfuly added'))
|
|
89
|
-
} else {
|
|
90
|
-
substep($style.yellow('Script "docs:api" already set. Use --force option to overwrite'))
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// "docs:readme": "node ./bin/cli docs generate:readme -c ./docs/readme/config.js"
|
|
94
|
-
setScript = isDef(packageJson.scripts['docs:readme'])
|
|
95
|
-
? argv.force
|
|
96
|
-
: true
|
|
97
|
-
if (setScript) {
|
|
98
|
-
await run('npm', [
|
|
99
|
-
'set-script',
|
|
100
|
-
'docs:readme',
|
|
101
|
-
`${targetCliCommand} docs generate:readme -c ./docs/readme/config.js`
|
|
102
|
-
], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
103
|
-
substep($style.green('✔ Script "docs:readme" successfuly added'))
|
|
104
|
-
} else {
|
|
105
|
-
substep($style.yellow('Script "docs:readme" already set. Use --force option to overwrite'))
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// "docs": "npm run docs:readme && npm run docs:api"
|
|
109
|
-
setScript = isDef(packageJson.scripts.docs)
|
|
110
|
-
? argv.force
|
|
111
|
-
: true
|
|
112
|
-
if (setScript) {
|
|
113
|
-
await run('npm', [ 'set-script', 'docs', 'npm run docs:readme && npm run docs:api' ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
114
|
-
substep($style.green('✔ Script "docs" successfuly added'))
|
|
115
|
-
} else {
|
|
116
|
-
substep($style.yellow('Script "docs" already set. Use --force option to overwrite'))
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// "release": "node ./bin/cli release"
|
|
120
|
-
setScript = isDef(packageJson.scripts.release)
|
|
121
|
-
? argv.force
|
|
122
|
-
: true
|
|
123
|
-
if (setScript) {
|
|
124
|
-
await run('npm', [ 'set-script', 'release', `${targetCliCommand} release` ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
125
|
-
substep($style.green('✔ Script "release" successfuly added'))
|
|
126
|
-
} else {
|
|
127
|
-
substep($style.yellow('Script "release" already set. Use --force option to overwrite'))
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// "changelog": "node ./bin/cli changelog"
|
|
131
|
-
setScript = isDef(packageJson.scripts.changelog)
|
|
132
|
-
? argv.force
|
|
133
|
-
: true
|
|
134
|
-
if (setScript) {
|
|
135
|
-
await run('npm', [ 'set-script', 'changelog', `${targetCliCommand} changelog` ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
136
|
-
substep($style.green('✔ Script "changelog" successfuly added'))
|
|
137
|
-
} else {
|
|
138
|
-
substep($style.yellow('Script "changelog" already set. Use --force option to overwrite'))
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// "git-hooks:reset": "node ./bin/cli git-hooks reset"
|
|
142
|
-
setScript = isDef(packageJson.scripts['git-hooks:reset'])
|
|
143
|
-
? argv.force
|
|
144
|
-
: true
|
|
145
|
-
if (setScript) {
|
|
146
|
-
await run('npm', [ 'set-script', 'git-hooks:reset', `${targetCliCommand} git-hooks reset` ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
147
|
-
substep($style.green('✔ Script "git-hooks:reset" successfuly added'))
|
|
148
|
-
} else {
|
|
149
|
-
substep($style.yellow('Script "git-hooks:reset" already set. Use --force option to overwrite'))
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// "git-hooks:sync": "node ./bin/cli git-hooks sync"
|
|
153
|
-
setScript = isDef(packageJson.scripts['git-hooks:sync'])
|
|
154
|
-
? argv.force
|
|
155
|
-
: true
|
|
156
|
-
if (setScript) {
|
|
157
|
-
await run('npm', [ 'set-script', 'git-hooks:sync', `${targetCliCommand} git-hooks sync` ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
158
|
-
substep($style.green('✔ Script "git-hooks:sync" successfuly added'))
|
|
159
|
-
} else {
|
|
160
|
-
substep($style.yellow('Script "git-hooks:sync" already set. Use --force option to overwrite'))
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// "postinstall": "npm run git-hooks:sync"
|
|
164
|
-
setScript = isDef(packageJson.scripts.postinstall)
|
|
165
|
-
? argv.force
|
|
166
|
-
: true
|
|
167
|
-
if (setScript) {
|
|
168
|
-
await run('npm', [ 'set-script', 'postinstall', 'npm run git-hooks:sync' ], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
169
|
-
substep($style.green('✔ Script "postinstall" successfuly added'))
|
|
170
|
-
} else {
|
|
171
|
-
substep($style.yellow('Script "postinstall" already set. Use --force option to overwrite'))
|
|
172
|
-
}
|
|
173
|
-
substep($style.green('✔ package.json updated'), { last: true })
|
|
174
|
-
log() // Blank line
|
|
175
|
-
|
|
176
|
-
// Adding repository info
|
|
177
|
-
step('Adding repository config to package.json')
|
|
178
|
-
// set repository config
|
|
179
|
-
const setRepository = isDef(packageJson.repository)
|
|
180
|
-
? argv.force
|
|
181
|
-
: true
|
|
182
|
-
if (setRepository) {
|
|
183
|
-
const repositoryConfig = {
|
|
184
|
-
type: 'git',
|
|
185
|
-
url: 'https://gitlab.com/hperchec/juisy'
|
|
186
|
-
}
|
|
187
|
-
await run('npm', [
|
|
188
|
-
'pkg',
|
|
189
|
-
'set',
|
|
190
|
-
`repository=${JSON.stringify(repositoryConfig)}`,
|
|
191
|
-
'--json'
|
|
192
|
-
], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
193
|
-
substep($style.green('✔ Repository config successfuly added'), { last: true })
|
|
194
|
-
} else {
|
|
195
|
-
substep($style.yellow('Repository config already set. Use --force option to overwrite'), { last: true })
|
|
196
|
-
}
|
|
197
|
-
log() // Blank line
|
|
198
|
-
|
|
199
|
-
// Adding issues URL info
|
|
200
|
-
step('Adding issues/bugs config to package.json')
|
|
201
|
-
// set bugs config
|
|
202
|
-
const setBugs = isDef(packageJson.bugs)
|
|
203
|
-
? argv.force
|
|
204
|
-
: true
|
|
205
|
-
if (setBugs) {
|
|
206
|
-
const bugsConfig = {
|
|
207
|
-
url: 'https://gitlab.com/hperchec/juisy/issues'
|
|
208
|
-
}
|
|
209
|
-
await run('npm', [
|
|
210
|
-
'pkg',
|
|
211
|
-
'set',
|
|
212
|
-
`bugs=${JSON.stringify(bugsConfig)}`,
|
|
213
|
-
'--json'
|
|
214
|
-
], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
215
|
-
substep($style.green('✔ Issues/bugs config successfuly added'), { last: true })
|
|
216
|
-
} else {
|
|
217
|
-
substep($style.yellow('Issues/bugs config already set. Use --force option to overwrite'), { last: true })
|
|
218
|
-
}
|
|
219
|
-
log() // Blank line
|
|
220
|
-
|
|
221
|
-
// Adding git hooks
|
|
222
|
-
step('Adding git hooks config to package.json')
|
|
223
|
-
// set simple-git-hook config
|
|
224
|
-
const setSimpleGitHook = isDef(packageJson['simple-git-hooks'])
|
|
225
|
-
? argv.force
|
|
226
|
-
: true
|
|
227
|
-
if (setSimpleGitHook) {
|
|
228
|
-
const simpleGitHookConfig = {
|
|
229
|
-
'pre-commit': 'node ./bin/scripts/pre-commit.js',
|
|
230
|
-
'commit-msg': 'node ./bin/scripts/commit-msg.js ${1}'
|
|
231
|
-
}
|
|
232
|
-
await run('npm', [
|
|
233
|
-
'pkg',
|
|
234
|
-
'set',
|
|
235
|
-
`simple-git-hooks=${JSON.stringify(simpleGitHookConfig)}`,
|
|
236
|
-
'--json'
|
|
237
|
-
], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
238
|
-
substep($style.green('✔ Git hooks successfuly added'), { last: true })
|
|
239
|
-
} else {
|
|
240
|
-
substep($style.yellow('Git hooks already set. Use --force option to overwrite'), { last: true })
|
|
241
|
-
}
|
|
242
|
-
log() // Blank line
|
|
243
|
-
|
|
244
|
-
// Adding lint-staged configured
|
|
245
|
-
step('Adding lint-staged config to package.json')
|
|
246
|
-
// set lint-staged config
|
|
247
|
-
const setLintStaged = isDef(packageJson['lint-staged'])
|
|
248
|
-
? argv.force
|
|
249
|
-
: true
|
|
250
|
-
if (setLintStaged) {
|
|
251
|
-
const lintStagedConfig = {
|
|
252
|
-
'*.js': [
|
|
253
|
-
'eslint --fix',
|
|
254
|
-
'git add'
|
|
255
|
-
]
|
|
256
|
-
}
|
|
257
|
-
await run('npm', [
|
|
258
|
-
'pkg',
|
|
259
|
-
'set',
|
|
260
|
-
`lint-staged=${JSON.stringify(lintStagedConfig)}`,
|
|
261
|
-
'--json'
|
|
262
|
-
], { stdio: 'pipe', cwd: targetProjectRootDir })
|
|
263
|
-
substep($style.green('✔ lint-staged successfuly configured'), { last: true })
|
|
264
|
-
} else {
|
|
265
|
-
substep($style.yellow('lint-staged already configured. Use --force option to overwrite'), { last: true })
|
|
266
|
-
}
|
|
267
|
-
log() // Blank line
|
|
268
|
-
}
|
|
269
|
-
})
|