pob 23.0.1 → 23.2.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 +31 -0
- package/lib/generators/app/PobAppGenerator.js +11 -2
- package/lib/generators/common/babel/CommonBabelGenerator.js +17 -7
- package/lib/generators/common/format-lint/CommonLintGenerator.js +10 -3
- package/lib/generators/common/testing/CommonTestingGenerator.js +20 -29
- package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +11 -6
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +10 -1
- package/lib/generators/common/typescript/templates/{tsconfig.js.json.ejs → tsconfig.check-js.json.ejs} +1 -1
- package/lib/generators/core/ci/templates/github-action-documentation-workflow.yml.ejs +8 -2
- package/lib/generators/core/ci/templates/github-action-push-workflow-split.yml.ejs +4 -1
- package/lib/generators/core/ci/templates/github-action-push-workflow.yml.ejs +1 -1
- package/lib/generators/lib/PobLibGenerator.js +18 -4
- package/lib/generators/monorepo/PobMonorepoGenerator.js +3 -1
- package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +14 -4
- package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +10 -8
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,37 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [23.2.0](https://github.com/christophehurpeau/pob/compare/pob@23.1.0...pob@23.2.0) (2024-08-15)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* codecov fail_ci_if_error: true ([0dc2f0d](https://github.com/christophehurpeau/pob/commit/0dc2f0d6f87e1871c65fa36be7a33df2c9bf3dae))
|
|
11
|
+
* fail ci if codecov token is missing ([40725d6](https://github.com/christophehurpeau/pob/commit/40725d6dd9c82cfe666006b8d21f641617ca8d59))
|
|
12
|
+
* typescript check-only ([688fe59](https://github.com/christophehurpeau/pob/commit/688fe59d8a857e8b94a7af78349f909f7ed4d6e7))
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* disable ts test util config when no ts is used ([d5cf807](https://github.com/christophehurpeau/pob/commit/d5cf807fb7604cf1e0d4355ebe069323156ce0ef))
|
|
17
|
+
* fix coverage config ([3621c92](https://github.com/christophehurpeau/pob/commit/3621c9246d44219c6d64f34079b254074181d782))
|
|
18
|
+
|
|
19
|
+
Version bump for dependency: @pob/root
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [23.1.0](https://github.com/christophehurpeau/pob/compare/pob@23.0.1...pob@23.1.0) (2024-08-14)
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
|
|
26
|
+
* support commonjs eslint config ([d69b1c0](https://github.com/christophehurpeau/pob/commit/d69b1c09e397a576b19ab4e25784a90f855b87b2))
|
|
27
|
+
* update eslint 9 ([7542a8c](https://github.com/christophehurpeau/pob/commit/7542a8c009f65fbde196139e7e9e88ec2790e9f5))
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* eslint command for flat config ([0250f19](https://github.com/christophehurpeau/pob/commit/0250f19c252f47ba2523a98e8d1e20400743dc0c))
|
|
32
|
+
|
|
33
|
+
Version bump for dependency: yarn-workspace-utils
|
|
34
|
+
Version bump for dependency: @pob/root
|
|
35
|
+
|
|
36
|
+
|
|
6
37
|
## [23.0.1](https://github.com/christophehurpeau/pob/compare/pob@23.0.0...pob@23.0.1) (2024-08-12)
|
|
7
38
|
|
|
8
39
|
### Bug Fixes
|
|
@@ -196,7 +196,15 @@ export default class PobAppGenerator extends Generator {
|
|
|
196
196
|
).filter(Boolean);
|
|
197
197
|
|
|
198
198
|
this.composeWith("pob:common:typescript", {
|
|
199
|
-
enable:
|
|
199
|
+
enable:
|
|
200
|
+
typescript ||
|
|
201
|
+
pkg.pob?.typescript === "check-only" ||
|
|
202
|
+
(inMonorepo &&
|
|
203
|
+
inMonorepo.pobMonorepoConfig?.typescript === "check-only"),
|
|
204
|
+
onlyCheck:
|
|
205
|
+
pkg.pob?.typescript === "check-only" ||
|
|
206
|
+
(inMonorepo &&
|
|
207
|
+
inMonorepo.pobMonorepoConfig?.typescript === "check-only"),
|
|
200
208
|
isApp: true,
|
|
201
209
|
isAppLibrary,
|
|
202
210
|
nextConfig: this.appConfig.type === "next.js",
|
|
@@ -258,7 +266,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
258
266
|
: undefined,
|
|
259
267
|
e2eTesting: this.appConfig.e2e ? "." : "",
|
|
260
268
|
typescript,
|
|
261
|
-
build: typescript && this.appConfig.type !== "expo",
|
|
269
|
+
build: typescript === true && this.appConfig.type !== "expo",
|
|
262
270
|
documentation: false,
|
|
263
271
|
codecov: this.appConfig.codecov,
|
|
264
272
|
ci: this.appConfig.ci,
|
|
@@ -280,6 +288,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
280
288
|
testRunner: this.appConfig.testRunner,
|
|
281
289
|
babel,
|
|
282
290
|
typescript,
|
|
291
|
+
build: typescript === true,
|
|
283
292
|
node,
|
|
284
293
|
browser,
|
|
285
294
|
// nextjs now supports src rootAsSrc: this.appConfig.type === 'next.js',
|
|
@@ -65,7 +65,9 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
65
65
|
if (
|
|
66
66
|
pkg.pob &&
|
|
67
67
|
(pkg.pob.babelEnvs ||
|
|
68
|
-
(pkg.pob.envs &&
|
|
68
|
+
(pkg.pob.envs &&
|
|
69
|
+
((!pkg.pob.bundler && pkg.pob.typescript !== true) ||
|
|
70
|
+
pkg.pob.bundler === "rollup-babel")))
|
|
69
71
|
) {
|
|
70
72
|
let babelEnvs = pkg.pob.babelEnvs || pkg.pob.envs;
|
|
71
73
|
if (
|
|
@@ -108,7 +110,10 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
108
110
|
|
|
109
111
|
const babelEnvs =
|
|
110
112
|
pkg.pob.babelEnvs ||
|
|
111
|
-
(pkg.pob.bundler
|
|
113
|
+
((!pkg.pob.bundler && pkg.pob.typescript !== true) ||
|
|
114
|
+
pkg.pob.bundler === "rollup-babel"
|
|
115
|
+
? pkg.pob.envs
|
|
116
|
+
: []) ||
|
|
112
117
|
[];
|
|
113
118
|
|
|
114
119
|
const targets = [
|
|
@@ -248,10 +253,13 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
248
253
|
];
|
|
249
254
|
|
|
250
255
|
if (newBabelEnvs.length === 0) {
|
|
251
|
-
if (
|
|
252
|
-
|
|
256
|
+
if (
|
|
257
|
+
(!pkg.pob.bundler && pkg.pob.typescript !== true) ||
|
|
258
|
+
pkg.pob.bundler === "rollup-babel"
|
|
259
|
+
) {
|
|
253
260
|
delete pkg.pob.babelEnvs;
|
|
254
|
-
if (
|
|
261
|
+
if (pkg.pob.typescript !== true) {
|
|
262
|
+
delete pkg.pob.envs;
|
|
255
263
|
delete pkg.pob.entries;
|
|
256
264
|
delete pkg.pob.jsx;
|
|
257
265
|
}
|
|
@@ -275,7 +283,9 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
275
283
|
this.entries = pkg.pob.entries;
|
|
276
284
|
this.babelEnvs =
|
|
277
285
|
pkg.pob.babelEnvs ||
|
|
278
|
-
(pkg.pob.bundler
|
|
286
|
+
(((!pkg.pob.bundler && pkg.pob.typescript !== true) ||
|
|
287
|
+
pkg.pob.bundler === "rollup-babel") &&
|
|
288
|
+
pkg.pob.envs) ||
|
|
279
289
|
[];
|
|
280
290
|
|
|
281
291
|
if (this.entries) {
|
|
@@ -428,7 +438,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
428
438
|
},
|
|
429
439
|
);
|
|
430
440
|
}
|
|
431
|
-
} else if (
|
|
441
|
+
} else if (pkg.pob.typescript !== true && pkg.pob.rollup !== false) {
|
|
432
442
|
this.fs.delete("rollup.config.mjs");
|
|
433
443
|
}
|
|
434
444
|
|
|
@@ -382,8 +382,8 @@ export default class CommonLintGenerator extends Generator {
|
|
|
382
382
|
if (!useTypescript) {
|
|
383
383
|
return [
|
|
384
384
|
useNode
|
|
385
|
-
?
|
|
386
|
-
:
|
|
385
|
+
? `...pobConfig(import.meta.url).configs.node${pkg.type === "commonjs" ? "Commonjs" : "Module"}`
|
|
386
|
+
: `...pobConfig(import.meta.url).configs.base${pkg.type === "commonjs" ? "Commonjs" : "Module"}`,
|
|
387
387
|
];
|
|
388
388
|
}
|
|
389
389
|
if (!hasReact) {
|
|
@@ -428,7 +428,14 @@ export default class CommonLintGenerator extends Generator {
|
|
|
428
428
|
if (rootLegacyEslintrcPath) this.fs.delete(rootLegacyEslintrcPath);
|
|
429
429
|
this.fs.delete(srcLegacyEslintrcPath);
|
|
430
430
|
|
|
431
|
-
const eslintConfigPath = this.destinationPath(
|
|
431
|
+
const eslintConfigPath = this.destinationPath(
|
|
432
|
+
pkg.type === "commonjs" ? "eslint.config.mjs" : "eslint.config.js",
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
const invalidEslintConfigPath = this.destinationPath(
|
|
436
|
+
pkg.type !== "commonjs" ? "eslint.config.mjs" : "eslint.config.js",
|
|
437
|
+
);
|
|
438
|
+
this.fs.delete(invalidEslintConfigPath);
|
|
432
439
|
|
|
433
440
|
if (!inMonorepo || inMonorepo.root) {
|
|
434
441
|
const getRootIgnorePatterns = () => {
|
|
@@ -172,9 +172,12 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
172
172
|
? false
|
|
173
173
|
: // eslint-disable-next-line unicorn/no-nested-ternary
|
|
174
174
|
this.options.monorepo
|
|
175
|
-
? yoConfigPobMonorepo.typescript
|
|
175
|
+
? yoConfigPobMonorepo.typescript &&
|
|
176
|
+
yoConfigPobMonorepo.typescript !== "check-only"
|
|
176
177
|
: packageUtils.transpileWithBabel(pkg);
|
|
177
|
-
const withTypescript =
|
|
178
|
+
const withTypescript =
|
|
179
|
+
transpileWithBabel ||
|
|
180
|
+
(pkg.pob?.typescript && pkg.pob.typescript !== "check-only");
|
|
178
181
|
let hasReact =
|
|
179
182
|
withTypescript &&
|
|
180
183
|
(this.options.monorepo
|
|
@@ -188,6 +191,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
188
191
|
|
|
189
192
|
const tsTestUtil = (() => {
|
|
190
193
|
if (testRunner === "vitest") return undefined;
|
|
194
|
+
if (!withTypescript) return undefined;
|
|
191
195
|
if (this.options.swc || isJestRunner) return "swc";
|
|
192
196
|
return "ts-node";
|
|
193
197
|
})();
|
|
@@ -279,7 +283,6 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
279
283
|
|
|
280
284
|
const createTestCommand = ({
|
|
281
285
|
coverage,
|
|
282
|
-
coverageLcov,
|
|
283
286
|
coverageJson,
|
|
284
287
|
watch,
|
|
285
288
|
shouldUseExperimentalVmModules,
|
|
@@ -293,14 +296,10 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
293
296
|
? "NODE_OPTIONS=--experimental-vm-modules "
|
|
294
297
|
: ""
|
|
295
298
|
}jest${watch ? " --watch" : ""}${
|
|
296
|
-
coverage || coverageJson
|
|
297
|
-
? ` --coverage ${
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
: `--coverageReporters=json${
|
|
301
|
-
coverageJson ? "" : " --coverageReporters=text"
|
|
302
|
-
}`
|
|
303
|
-
}`
|
|
299
|
+
coverage || coverageJson
|
|
300
|
+
? ` --coverage ${`--coverageReporters=json${
|
|
301
|
+
coverageJson ? "" : " --coverageReporters=text"
|
|
302
|
+
}`}`
|
|
304
303
|
: ""
|
|
305
304
|
}`;
|
|
306
305
|
}
|
|
@@ -308,33 +307,32 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
308
307
|
if (!workspacesPattern && this.options.monorepo) {
|
|
309
308
|
throw new Error("Invalid workspacesPattern");
|
|
310
309
|
}
|
|
310
|
+
const experimentalTestCoverage = false; // todo configure src directory and remove test files
|
|
311
311
|
return `${
|
|
312
312
|
tsTestUtil === "ts-node"
|
|
313
313
|
? "TS_NODE_PROJECT=tsconfig.test.json "
|
|
314
314
|
: ""
|
|
315
315
|
}${
|
|
316
|
-
coverage || coverageJson
|
|
316
|
+
coverage || coverageJson
|
|
317
317
|
? `npx c8${
|
|
318
|
-
|
|
318
|
+
coverageJson
|
|
319
319
|
? ` --reporter=${coverageJson ? "json" : "lcov"}`
|
|
320
320
|
: ""
|
|
321
|
-
} --src ./${this.options.srcDirectory} `
|
|
321
|
+
} --all --src ./${this.options.srcDirectory} `
|
|
322
322
|
: ""
|
|
323
323
|
}node ${
|
|
324
324
|
this.options.typescript ? `${tsTestLoaderOption} ` : ""
|
|
325
|
-
}--test ${this.options.monorepo ? `${workspacesPattern}/` : ""}${`${
|
|
325
|
+
}--test${experimentalTestCoverage && (coverage || coverageJson) ? " --experimental-test-coverage" : ""} ${this.options.monorepo ? `${workspacesPattern}/` : ""}${`${
|
|
326
326
|
hasTestFolder ? "test/*" : `${this.options.srcDirectory}/**/*.test`
|
|
327
327
|
}.${this.options.typescript ? "ts" : "js"}`}`;
|
|
328
328
|
}
|
|
329
329
|
case "vitest": {
|
|
330
330
|
return `${
|
|
331
|
-
coverage || coverageJson
|
|
332
|
-
? `POB_VITEST_COVERAGE=${
|
|
333
|
-
coverageLcov ? "lcov" : `json${coverageJson ? "" : ",text"} `
|
|
334
|
-
}`
|
|
331
|
+
coverage || coverageJson
|
|
332
|
+
? `POB_VITEST_COVERAGE=${`json${coverageJson ? "" : ",text"} `}`
|
|
335
333
|
: ""
|
|
336
334
|
}vitest${watch ? " --watch" : ""}${
|
|
337
|
-
coverage || coverageJson
|
|
335
|
+
coverage || coverageJson ? " run --coverage" : ""
|
|
338
336
|
}`;
|
|
339
337
|
}
|
|
340
338
|
default: {
|
|
@@ -413,6 +411,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
413
411
|
if (this.options.monorepo) {
|
|
414
412
|
const shouldUseExperimentalVmModules = pkg.type === "module";
|
|
415
413
|
|
|
414
|
+
packageUtils.removeScripts(["test:coverage:lcov"]);
|
|
416
415
|
packageUtils.addScripts(pkg, {
|
|
417
416
|
test: createTestCommand({
|
|
418
417
|
workspacesPattern,
|
|
@@ -428,11 +427,6 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
428
427
|
shouldUseExperimentalVmModules,
|
|
429
428
|
coverage: true,
|
|
430
429
|
}),
|
|
431
|
-
"test:coverage:lcov": createTestCommand({
|
|
432
|
-
workspacesPattern,
|
|
433
|
-
shouldUseExperimentalVmModules,
|
|
434
|
-
coverageLcov: true,
|
|
435
|
-
}),
|
|
436
430
|
"test:coverage:json": createTestCommand({
|
|
437
431
|
workspacesPattern,
|
|
438
432
|
shouldUseExperimentalVmModules,
|
|
@@ -526,6 +520,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
526
520
|
const shouldUseExperimentalVmModules =
|
|
527
521
|
pkg.type === "module" && !inMonorepo;
|
|
528
522
|
|
|
523
|
+
packageUtils.removeScripts(["test:coverage:lcov"]);
|
|
529
524
|
packageUtils.addScripts(pkg, {
|
|
530
525
|
test: createTestCommand({ shouldUseExperimentalVmModules }),
|
|
531
526
|
"test:watch": createTestCommand({
|
|
@@ -536,10 +531,6 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
536
531
|
shouldUseExperimentalVmModules,
|
|
537
532
|
coverage: true,
|
|
538
533
|
}),
|
|
539
|
-
"test:coverage:lcov": createTestCommand({
|
|
540
|
-
shouldUseExperimentalVmModules,
|
|
541
|
-
coverageLcov: true,
|
|
542
|
-
}),
|
|
543
534
|
"test:coverage:json": createTestCommand({
|
|
544
535
|
shouldUseExperimentalVmModules,
|
|
545
536
|
coverageJson: true,
|
|
@@ -120,7 +120,7 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
120
120
|
this.entries = pkg.pob.entries;
|
|
121
121
|
this.babelEnvs = pkg.pob.babelEnvs || [];
|
|
122
122
|
|
|
123
|
-
if (this.babelEnvs.length > 0 || pkg.pob.typescript) {
|
|
123
|
+
if (this.babelEnvs.length > 0 || pkg.pob.typescript === true) {
|
|
124
124
|
fs.mkdirSync(this.destinationPath("src"), { recursive: true });
|
|
125
125
|
} else {
|
|
126
126
|
// recursive does not throw if directory already exists
|
|
@@ -131,13 +131,17 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
131
131
|
default() {
|
|
132
132
|
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
133
133
|
const withBabel = this.babelEnvs && this.babelEnvs.length > 0;
|
|
134
|
-
const withTypescript =
|
|
134
|
+
const withTypescript =
|
|
135
|
+
pkg.pob.typescript === true || withBabel || !!pkg.pob.bundler;
|
|
135
136
|
const bundler =
|
|
136
137
|
withTypescript &&
|
|
137
|
-
(pkg.pob.rollup === false
|
|
138
|
+
(pkg.pob.rollup === false ||
|
|
139
|
+
(!pkg.pob.bundler && !pkg.pob.typescript === true)
|
|
138
140
|
? "tsc"
|
|
139
141
|
: (pkg.pob.bundler ??
|
|
140
|
-
(pkg.pob.typescript
|
|
142
|
+
(pkg.pob.typescript === true
|
|
143
|
+
? "rollup-typescript"
|
|
144
|
+
: "rollup-babel")));
|
|
141
145
|
this.bundler = bundler;
|
|
142
146
|
|
|
143
147
|
const cleanCommand = (() => {
|
|
@@ -572,9 +576,10 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
572
576
|
|
|
573
577
|
this.fs.delete("rollup.config.js");
|
|
574
578
|
if (
|
|
575
|
-
pkg.pob.typescript &&
|
|
579
|
+
pkg.pob.typescript === true &&
|
|
576
580
|
pkg.pob.rollup !== false &&
|
|
577
|
-
(!pkg.pob.bundler
|
|
581
|
+
((!pkg.pob.bundler && pkg.pob.typescript !== true) ||
|
|
582
|
+
pkg.pob.bundler?.startsWith("rollup"))
|
|
578
583
|
) {
|
|
579
584
|
if (this.options.isApp) {
|
|
580
585
|
copyAndFormatTpl(
|
|
@@ -107,6 +107,13 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
107
107
|
default: false,
|
|
108
108
|
description: "only latest lts",
|
|
109
109
|
});
|
|
110
|
+
|
|
111
|
+
this.option("onlyCheck", {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
required: false,
|
|
114
|
+
default: false,
|
|
115
|
+
description: "only check js",
|
|
116
|
+
});
|
|
110
117
|
}
|
|
111
118
|
|
|
112
119
|
writing() {
|
|
@@ -262,7 +269,9 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
262
269
|
*/
|
|
263
270
|
copyAndFormatTpl(
|
|
264
271
|
this.fs,
|
|
265
|
-
this.
|
|
272
|
+
this.options.onlyCheck
|
|
273
|
+
? this.templatePath("tsconfig.check-js.json.ejs")
|
|
274
|
+
: this.templatePath("tsconfig.json.ejs"),
|
|
266
275
|
tsconfigPath,
|
|
267
276
|
{
|
|
268
277
|
emitDefinitions: this.options.builddefs,
|
|
@@ -32,10 +32,16 @@ jobs:
|
|
|
32
32
|
run: yarn typedoc --tsconfig tsconfig.doc.json
|
|
33
33
|
<% } -%>
|
|
34
34
|
|
|
35
|
-
<% if (testing
|
|
35
|
+
<% if (testing) { -%>
|
|
36
|
+
<% if (testRunner === 'node') { -%>
|
|
36
37
|
|
|
37
38
|
- name: Generate Coverage
|
|
38
|
-
run: yarn test:coverage
|
|
39
|
+
run: NODE_V8_COVERAGE=./docs/coverage yarn test:coverage
|
|
40
|
+
<% } else {-%>
|
|
41
|
+
|
|
42
|
+
- name: Generate Coverage
|
|
43
|
+
run: yarn test:coverage:json<%- testRunner === 'jest' ? " --coverageDirectory=docs/coverage/" : "" %>
|
|
44
|
+
<% } -%>
|
|
39
45
|
<% } -%>
|
|
40
46
|
|
|
41
47
|
- name: Create nojekyll
|
|
@@ -118,13 +118,16 @@ jobs:
|
|
|
118
118
|
if: matrix.node-version != 18
|
|
119
119
|
|
|
120
120
|
- name: Generate Test Coverage
|
|
121
|
-
run: <%= packageManager %> run test:coverage
|
|
121
|
+
run: <%= packageManager %> run test:coverage:json
|
|
122
122
|
if: matrix.node-version == 18
|
|
123
|
+
env:
|
|
124
|
+
CI: true
|
|
123
125
|
|
|
124
126
|
- name: Send results to codecov
|
|
125
127
|
uses: codecov/codecov-action@v4
|
|
126
128
|
if: matrix.node-version == 18
|
|
127
129
|
with:
|
|
130
|
+
fail_ci_if_error: true
|
|
128
131
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
129
132
|
<% } else { -%>
|
|
130
133
|
|
|
@@ -65,11 +65,11 @@ jobs:
|
|
|
65
65
|
if: startsWith(matrix.node-version, '20.')
|
|
66
66
|
env:
|
|
67
67
|
CI: true
|
|
68
|
-
NODE_V8_COVERAGE: coverage/
|
|
69
68
|
|
|
70
69
|
- name: Send results to codecov
|
|
71
70
|
uses: codecov/codecov-action@v4
|
|
72
71
|
with:
|
|
72
|
+
fail_ci_if_error: true
|
|
73
73
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
74
74
|
if: startsWith(matrix.node-version, '20.')
|
|
75
75
|
<% } else if (testing) { -%>
|
|
@@ -260,7 +260,9 @@ export default class PobLibGenerator extends Generator {
|
|
|
260
260
|
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
261
261
|
const babelEnvs =
|
|
262
262
|
pkg.pob.babelEnvs ||
|
|
263
|
-
(pkg.pob.bundler
|
|
263
|
+
(((!pkg.pob.bundler && pkg.pob.typescript !== true) ||
|
|
264
|
+
pkg.pob.bundler === "rollup-babel") &&
|
|
265
|
+
pkg.pob.envs) ||
|
|
264
266
|
[];
|
|
265
267
|
|
|
266
268
|
const withBabel = babelEnvs.length > 0;
|
|
@@ -269,7 +271,15 @@ export default class PobLibGenerator extends Generator {
|
|
|
269
271
|
const browser = pkg.pob.envs?.some((env) => env.target === "browser");
|
|
270
272
|
|
|
271
273
|
this.composeWith("pob:common:typescript", {
|
|
272
|
-
enable:
|
|
274
|
+
enable:
|
|
275
|
+
withTypescript ||
|
|
276
|
+
pkg.pob.typescript === "check-only" ||
|
|
277
|
+
(inMonorepo &&
|
|
278
|
+
inMonorepo.pobMonorepoConfig.typescript === "check-only"),
|
|
279
|
+
onlyCheck:
|
|
280
|
+
pkg.pob.typescript === "check-only" ||
|
|
281
|
+
(inMonorepo &&
|
|
282
|
+
inMonorepo.pobMonorepoConfig.typescript === "check-only"),
|
|
273
283
|
isApp: false,
|
|
274
284
|
dom: browser,
|
|
275
285
|
jsx,
|
|
@@ -277,6 +287,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
277
287
|
baseUrl: "none", // causes issues on dist definition files
|
|
278
288
|
builddefs: true,
|
|
279
289
|
onlyLatestLTS: false,
|
|
290
|
+
srcDirectory: withTypescript ? "src" : "lib",
|
|
280
291
|
});
|
|
281
292
|
|
|
282
293
|
this.composeWith("pob:common:husky", {});
|
|
@@ -311,6 +322,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
311
322
|
// must be after testing
|
|
312
323
|
this.composeWith("pob:common:format-lint", {
|
|
313
324
|
typescript: withTypescript,
|
|
325
|
+
build: withTypescript,
|
|
314
326
|
documentation:
|
|
315
327
|
!!this.pobjson.documentation ||
|
|
316
328
|
!!(this.pobjson.testing && this.pobjson.testing.codecov),
|
|
@@ -387,9 +399,11 @@ export default class PobLibGenerator extends Generator {
|
|
|
387
399
|
}
|
|
388
400
|
|
|
389
401
|
const withBabel = Boolean(
|
|
390
|
-
pkg.pob.babelEnvs ||
|
|
402
|
+
pkg.pob.babelEnvs ||
|
|
403
|
+
(!pkg.pob.bundler && pkg.pob.typescript !== true && pkg.pob.envs) ||
|
|
404
|
+
pkg.pob.bundler === "rollup-babel",
|
|
391
405
|
);
|
|
392
|
-
const withTypescript = pkg.pob.typescript === true;
|
|
406
|
+
const withTypescript = withBabel || pkg.pob.typescript === true;
|
|
393
407
|
|
|
394
408
|
packageUtils.removeDevDependencies(pkg, ["lerna", "@pob/lerna-light"]);
|
|
395
409
|
if (inMonorepo) {
|
|
@@ -232,7 +232,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
232
232
|
enableYarnVersion: isYarnVersionEnabled,
|
|
233
233
|
testing: this.pobLernaConfig.testing,
|
|
234
234
|
e2eTesting: this.pobLernaConfig.e2eTesting,
|
|
235
|
-
build: this.pobLernaConfig.typescript,
|
|
235
|
+
build: this.pobLernaConfig.typescript === true,
|
|
236
236
|
typescript: this.pobLernaConfig.typescript,
|
|
237
237
|
documentation: !!this.pobLernaConfig.documentation,
|
|
238
238
|
codecov: this.pobLernaConfig.testing && this.pobLernaConfig.codecov,
|
|
@@ -247,6 +247,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
247
247
|
monorepo: true,
|
|
248
248
|
documentation: this.pobLernaConfig.documentation,
|
|
249
249
|
typescript: this.pobLernaConfig.typescript,
|
|
250
|
+
build: this.pobLernaConfig.typescript === true,
|
|
250
251
|
testing: this.pobLernaConfig.testing,
|
|
251
252
|
testRunner: this.pobLernaConfig.testRunner,
|
|
252
253
|
packageManager: this.options.packageManager,
|
|
@@ -304,6 +305,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
304
305
|
|
|
305
306
|
this.composeWith("pob:monorepo:typescript", {
|
|
306
307
|
enable: this.pobLernaConfig.typescript,
|
|
308
|
+
checkOnly: this.pobLernaConfig.typescript === "check-only",
|
|
307
309
|
isAppProject: this.options.isAppProject,
|
|
308
310
|
packageNames: JSON.stringify(packageNames),
|
|
309
311
|
packagePaths: JSON.stringify(packagePaths),
|
|
@@ -34,6 +34,12 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
34
34
|
required: false,
|
|
35
35
|
default: "jest",
|
|
36
36
|
});
|
|
37
|
+
|
|
38
|
+
this.option("checkOnly", {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
required: false,
|
|
41
|
+
default: false,
|
|
42
|
+
});
|
|
37
43
|
}
|
|
38
44
|
|
|
39
45
|
writing() {
|
|
@@ -60,13 +66,17 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
60
66
|
packageUtils.addScripts(pkg, {
|
|
61
67
|
tsc: "tsc -b",
|
|
62
68
|
});
|
|
63
|
-
packageUtils.addOrRemoveScripts(
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
packageUtils.addOrRemoveScripts(
|
|
70
|
+
pkg,
|
|
71
|
+
!this.options.isAppProject && !this.options.checkOnly,
|
|
72
|
+
{
|
|
73
|
+
"build:definitions": "tsc -b",
|
|
74
|
+
},
|
|
75
|
+
);
|
|
66
76
|
|
|
67
77
|
delete pkg.scripts.postbuild;
|
|
68
78
|
|
|
69
|
-
if (!this.options.isAppProject) {
|
|
79
|
+
if (!this.options.isAppProject && !this.options.checkOnly) {
|
|
70
80
|
pkg.scripts.build += " && yarn run build:definitions";
|
|
71
81
|
}
|
|
72
82
|
} else if (pkg.scripts) {
|
|
@@ -61,7 +61,7 @@ export default class MonorepoWorkspacesGenerator extends Generator {
|
|
|
61
61
|
babelEnvs: [],
|
|
62
62
|
...(config && config.pob),
|
|
63
63
|
});
|
|
64
|
-
const
|
|
64
|
+
const withBundler = this.packages.some((config) => {
|
|
65
65
|
const pobConfig = getPackagePobConfig(config);
|
|
66
66
|
return (
|
|
67
67
|
pobConfig.babelEnvs.length > 0 || pobConfig.bundler === "rollup-babel"
|
|
@@ -102,7 +102,7 @@ export default class MonorepoWorkspacesGenerator extends Generator {
|
|
|
102
102
|
this.packagesConfig.length > 15
|
|
103
103
|
? "NODE_OPTIONS=--max_old_space_size=4096 "
|
|
104
104
|
: ""
|
|
105
|
-
}eslint --
|
|
105
|
+
}eslint --quiet .`
|
|
106
106
|
: // eslint-disable-next-line unicorn/no-nested-ternary
|
|
107
107
|
this.options.packageManager === "yarn"
|
|
108
108
|
? `NODE_OPTIONS=--max_old_space_size=4096 eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet . --ignore-pattern ${pkg.workspaces.join(
|
|
@@ -120,12 +120,14 @@ export default class MonorepoWorkspacesGenerator extends Generator {
|
|
|
120
120
|
},
|
|
121
121
|
);
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
123
|
+
if (this.options.isAppProject) {
|
|
124
|
+
packageUtils.addOrRemoveScripts(pkg, withBundler, {
|
|
125
|
+
build:
|
|
126
|
+
"yarn workspaces foreach --parallel --topological-dev -Av run build",
|
|
127
|
+
watch:
|
|
128
|
+
'yarn workspaces foreach --parallel --jobs unlimited --interlaced --exclude "*-example" -Av run watch',
|
|
129
|
+
});
|
|
130
|
+
}
|
|
129
131
|
|
|
130
132
|
// packageUtils.addOrRemoveScripts(pkg, withTypescript, {
|
|
131
133
|
// 'build:definitions': `${
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "23.0
|
|
3
|
+
"version": "23.2.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -41,9 +41,9 @@
|
|
|
41
41
|
},
|
|
42
42
|
"prettier": "@pob/root/prettier-config",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@pob/eslint-config": "
|
|
45
|
-
"@pob/eslint-config-typescript": "
|
|
46
|
-
"@pob/eslint-config-typescript-react": "
|
|
44
|
+
"@pob/eslint-config": "58.0.0",
|
|
45
|
+
"@pob/eslint-config-typescript": "58.0.0",
|
|
46
|
+
"@pob/eslint-config-typescript-react": "58.0.0",
|
|
47
47
|
"@pob/sort-eslint-config": "6.0.0",
|
|
48
48
|
"@pob/sort-object": "7.0.0",
|
|
49
49
|
"@pob/sort-pkg": "8.0.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@yarnpkg/core": "4.1.2",
|
|
54
54
|
"@yarnpkg/fslib": "3.1.0",
|
|
55
55
|
"@yeoman/types": "1.2.0",
|
|
56
|
-
"eslint": "
|
|
56
|
+
"eslint": "9.9.0",
|
|
57
57
|
"findup-sync": "^5.0.0",
|
|
58
58
|
"git-remote-url": "^1.0.1",
|
|
59
59
|
"github-username": "^7.0.0",
|
|
@@ -65,16 +65,16 @@
|
|
|
65
65
|
"mem-fs-editor": "11.0.1",
|
|
66
66
|
"minimist": "1.2.8",
|
|
67
67
|
"parse-author": "2.0.0",
|
|
68
|
-
"pob-dependencies": "14.0
|
|
68
|
+
"pob-dependencies": "14.1.0",
|
|
69
69
|
"prettier": "3.3.3",
|
|
70
70
|
"semver": "7.6.3",
|
|
71
71
|
"validate-npm-package-name": "^5.0.0",
|
|
72
|
-
"yarn-workspace-utils": "6.0.
|
|
72
|
+
"yarn-workspace-utils": "6.0.2",
|
|
73
73
|
"yeoman-environment": "4.4.1",
|
|
74
74
|
"yeoman-generator": "7.3.2"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@pob/root": "13.
|
|
77
|
+
"@pob/root": "13.2.0",
|
|
78
78
|
"@types/node": "20.14.15",
|
|
79
79
|
"typescript": "5.5.4"
|
|
80
80
|
}
|