pob 19.2.0 → 21.0.0
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/CHANGELOG.md +59 -0
- package/lib/generators/app/PobAppGenerator.js +124 -122
- package/lib/generators/app/e2e-testing/AppE2ETestingGenerator.js +11 -11
- package/lib/generators/app/ignorePaths.js +25 -24
- package/lib/generators/app/nextjs/AppNextjsGenerator.js +9 -9
- package/lib/generators/app/remix/AppRemixGenerator.js +7 -7
- package/lib/generators/common/babel/CommonBabelGenerator.js +167 -151
- package/lib/generators/common/format-lint/CommonLintGenerator.js +185 -180
- package/lib/generators/common/format-lint/updateEslintConfig.js +9 -9
- package/lib/generators/common/husky/CommonHuskyGenerator.js +44 -44
- package/lib/generators/common/husky/templates/lint-staged.config.js.txt +1 -1
- package/lib/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js +44 -44
- package/lib/generators/common/release/CommonReleaseGenerator.js +40 -39
- package/lib/generators/common/release/templates/workflow-release.yml.ejs +2 -2
- package/lib/generators/common/testing/CommonTestingGenerator.js +193 -191
- package/lib/generators/common/testing/templates/index.js +3 -3
- package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +160 -167
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +79 -75
- package/lib/generators/core/ci/CoreCIGenerator.js +70 -75
- package/lib/generators/core/clean/CoreCleanGenerator.js +4 -4
- package/lib/generators/core/editorconfig/CoreEditorConfigGenerator.js +3 -3
- package/lib/generators/core/git/CoreGitGenerator.js +42 -42
- package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +41 -41
- package/lib/generators/core/gitignore/CoreGitignoreGenerator.js +19 -23
- package/lib/generators/core/npm/CoreNpmGenerator.js +19 -19
- package/lib/generators/core/package/CorePackageGenerator.js +94 -94
- package/lib/generators/core/package/askName.js +4 -4
- package/lib/generators/core/renovate/CoreRenovateGenerator.js +26 -26
- package/lib/generators/core/sort-package/CoreSortPackageGenerator.js +5 -5
- package/lib/generators/core/vscode/CoreVSCodeGenerator.js +39 -38
- package/lib/generators/core/yarn/CoreYarnGenerator.js +82 -77
- package/lib/generators/lib/PobLibGenerator.js +127 -125
- package/lib/generators/lib/doc/LibDocGenerator.js +40 -40
- package/lib/generators/lib/readme/LibReadmeGenerator.js +19 -19
- package/lib/generators/monorepo/PobMonorepoGenerator.js +87 -86
- package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +44 -40
- package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +35 -35
- package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +60 -56
- package/lib/generators/pob/PobBaseGenerator.js +83 -83
- package/lib/pob-dirname.cjs +1 -1
- package/lib/pob.js +112 -112
- package/lib/utils/dependenciesPackages.cjs +4 -4
- package/lib/utils/ensureJsonFileFormatted.js +5 -5
- package/lib/utils/inMonorepo.js +8 -8
- package/lib/utils/json5.js +1 -1
- package/lib/utils/package.js +37 -37
- package/lib/utils/packagejson.js +5 -0
- package/lib/utils/writeAndFormat.js +8 -9
- package/package.json +23 -19
- package/lib/utils/packagejson.cjs +0 -3
|
@@ -1,162 +1,166 @@
|
|
|
1
|
-
import { existsSync } from
|
|
2
|
-
import Generator from
|
|
3
|
-
import inMonorepo from
|
|
4
|
-
import * as packageUtils from
|
|
5
|
-
import { copyAndFormatTpl } from
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import Generator from "yeoman-generator";
|
|
3
|
+
import inMonorepo from "../../../utils/inMonorepo.js";
|
|
4
|
+
import * as packageUtils from "../../../utils/package.js";
|
|
5
|
+
import { copyAndFormatTpl } from "../../../utils/writeAndFormat.js";
|
|
6
6
|
|
|
7
7
|
export default class CommonTypescriptGenerator extends Generator {
|
|
8
8
|
constructor(args, opts) {
|
|
9
9
|
super(args, opts);
|
|
10
10
|
|
|
11
|
-
this.option(
|
|
11
|
+
this.option("enable", {
|
|
12
12
|
type: Boolean,
|
|
13
13
|
default: true,
|
|
14
|
-
|
|
14
|
+
description: "enable typescript",
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
this.option(
|
|
17
|
+
this.option("isApp", {
|
|
18
18
|
type: Boolean,
|
|
19
19
|
required: true,
|
|
20
|
-
|
|
20
|
+
description: "is app",
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
this.option(
|
|
23
|
+
this.option("isAppLibrary", {
|
|
24
24
|
type: Boolean,
|
|
25
25
|
required: false,
|
|
26
26
|
default: false,
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
this.option(
|
|
29
|
+
this.option("rootDir", {
|
|
30
30
|
type: String,
|
|
31
|
-
default:
|
|
32
|
-
|
|
31
|
+
default: "src",
|
|
32
|
+
description: "customize rootDir",
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
this.option(
|
|
35
|
+
this.option("srcDirectory", {
|
|
36
36
|
type: String,
|
|
37
|
-
default:
|
|
38
|
-
|
|
37
|
+
default: "src",
|
|
38
|
+
description: "customize srcDirectory, if different than rootDir",
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
this.option(
|
|
41
|
+
this.option("jsx", {
|
|
42
42
|
type: Boolean,
|
|
43
43
|
default: true,
|
|
44
|
-
|
|
44
|
+
description: "enable jsx with typescript",
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
this.option(
|
|
47
|
+
this.option("jsxPreserve", {
|
|
48
48
|
type: Boolean,
|
|
49
49
|
default: false,
|
|
50
|
-
|
|
50
|
+
description:
|
|
51
|
+
"force jsx preserve in tsconfig for legacy apps (nextjs, CRA)",
|
|
51
52
|
});
|
|
52
53
|
|
|
53
|
-
this.option(
|
|
54
|
+
this.option("forceExcludeNodeModules", {
|
|
54
55
|
type: Boolean,
|
|
55
56
|
default: false,
|
|
56
|
-
|
|
57
|
+
description: "force exclude node_modules for legacy apps (nextjs, CRA)",
|
|
57
58
|
});
|
|
58
59
|
|
|
59
|
-
this.option(
|
|
60
|
+
this.option("forceAllowJs", {
|
|
60
61
|
type: Boolean,
|
|
61
62
|
default: false,
|
|
62
|
-
|
|
63
|
+
description: "force allow js for legacy apps (nextjs, CRA)",
|
|
63
64
|
});
|
|
64
65
|
|
|
65
|
-
this.option(
|
|
66
|
+
this.option("dom", {
|
|
66
67
|
type: Boolean,
|
|
67
68
|
default: true,
|
|
68
|
-
|
|
69
|
+
description: "enable dom with typescript",
|
|
69
70
|
});
|
|
70
71
|
|
|
71
|
-
this.option(
|
|
72
|
+
this.option("baseUrl", {
|
|
72
73
|
type: String,
|
|
73
|
-
default:
|
|
74
|
-
|
|
74
|
+
default: "",
|
|
75
|
+
description: "baseUrl option",
|
|
75
76
|
});
|
|
76
77
|
|
|
77
|
-
this.option(
|
|
78
|
+
this.option("resolveJsonModule", {
|
|
78
79
|
type: Boolean,
|
|
79
80
|
default: false,
|
|
80
|
-
|
|
81
|
+
description: "resolveJsonModule option",
|
|
81
82
|
});
|
|
82
83
|
|
|
83
|
-
this.option(
|
|
84
|
+
this.option("builddefs", {
|
|
84
85
|
type: Boolean,
|
|
85
86
|
default: true,
|
|
86
|
-
|
|
87
|
+
description: "build .d.ts option",
|
|
87
88
|
});
|
|
88
|
-
this.option(
|
|
89
|
+
this.option("plugins", {
|
|
89
90
|
type: String,
|
|
90
|
-
default:
|
|
91
|
-
|
|
91
|
+
default: "",
|
|
92
|
+
description: "typescript plugins",
|
|
92
93
|
});
|
|
93
|
-
this.option(
|
|
94
|
+
this.option("nextConfig", {
|
|
94
95
|
type: Boolean,
|
|
95
96
|
default: false,
|
|
96
97
|
});
|
|
97
|
-
this.option(
|
|
98
|
+
this.option("additionalIncludes", {
|
|
98
99
|
type: String,
|
|
99
|
-
default:
|
|
100
|
-
|
|
100
|
+
default: "",
|
|
101
|
+
description: "typescript additional includes",
|
|
101
102
|
});
|
|
102
103
|
|
|
103
|
-
this.option(
|
|
104
|
+
this.option("onlyLatestLTS", {
|
|
104
105
|
type: Boolean,
|
|
105
106
|
required: false,
|
|
106
107
|
default: false,
|
|
107
|
-
|
|
108
|
+
description: "only latest lts",
|
|
108
109
|
});
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
writing() {
|
|
112
|
-
if (this.fs.exists(
|
|
113
|
-
if (this.fs.exists(this.destinationPath(
|
|
114
|
-
this.fs.delete(this.destinationPath(
|
|
113
|
+
if (this.fs.exists("flow-typed")) this.fs.delete("flow-typed");
|
|
114
|
+
if (this.fs.exists(this.destinationPath(".flowconfig"))) {
|
|
115
|
+
this.fs.delete(this.destinationPath(".flowconfig"));
|
|
115
116
|
}
|
|
116
117
|
|
|
117
|
-
const pkg = this.fs.readJSON(this.destinationPath(
|
|
118
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
118
119
|
|
|
119
120
|
const presets = (() => {
|
|
120
|
-
const babelEnvs =
|
|
121
|
+
const babelEnvs =
|
|
122
|
+
pkg.pob?.babelEnvs ||
|
|
123
|
+
(pkg.pob?.bundler === "rollup-babel" && pkg.pob.envs) ||
|
|
124
|
+
[];
|
|
121
125
|
const withBabel = babelEnvs.length > 0;
|
|
122
126
|
const withTypescript = withBabel || pkg.pob?.typescript === true;
|
|
123
127
|
const jsx = (withBabel || withTypescript) && pkg.pob.jsx === true;
|
|
124
128
|
|
|
125
129
|
if (withBabel) {
|
|
126
130
|
return jsx || this.options.dom
|
|
127
|
-
? [
|
|
128
|
-
: [
|
|
131
|
+
? ["@pob/root/tsconfigs/targets/rollup-babel-with-dom.json"]
|
|
132
|
+
: ["@pob/root/tsconfigs/targets/rollup-babel.json"];
|
|
129
133
|
}
|
|
130
134
|
if (withTypescript) {
|
|
131
|
-
const nodeVersion = this.options.onlyLatestLTS ?
|
|
135
|
+
const nodeVersion = this.options.onlyLatestLTS ? "20" : "18";
|
|
132
136
|
const envs = pkg.pob?.envs || [
|
|
133
137
|
{
|
|
134
|
-
target:
|
|
135
|
-
version:
|
|
138
|
+
target: "node",
|
|
139
|
+
version: "18",
|
|
136
140
|
},
|
|
137
141
|
];
|
|
138
142
|
if (pkg.pob.rollup === false || pkg.pob.bundler === false) {
|
|
139
143
|
return [`@pob/root/tsconfigs/targets/node-${nodeVersion}.json`];
|
|
140
144
|
}
|
|
141
|
-
if (envs && envs.every((env) => env.target ===
|
|
145
|
+
if (envs && envs.every((env) => env.target === "node")) {
|
|
142
146
|
return [
|
|
143
147
|
`@pob/root/tsconfigs/targets/${
|
|
144
|
-
!pkg.pob.bundler || pkg.pob.bundler.startsWith(
|
|
145
|
-
?
|
|
148
|
+
!pkg.pob.bundler || pkg.pob.bundler.startsWith("rollup")
|
|
149
|
+
? "rollup"
|
|
146
150
|
: pkg.pob.bundler
|
|
147
151
|
}-node-${nodeVersion}.json`,
|
|
148
152
|
];
|
|
149
153
|
}
|
|
150
|
-
return [
|
|
154
|
+
return ["@pob/root/tsconfigs/targets/rollup-es2015.json"];
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
if (this.options.dom) {
|
|
154
|
-
return [
|
|
158
|
+
return ["@pob/root/tsconfigs/targets/webpack.json"];
|
|
155
159
|
}
|
|
156
160
|
return [];
|
|
157
161
|
})();
|
|
158
162
|
|
|
159
|
-
packageUtils.removeDevDependencies(pkg, [
|
|
163
|
+
packageUtils.removeDevDependencies(pkg, ["flow-bin"]);
|
|
160
164
|
|
|
161
165
|
if (pkg.scripts) {
|
|
162
166
|
delete pkg.scripts.flow;
|
|
@@ -165,14 +169,14 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
165
169
|
packageUtils.addOrRemoveDevDependencies(
|
|
166
170
|
pkg,
|
|
167
171
|
this.options.enable ||
|
|
168
|
-
this.fs.exists(this.destinationPath(
|
|
169
|
-
[
|
|
172
|
+
this.fs.exists(this.destinationPath("lib/index.d.ts")),
|
|
173
|
+
["typescript"],
|
|
170
174
|
);
|
|
171
175
|
|
|
172
|
-
const tsconfigPath = this.destinationPath(
|
|
173
|
-
const tsconfigCheckPath = this.destinationPath(
|
|
174
|
-
const tsconfigEslintPath = this.destinationPath(
|
|
175
|
-
const tsconfigBuildPath = this.destinationPath(
|
|
176
|
+
const tsconfigPath = this.destinationPath("tsconfig.json");
|
|
177
|
+
const tsconfigCheckPath = this.destinationPath("tsconfig.check.json");
|
|
178
|
+
const tsconfigEslintPath = this.destinationPath("tsconfig.eslint.json");
|
|
179
|
+
const tsconfigBuildPath = this.destinationPath("tsconfig.build.json");
|
|
176
180
|
|
|
177
181
|
if (this.options.enable) {
|
|
178
182
|
const { jsx, dom } = this.options;
|
|
@@ -192,8 +196,8 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
192
196
|
if (composite) {
|
|
193
197
|
packageUtils.addOrRemoveDevDependencies(
|
|
194
198
|
pkg,
|
|
195
|
-
inMonorepo.rootPackageManager ===
|
|
196
|
-
[
|
|
199
|
+
inMonorepo.rootPackageManager === "yarn",
|
|
200
|
+
["typescript"],
|
|
197
201
|
);
|
|
198
202
|
|
|
199
203
|
const packageLocations = new Map(
|
|
@@ -207,11 +211,11 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
207
211
|
.map((packageName) => [
|
|
208
212
|
packageName,
|
|
209
213
|
`../../${
|
|
210
|
-
packageName[0] ===
|
|
214
|
+
packageName[0] === "@"
|
|
211
215
|
? // eslint-disable-next-line unicorn/no-nested-ternary
|
|
212
|
-
yoConfig.pob.project.type ===
|
|
216
|
+
yoConfig.pob.project.type === "app"
|
|
213
217
|
? `packages/${packageName.slice(
|
|
214
|
-
packageName.indexOf(
|
|
218
|
+
packageName.indexOf("/") + 1,
|
|
215
219
|
)}`
|
|
216
220
|
: packageName
|
|
217
221
|
: `packages/${packageName}`
|
|
@@ -224,8 +228,8 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
224
228
|
packageName,
|
|
225
229
|
`${packageLocation}/${
|
|
226
230
|
existsSync(`${packageLocations.get(packageName)}/tsconfig.json`)
|
|
227
|
-
?
|
|
228
|
-
:
|
|
231
|
+
? "src"
|
|
232
|
+
: "lib"
|
|
229
233
|
}`,
|
|
230
234
|
],
|
|
231
235
|
);
|
|
@@ -258,7 +262,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
258
262
|
*/
|
|
259
263
|
copyAndFormatTpl(
|
|
260
264
|
this.fs,
|
|
261
|
-
this.templatePath(
|
|
265
|
+
this.templatePath("tsconfig.json.ejs"),
|
|
262
266
|
tsconfigPath,
|
|
263
267
|
{
|
|
264
268
|
emitDefinitions: this.options.builddefs,
|
|
@@ -277,9 +281,9 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
277
281
|
resolveJsonModule: this.options.resolveJsonModule,
|
|
278
282
|
forceExcludeNodeModules: this.options.forceExcludeNodeModules,
|
|
279
283
|
forceAllowJs: this.options.forceAllowJs,
|
|
280
|
-
plugins: this.options.plugins.split(
|
|
284
|
+
plugins: this.options.plugins.split(",").filter(Boolean),
|
|
281
285
|
additionalIncludes: this.options.additionalIncludes
|
|
282
|
-
.split(
|
|
286
|
+
.split(",")
|
|
283
287
|
.filter(Boolean),
|
|
284
288
|
presets,
|
|
285
289
|
},
|
|
@@ -312,6 +316,6 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
312
316
|
this.fs.delete(tsconfigEslintPath);
|
|
313
317
|
}
|
|
314
318
|
|
|
315
|
-
this.fs.writeJSON(this.destinationPath(
|
|
319
|
+
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
316
320
|
}
|
|
317
321
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import Generator from
|
|
3
|
-
import inMonorepo from
|
|
4
|
-
import * as packageUtils from
|
|
5
|
-
import { copyAndFormatTpl } from
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import Generator from "yeoman-generator";
|
|
3
|
+
import inMonorepo from "../../../utils/inMonorepo.js";
|
|
4
|
+
import * as packageUtils from "../../../utils/package.js";
|
|
5
|
+
import { copyAndFormatTpl } from "../../../utils/writeAndFormat.js";
|
|
6
6
|
|
|
7
7
|
export const ciContexts = [];
|
|
8
8
|
|
|
@@ -10,111 +10,106 @@ export default class CoreCIGenerator extends Generator {
|
|
|
10
10
|
constructor(args, opts) {
|
|
11
11
|
super(args, opts);
|
|
12
12
|
|
|
13
|
-
this.option(
|
|
13
|
+
this.option("enable", {
|
|
14
14
|
type: Boolean,
|
|
15
15
|
default: true,
|
|
16
|
-
|
|
16
|
+
description: "enable ci",
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
this.option(
|
|
19
|
+
this.option("enableReleasePlease", {
|
|
20
20
|
type: Boolean,
|
|
21
21
|
default: true,
|
|
22
|
-
|
|
22
|
+
description: "enable release-please",
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
this.option(
|
|
25
|
+
this.option("enableYarnVersion", {
|
|
26
26
|
type: Boolean,
|
|
27
27
|
default: true,
|
|
28
|
-
|
|
28
|
+
description: "enable yarn version conventional commits",
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
-
this.option(
|
|
31
|
+
this.option("build", {
|
|
32
32
|
type: Boolean,
|
|
33
33
|
default: true,
|
|
34
|
-
|
|
34
|
+
description: "enable build",
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
this.option(
|
|
37
|
+
this.option("typescript", {
|
|
38
38
|
type: Boolean,
|
|
39
39
|
default: true,
|
|
40
|
-
|
|
40
|
+
description: "enable typescript",
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
this.option(
|
|
43
|
+
this.option("testing", {
|
|
44
44
|
type: Boolean,
|
|
45
45
|
default: true,
|
|
46
|
-
|
|
46
|
+
description: "enable testing",
|
|
47
47
|
});
|
|
48
|
-
this.option(
|
|
48
|
+
this.option("testRunner", {
|
|
49
49
|
type: String,
|
|
50
50
|
required: false,
|
|
51
|
-
default:
|
|
52
|
-
|
|
51
|
+
default: "jest",
|
|
52
|
+
description: "test runner: jest | node",
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
this.option(
|
|
55
|
+
this.option("e2eTesting", {
|
|
56
56
|
type: String,
|
|
57
|
-
default:
|
|
58
|
-
|
|
57
|
+
default: "",
|
|
58
|
+
description: "e2e testing package path",
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
// type: String,
|
|
63
|
-
// required: true,
|
|
64
|
-
// desc: 'Babel Envs',
|
|
65
|
-
// });
|
|
66
|
-
|
|
67
|
-
this.option('ci', {
|
|
61
|
+
this.option("ci", {
|
|
68
62
|
type: Boolean,
|
|
69
63
|
required: true,
|
|
70
|
-
|
|
64
|
+
description: "ci with github actions",
|
|
71
65
|
});
|
|
72
66
|
|
|
73
|
-
this.option(
|
|
67
|
+
this.option("codecov", {
|
|
74
68
|
type: Boolean,
|
|
75
69
|
required: true,
|
|
76
|
-
|
|
70
|
+
description: "Include codecov report",
|
|
77
71
|
});
|
|
78
72
|
|
|
79
|
-
this.option(
|
|
73
|
+
this.option("documentation", {
|
|
80
74
|
type: Boolean,
|
|
81
75
|
required: true,
|
|
82
|
-
|
|
76
|
+
description: "Include documentation generation",
|
|
83
77
|
});
|
|
84
78
|
|
|
85
|
-
this.option(
|
|
79
|
+
this.option("isApp", {
|
|
86
80
|
type: Boolean,
|
|
87
81
|
required: true,
|
|
88
|
-
|
|
82
|
+
description: "is app",
|
|
89
83
|
});
|
|
90
84
|
|
|
91
|
-
this.option(
|
|
85
|
+
this.option("onlyLatestLTS", {
|
|
92
86
|
type: Boolean,
|
|
93
87
|
required: true,
|
|
94
|
-
|
|
88
|
+
description: "only latest lts",
|
|
95
89
|
});
|
|
96
90
|
|
|
97
|
-
this.option(
|
|
91
|
+
this.option("splitJobs", {
|
|
98
92
|
type: Boolean,
|
|
99
93
|
required: true,
|
|
100
|
-
|
|
94
|
+
description: "split CI jobs for faster result",
|
|
101
95
|
});
|
|
102
96
|
|
|
103
|
-
this.option(
|
|
97
|
+
this.option("disableYarnGitCache", {
|
|
104
98
|
type: Boolean,
|
|
105
99
|
required: false,
|
|
106
100
|
default: false,
|
|
107
|
-
|
|
101
|
+
description:
|
|
102
|
+
"Disable git cache. See https://yarnpkg.com/features/caching#offline-mirror.",
|
|
108
103
|
});
|
|
109
104
|
}
|
|
110
105
|
|
|
111
106
|
async prompting() {
|
|
112
|
-
const pkg = this.fs.readJSON(this.destinationPath(
|
|
107
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
113
108
|
|
|
114
109
|
this.isReleasePleaseEnabled =
|
|
115
110
|
this.options.enableReleasePlease &&
|
|
116
111
|
!this.options.enableYarnVersion &&
|
|
117
|
-
!pkg.devDependencies?.[
|
|
112
|
+
!pkg.devDependencies?.["standard-version"];
|
|
118
113
|
|
|
119
114
|
if (
|
|
120
115
|
this.options.enableReleasePlease &&
|
|
@@ -123,9 +118,9 @@ export default class CoreCIGenerator extends Generator {
|
|
|
123
118
|
!this.options.enableYarnVersion
|
|
124
119
|
) {
|
|
125
120
|
const { enableReleasePlease } = await this.prompt({
|
|
126
|
-
type:
|
|
127
|
-
name:
|
|
128
|
-
message:
|
|
121
|
+
type: "confirm",
|
|
122
|
+
name: "enableReleasePlease",
|
|
123
|
+
message: "Would you like to enable release please ?",
|
|
129
124
|
default: true,
|
|
130
125
|
});
|
|
131
126
|
this.isReleasePleaseEnabled = enableReleasePlease;
|
|
@@ -133,12 +128,12 @@ export default class CoreCIGenerator extends Generator {
|
|
|
133
128
|
}
|
|
134
129
|
|
|
135
130
|
default() {
|
|
136
|
-
if (fs.existsSync(this.destinationPath(
|
|
137
|
-
fs.rmdirSync(this.destinationPath(
|
|
131
|
+
if (fs.existsSync(this.destinationPath(".circleci"))) {
|
|
132
|
+
fs.rmdirSync(this.destinationPath(".circleci"), { recursive: true });
|
|
138
133
|
}
|
|
139
134
|
|
|
140
135
|
if (this.options.enable) {
|
|
141
|
-
const pkg = this.fs.readJSON(this.destinationPath(
|
|
136
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
142
137
|
|
|
143
138
|
const checks = !!pkg.scripts && !!pkg.scripts.checks;
|
|
144
139
|
const testing =
|
|
@@ -149,16 +144,16 @@ export default class CoreCIGenerator extends Generator {
|
|
|
149
144
|
this.fs,
|
|
150
145
|
this.templatePath(
|
|
151
146
|
this.options.splitJobs
|
|
152
|
-
?
|
|
153
|
-
:
|
|
147
|
+
? "github-action-push-workflow-split.yml.ejs"
|
|
148
|
+
: "github-action-push-workflow.yml.ejs",
|
|
154
149
|
),
|
|
155
|
-
this.destinationPath(
|
|
150
|
+
this.destinationPath(".github/workflows/push.yml"),
|
|
156
151
|
{
|
|
157
152
|
packageManager: this.options.packageManager,
|
|
158
153
|
disableYarnGitCache: this.options.disableYarnGitCache,
|
|
159
154
|
testing,
|
|
160
155
|
e2eTesting:
|
|
161
|
-
this.options.e2eTesting && this.options.e2eTesting !==
|
|
156
|
+
this.options.e2eTesting && this.options.e2eTesting !== "false"
|
|
162
157
|
? this.options.e2eTesting
|
|
163
158
|
: false,
|
|
164
159
|
checks,
|
|
@@ -173,39 +168,39 @@ export default class CoreCIGenerator extends Generator {
|
|
|
173
168
|
this.isReleasePleaseEnabled &&
|
|
174
169
|
inMonorepo &&
|
|
175
170
|
inMonorepo.root &&
|
|
176
|
-
inMonorepo.pobConfig?.project?.type ===
|
|
171
|
+
inMonorepo.pobConfig?.project?.type === "lib",
|
|
177
172
|
},
|
|
178
173
|
);
|
|
179
174
|
|
|
180
175
|
ciContexts.push(
|
|
181
|
-
|
|
176
|
+
"reviewflow",
|
|
182
177
|
...(this.options.splitJobs
|
|
183
178
|
? [
|
|
184
|
-
checks &&
|
|
185
|
-
build &&
|
|
186
|
-
|
|
187
|
-
testing && !this.options.onlyLatestLTS &&
|
|
188
|
-
testing &&
|
|
179
|
+
checks && "checks",
|
|
180
|
+
build && "build",
|
|
181
|
+
"lint",
|
|
182
|
+
testing && !this.options.onlyLatestLTS && "test (18)",
|
|
183
|
+
testing && "test (20)",
|
|
189
184
|
].filter(Boolean)
|
|
190
185
|
: [
|
|
191
|
-
!this.options.onlyLatestLTS &&
|
|
192
|
-
|
|
186
|
+
!this.options.onlyLatestLTS && "build (18.x)",
|
|
187
|
+
"build (20.x)",
|
|
193
188
|
].filter(Boolean)),
|
|
194
189
|
);
|
|
195
190
|
} else {
|
|
196
|
-
this.fs.delete(this.destinationPath(
|
|
191
|
+
this.fs.delete(this.destinationPath(".github/workflows/push.yml"));
|
|
197
192
|
}
|
|
198
193
|
|
|
199
194
|
if (
|
|
200
195
|
this.options.enable &&
|
|
201
196
|
!this.options.isApp &&
|
|
202
197
|
(this.options.documentation ||
|
|
203
|
-
(this.options.testing && this.options.testing.runner !==
|
|
198
|
+
(this.options.testing && this.options.testing.runner !== "node"))
|
|
204
199
|
) {
|
|
205
200
|
copyAndFormatTpl(
|
|
206
201
|
this.fs,
|
|
207
|
-
this.templatePath(
|
|
208
|
-
this.destinationPath(
|
|
202
|
+
this.templatePath("github-action-documentation-workflow.yml.ejs"),
|
|
203
|
+
this.destinationPath(".github/workflows/gh-pages.yml"),
|
|
209
204
|
{
|
|
210
205
|
packageManager: this.options.packageManager,
|
|
211
206
|
disableYarnGitCache: this.options.disableYarnGitCache,
|
|
@@ -215,22 +210,22 @@ export default class CoreCIGenerator extends Generator {
|
|
|
215
210
|
},
|
|
216
211
|
);
|
|
217
212
|
} else {
|
|
218
|
-
this.fs.delete(this.destinationPath(
|
|
213
|
+
this.fs.delete(this.destinationPath(".github/workflows/gh-pages.yml"));
|
|
219
214
|
}
|
|
220
215
|
}
|
|
221
216
|
|
|
222
217
|
writing() {
|
|
223
|
-
const pkg = this.fs.readJSON(this.destinationPath(
|
|
218
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
224
219
|
|
|
225
|
-
this.fs.delete(this.destinationPath(
|
|
226
|
-
this.fs.delete(this.destinationPath(
|
|
220
|
+
this.fs.delete(this.destinationPath(".travis.yml"));
|
|
221
|
+
this.fs.delete(this.destinationPath("circle.yml"));
|
|
227
222
|
|
|
228
223
|
if (!this.options.enable) {
|
|
229
|
-
packageUtils.removeDevDependencies(pkg, [
|
|
224
|
+
packageUtils.removeDevDependencies(pkg, ["jest-junit-reporter"]);
|
|
230
225
|
} else {
|
|
231
|
-
packageUtils.removeDevDependencies(pkg, [
|
|
226
|
+
packageUtils.removeDevDependencies(pkg, ["jest-junit-reporter"]);
|
|
232
227
|
}
|
|
233
228
|
|
|
234
|
-
this.fs.writeJSON(this.destinationPath(
|
|
229
|
+
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
235
230
|
}
|
|
236
231
|
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import Generator from
|
|
1
|
+
import Generator from "yeoman-generator";
|
|
2
2
|
|
|
3
3
|
export default class CoreCleanGenerator extends Generator {
|
|
4
4
|
constructor(args, opts) {
|
|
5
5
|
super(args, opts);
|
|
6
6
|
|
|
7
|
-
this.option(
|
|
7
|
+
this.option("root", {
|
|
8
8
|
type: Boolean,
|
|
9
9
|
required: false,
|
|
10
10
|
default: true,
|
|
11
|
-
|
|
11
|
+
description: "Root package.",
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
writing() {
|
|
16
16
|
if (!this.options.root) {
|
|
17
|
-
this.fs.delete(
|
|
17
|
+
this.fs.delete(".idea");
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import Generator from
|
|
1
|
+
import Generator from "yeoman-generator";
|
|
2
2
|
|
|
3
3
|
export default class CoreEditorConfigGenerator extends Generator {
|
|
4
4
|
writing() {
|
|
5
5
|
this.fs.copy(
|
|
6
|
-
this.templatePath(
|
|
7
|
-
this.destinationPath(
|
|
6
|
+
this.templatePath("editorconfig"),
|
|
7
|
+
this.destinationPath(".editorconfig"),
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
}
|