pob 34.2.0 → 35.1.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 +47 -0
- package/lib/generators/app/PobAppGenerator.js +90 -87
- package/lib/generators/app/e2e-testing/AppE2ETestingGenerator.js +5 -1
- package/lib/generators/app/ignorePaths.js +1 -2
- package/lib/generators/common/babel/CommonBabelGenerator.js +3 -3
- package/lib/generators/common/format-lint/CommonLintGenerator.js +21 -18
- package/lib/generators/common/format-lint/templates/{prettierignore.ejs → oxfmtrc.jsonc.ejs} +15 -8
- package/lib/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js +6 -1
- package/lib/generators/common/testing/CommonTestingGenerator.js +40 -168
- package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +3 -3
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +24 -10
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +6 -5
- package/lib/generators/core/bun/templates/bunfig.toml.ejs +1 -1
- package/lib/generators/core/ci/CoreCIGenerator.js +4 -12
- package/lib/generators/core/ci/templates/github-action-push-workflow-split.yml.ejs +3 -3
- package/lib/generators/core/ci/templates/github-action-push-workflow.yml.ejs +3 -3
- package/lib/generators/core/package/CorePackageGenerator.js +2 -6
- package/lib/generators/core/renovate/CoreRenovateGenerator.js +1 -1
- package/lib/generators/core/sort-package/CoreSortPackageGenerator.js +1 -1
- package/lib/generators/core/vscode/CoreVSCodeGenerator.js +4 -4
- package/lib/generators/core/vscode/templates/settings.json.ejs +1 -1
- package/lib/generators/core/yarn/CoreYarnGenerator.js +8 -8
- package/lib/generators/lib/PobLibGenerator.js +2 -7
- package/lib/generators/lib/doc/LibDocGenerator.js +6 -4
- package/lib/generators/lib/readme/LibReadmeGenerator.js +2 -2
- package/lib/generators/monorepo/PobMonorepoGenerator.js +2 -2
- package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +1 -1
- package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +4 -5
- package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +15 -10
- package/lib/generators/pob/PobBaseGenerator.js +4 -4
- package/lib/utils/ensureJsonFileFormatted.js +7 -11
- package/lib/utils/writeAndFormat.js +16 -31
- package/package.json +29 -31
- package/lib/generators/common/testing/templates/.eslintrc.json +0 -8
|
@@ -107,23 +107,11 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
prompting() {
|
|
111
111
|
if (this.options.enable && this.options.runner === "jest") {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
name: "confirm",
|
|
116
|
-
message:
|
|
117
|
-
"jest will soon be deprecated. Are you sure you want to continue using jest?",
|
|
118
|
-
default: false,
|
|
119
|
-
},
|
|
120
|
-
]);
|
|
121
|
-
|
|
122
|
-
if (!confirm) {
|
|
123
|
-
throw new Error(
|
|
124
|
-
"Jest is deprecated. Please consider using an alternative test runner.",
|
|
125
|
-
);
|
|
126
|
-
}
|
|
112
|
+
throw new Error(
|
|
113
|
+
"Jest is deprecated. Please consider using an alternative test runner.",
|
|
114
|
+
);
|
|
127
115
|
}
|
|
128
116
|
}
|
|
129
117
|
|
|
@@ -151,7 +139,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
151
139
|
}
|
|
152
140
|
}
|
|
153
141
|
|
|
154
|
-
writing() {
|
|
142
|
+
async writing() {
|
|
155
143
|
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
156
144
|
|
|
157
145
|
packageUtils.removeDevDependencies(pkg, [
|
|
@@ -180,22 +168,20 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
180
168
|
transpileWithBabel ||
|
|
181
169
|
pkg.pob?.bundler === "tsc" ||
|
|
182
170
|
(pkg.pob?.typescript && pkg.pob.typescript !== "check-only");
|
|
183
|
-
|
|
171
|
+
const hasReact =
|
|
184
172
|
withTypescript &&
|
|
185
173
|
(this.options.monorepo
|
|
186
174
|
? (yoConfigPobMonorepo.react ?? packageUtils.hasReact(pkg))
|
|
187
175
|
: packageUtils.hasReact(pkg));
|
|
188
176
|
const testRunner = globalTesting
|
|
189
|
-
? inMonorepo.pobConfig.monorepo.testRunner
|
|
177
|
+
? inMonorepo.pobConfig.monorepo.testRunner
|
|
190
178
|
: this.options.runner;
|
|
191
179
|
|
|
192
|
-
const isJestRunner = testRunner === "jest";
|
|
193
|
-
|
|
194
180
|
const tsTestUtil = (() => {
|
|
195
181
|
if (testRunner === "vitest") return undefined;
|
|
196
182
|
if (!withTypescript) return undefined;
|
|
197
|
-
if (
|
|
198
|
-
throw new Error("
|
|
183
|
+
if (testRunner === "jest") {
|
|
184
|
+
throw new Error("jest is no longer supported. Migrate to vitest.");
|
|
199
185
|
}
|
|
200
186
|
return "node";
|
|
201
187
|
})();
|
|
@@ -203,14 +189,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
203
189
|
const dependenciesForTestUtil = {};
|
|
204
190
|
|
|
205
191
|
Object.entries(dependenciesForTestUtil).forEach(
|
|
206
|
-
([
|
|
207
|
-
key,
|
|
208
|
-
{
|
|
209
|
-
devDependenciesShared,
|
|
210
|
-
devDependenciesWithJest,
|
|
211
|
-
devDependenciesWithNode,
|
|
212
|
-
},
|
|
213
|
-
]) => {
|
|
192
|
+
([key, { devDependenciesShared, devDependenciesWithNode }]) => {
|
|
214
193
|
const sharedCondition =
|
|
215
194
|
this.options.enable &&
|
|
216
195
|
(!inMonorepo || inMonorepo.root) &&
|
|
@@ -222,16 +201,6 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
222
201
|
(testRunner === "node" || (withTypescript && !transpileWithBabel)),
|
|
223
202
|
devDependenciesShared,
|
|
224
203
|
);
|
|
225
|
-
if (devDependenciesWithJest) {
|
|
226
|
-
packageUtils.addOrRemoveDevDependencies(
|
|
227
|
-
pkg,
|
|
228
|
-
sharedCondition &&
|
|
229
|
-
withTypescript &&
|
|
230
|
-
!transpileWithBabel &&
|
|
231
|
-
testRunner === "jest",
|
|
232
|
-
devDependenciesWithJest,
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
204
|
if (devDependenciesWithNode) {
|
|
236
205
|
packageUtils.addOrRemoveDevDependencies(
|
|
237
206
|
pkg,
|
|
@@ -245,11 +214,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
245
214
|
},
|
|
246
215
|
);
|
|
247
216
|
|
|
248
|
-
if (
|
|
249
|
-
!this.options.enable ||
|
|
250
|
-
!isJestRunner ||
|
|
251
|
-
(globalTesting && !enableForMonorepo)
|
|
252
|
-
) {
|
|
217
|
+
if (!this.options.enable || (globalTesting && !enableForMonorepo)) {
|
|
253
218
|
packageUtils.removeDevDependencies(pkg, [
|
|
254
219
|
"jest",
|
|
255
220
|
"@types/jest",
|
|
@@ -279,24 +244,11 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
279
244
|
coverage,
|
|
280
245
|
coverageJson,
|
|
281
246
|
watch,
|
|
282
|
-
|
|
247
|
+
|
|
283
248
|
workspacesPattern,
|
|
284
249
|
hasReact,
|
|
285
250
|
}) => {
|
|
286
251
|
switch (testRunner) {
|
|
287
|
-
case "jest": {
|
|
288
|
-
return `TZ=UTC ${
|
|
289
|
-
shouldUseExperimentalVmModules
|
|
290
|
-
? "NODE_OPTIONS=--experimental-vm-modules "
|
|
291
|
-
: ""
|
|
292
|
-
}jest${watch ? " --watch" : ""}${
|
|
293
|
-
coverage || coverageJson
|
|
294
|
-
? ` --coverage ${`--coverageReporters=json${
|
|
295
|
-
coverageJson ? "" : " --coverageReporters=text"
|
|
296
|
-
}`}`
|
|
297
|
-
: ""
|
|
298
|
-
}`;
|
|
299
|
-
}
|
|
300
252
|
case "node": {
|
|
301
253
|
if (this.options.packageManager === "bun") {
|
|
302
254
|
throw new Error(
|
|
@@ -341,9 +293,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
341
293
|
coverage || coverageJson
|
|
342
294
|
? `POB_VITEST_COVERAGE=${`json${coverageJson ? "" : ",text"} `}`
|
|
343
295
|
: ""
|
|
344
|
-
}vitest${watch ? " --watch" : ""}${
|
|
345
|
-
coverage || coverageJson ? " run --coverage" : ""
|
|
346
|
-
}`;
|
|
296
|
+
}vitest${watch ? " --watch" : ""}${coverage || coverageJson ? " run --coverage" : ""}`;
|
|
347
297
|
}
|
|
348
298
|
default: {
|
|
349
299
|
throw new Error(`Invalid runner: "${testRunner}"`);
|
|
@@ -353,21 +303,18 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
353
303
|
|
|
354
304
|
const jestConfigPath = this.destinationPath("jest.config.json");
|
|
355
305
|
const vitestConfigPath = this.destinationPath("vite.config.js");
|
|
356
|
-
packageUtils.addOrRemoveDevDependencies(
|
|
357
|
-
pkg,
|
|
358
|
-
this.options.enable &&
|
|
359
|
-
(enableForMonorepo || !globalTesting) &&
|
|
360
|
-
testRunner === "jest",
|
|
361
|
-
["jest", "@types/jest"],
|
|
362
|
-
);
|
|
363
306
|
|
|
364
|
-
|
|
365
|
-
pkg,
|
|
307
|
+
const isVitestUsed =
|
|
366
308
|
this.options.enable &&
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
309
|
+
(enableForMonorepo || !globalTesting) &&
|
|
310
|
+
testRunner === "vitest";
|
|
311
|
+
packageUtils.addOrRemoveDevDependencies(pkg, isVitestUsed, [
|
|
312
|
+
"vitest",
|
|
313
|
+
"@vitest/coverage-v8",
|
|
314
|
+
]);
|
|
315
|
+
if (isVitestUsed) {
|
|
316
|
+
packageUtils.addDependencies(pkg, ["vite"]);
|
|
317
|
+
}
|
|
371
318
|
|
|
372
319
|
if (!this.options.enable) {
|
|
373
320
|
// if (inMonorepo) {
|
|
@@ -386,7 +333,11 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
386
333
|
"test:coverage:lcov",
|
|
387
334
|
]);
|
|
388
335
|
|
|
389
|
-
writeAndFormatJson(
|
|
336
|
+
await writeAndFormatJson(
|
|
337
|
+
this.fs,
|
|
338
|
+
this.destinationPath("package.json"),
|
|
339
|
+
pkg,
|
|
340
|
+
);
|
|
390
341
|
} else {
|
|
391
342
|
let workspacesPattern;
|
|
392
343
|
if (this.options.monorepo) {
|
|
@@ -408,7 +359,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
408
359
|
});
|
|
409
360
|
} else {
|
|
410
361
|
if (this.testRunner === "vitest") {
|
|
411
|
-
copyAndFormatTpl(
|
|
362
|
+
await copyAndFormatTpl(
|
|
412
363
|
this.fs,
|
|
413
364
|
this.templatePath("vite.config.js.ejs"),
|
|
414
365
|
vitestConfigPath,
|
|
@@ -419,64 +370,24 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
419
370
|
}
|
|
420
371
|
|
|
421
372
|
if (this.options.monorepo) {
|
|
422
|
-
const shouldUseExperimentalVmModules = pkg.type === "module";
|
|
423
|
-
|
|
424
373
|
packageUtils.removeScripts(pkg, ["test:coverage:lcov"]);
|
|
425
374
|
packageUtils.addScripts(pkg, {
|
|
426
375
|
test: createTestCommand({
|
|
427
376
|
workspacesPattern,
|
|
428
|
-
shouldUseExperimentalVmModules,
|
|
429
377
|
}),
|
|
430
378
|
"test:watch": createTestCommand({
|
|
431
379
|
workspacesPattern,
|
|
432
|
-
shouldUseExperimentalVmModules,
|
|
433
380
|
watch: true,
|
|
434
381
|
}),
|
|
435
382
|
"test:coverage": createTestCommand({
|
|
436
383
|
workspacesPattern,
|
|
437
|
-
shouldUseExperimentalVmModules,
|
|
438
384
|
coverage: true,
|
|
439
385
|
}),
|
|
440
386
|
"test:coverage:json": createTestCommand({
|
|
441
387
|
workspacesPattern,
|
|
442
|
-
shouldUseExperimentalVmModules,
|
|
443
388
|
coverageJson: true,
|
|
444
389
|
}),
|
|
445
390
|
});
|
|
446
|
-
|
|
447
|
-
if (isJestRunner) {
|
|
448
|
-
hasReact = yoConfigPobMonorepo.packageNames.some((pkgName) =>
|
|
449
|
-
pkgName.startsWith("react-"),
|
|
450
|
-
);
|
|
451
|
-
|
|
452
|
-
const jestConfig = this.fs.readJSON(jestConfigPath, pkg.jest ?? {});
|
|
453
|
-
delete pkg.jest;
|
|
454
|
-
|
|
455
|
-
const srcDirectory = this.options.srcDirectory;
|
|
456
|
-
Object.assign(jestConfig, {
|
|
457
|
-
cacheDirectory: "./node_modules/.cache/jest",
|
|
458
|
-
testEnvironment: "node",
|
|
459
|
-
testMatch: [
|
|
460
|
-
`<rootDir>/${workspacesPattern}/*/@(${srcDirectory}|lib)/**/__tests__/**/*.${
|
|
461
|
-
transpileWithBabel ? "(ts|js|cjs|mjs)" : "(js|cjs|mjs)"
|
|
462
|
-
}${hasReact ? "?(x)" : ""}`,
|
|
463
|
-
`<rootDir>/${workspacesPattern}/*/@(${srcDirectory}|lib)/**/*.test.${
|
|
464
|
-
transpileWithBabel ? "(ts|js|cjs|mjs)" : "(js|cjs|mjs)"
|
|
465
|
-
}${hasReact ? "?(x)" : ""}`,
|
|
466
|
-
],
|
|
467
|
-
});
|
|
468
|
-
|
|
469
|
-
if (shouldUseExperimentalVmModules) {
|
|
470
|
-
jestConfig.extensionsToTreatAsEsm = [
|
|
471
|
-
transpileWithBabel && ".ts",
|
|
472
|
-
transpileWithBabel && hasReact && ".tsx",
|
|
473
|
-
].filter(Boolean);
|
|
474
|
-
} else {
|
|
475
|
-
delete jestConfig.extensionsToTreatAsEsm;
|
|
476
|
-
}
|
|
477
|
-
|
|
478
|
-
writeAndFormatJson(this.fs, jestConfigPath, jestConfig);
|
|
479
|
-
}
|
|
480
391
|
} else {
|
|
481
392
|
const tsconfigTestPath = this.destinationPath("tsconfig.test.json");
|
|
482
393
|
this.fs.delete(tsconfigTestPath);
|
|
@@ -500,26 +411,21 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
500
411
|
pkg.pob?.bundler === "rollup-babel" ||
|
|
501
412
|
pkg.pob?.typescript;
|
|
502
413
|
|
|
503
|
-
const shouldUseExperimentalVmModules =
|
|
504
|
-
pkg.type === "module" && !inMonorepo;
|
|
505
|
-
|
|
506
414
|
packageUtils.removeScripts(pkg, ["test:coverage:lcov"]);
|
|
507
415
|
packageUtils.addScripts(pkg, {
|
|
508
|
-
test: createTestCommand({
|
|
416
|
+
test: createTestCommand({}),
|
|
509
417
|
"test:watch": createTestCommand({
|
|
510
|
-
shouldUseExperimentalVmModules,
|
|
511
418
|
watch: true,
|
|
512
419
|
}),
|
|
513
420
|
"test:coverage": createTestCommand({
|
|
514
|
-
shouldUseExperimentalVmModules,
|
|
515
421
|
coverage: true,
|
|
516
422
|
}),
|
|
517
423
|
"test:coverage:json": createTestCommand({
|
|
518
|
-
shouldUseExperimentalVmModules,
|
|
519
424
|
coverageJson: true,
|
|
520
425
|
}),
|
|
521
426
|
});
|
|
522
427
|
|
|
428
|
+
// TODO migrate some config to vitest. Keeping this if until then.
|
|
523
429
|
if (testRunner === "jest") {
|
|
524
430
|
const srcDirectory = this.options.build
|
|
525
431
|
? this.options.srcDirectory
|
|
@@ -561,7 +467,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
561
467
|
[hasReact ? "^.+\\.tsx?$" : "^.+\\.ts$"]: [
|
|
562
468
|
"jest-esbuild",
|
|
563
469
|
{
|
|
564
|
-
format: shouldUseExperimentalVmModules ? "esm" : "cjs",
|
|
470
|
+
// format: shouldUseExperimentalVmModules ? "esm" : "cjs",
|
|
565
471
|
},
|
|
566
472
|
],
|
|
567
473
|
};
|
|
@@ -583,15 +489,6 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
583
489
|
}
|
|
584
490
|
}
|
|
585
491
|
|
|
586
|
-
if (shouldUseExperimentalVmModules) {
|
|
587
|
-
jestConfig.extensionsToTreatAsEsm = [
|
|
588
|
-
withTypescript && ".ts",
|
|
589
|
-
withTypescript && hasReact && ".tsx",
|
|
590
|
-
].filter(Boolean);
|
|
591
|
-
} else {
|
|
592
|
-
delete jestConfig.extensionsToTreatAsEsm;
|
|
593
|
-
}
|
|
594
|
-
|
|
595
492
|
if (
|
|
596
493
|
!pkg.pob?.envs ||
|
|
597
494
|
pkg.pob?.envs.length === 0 ||
|
|
@@ -603,45 +500,20 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
603
500
|
delete jestConfig.testEnvironment;
|
|
604
501
|
}
|
|
605
502
|
|
|
606
|
-
writeAndFormatJson(this.fs, jestConfigPath, jestConfig);
|
|
503
|
+
await writeAndFormatJson(this.fs, jestConfigPath, jestConfig);
|
|
607
504
|
}
|
|
608
505
|
}
|
|
609
506
|
}
|
|
610
507
|
}
|
|
611
508
|
}
|
|
612
509
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
transpileWithBabel &&
|
|
616
|
-
((this.options.monorepo && globalTesting) || !globalTesting) &&
|
|
617
|
-
testRunner === "jest"
|
|
618
|
-
) {
|
|
619
|
-
// cjs for jest compat
|
|
620
|
-
copyAndFormatTpl(
|
|
621
|
-
this.fs,
|
|
622
|
-
this.templatePath("babel.config.cjs.ejs"),
|
|
623
|
-
this.destinationPath("babel.config.cjs"),
|
|
624
|
-
{
|
|
625
|
-
only: !this.options.monorepo
|
|
626
|
-
? `'${this.options.srcDirectory}'`
|
|
627
|
-
: pkg.workspaces
|
|
628
|
-
.flatMap((workspace) => [
|
|
629
|
-
`'${workspace}/${this.options.srcDirectory}'`,
|
|
630
|
-
`'${workspace}/lib'`,
|
|
631
|
-
])
|
|
632
|
-
.join(", "),
|
|
633
|
-
hasReact,
|
|
634
|
-
hasLinaria:
|
|
635
|
-
!!pkg.devDependencies?.["@linaria/babel-preset"] ||
|
|
636
|
-
!!pkg.devDependencies?.["alp-dev"],
|
|
637
|
-
testing: this.options.testing,
|
|
638
|
-
jestExperimentalESM: pkg.type === "module",
|
|
639
|
-
},
|
|
640
|
-
);
|
|
641
|
-
} else {
|
|
642
|
-
this.fs.delete("babel.config.cjs");
|
|
643
|
-
}
|
|
510
|
+
// legacy jest babel config
|
|
511
|
+
this.fs.delete("babel.config.cjs");
|
|
644
512
|
|
|
645
|
-
writeAndFormatJson(
|
|
513
|
+
return writeAndFormatJson(
|
|
514
|
+
this.fs,
|
|
515
|
+
this.destinationPath("package.json"),
|
|
516
|
+
pkg,
|
|
517
|
+
);
|
|
646
518
|
}
|
|
647
519
|
}
|
|
@@ -623,7 +623,7 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
623
623
|
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
624
624
|
}
|
|
625
625
|
|
|
626
|
-
writing() {
|
|
626
|
+
async writing() {
|
|
627
627
|
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
628
628
|
const entries = pkg.pob.entries || ["index"];
|
|
629
629
|
const envs = pkg.pob.envs || pkg.pob.babelEnvs;
|
|
@@ -715,7 +715,7 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
715
715
|
pkg.pob.bundler?.startsWith("rollup"))
|
|
716
716
|
) {
|
|
717
717
|
if (this.options.isApp) {
|
|
718
|
-
copyAndFormatTpl(
|
|
718
|
+
await copyAndFormatTpl(
|
|
719
719
|
this.fs,
|
|
720
720
|
this.templatePath("app.rollup.config.mjs.ejs"),
|
|
721
721
|
this.destinationPath("rollup.config.mjs"),
|
|
@@ -727,7 +727,7 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
727
727
|
},
|
|
728
728
|
);
|
|
729
729
|
} else {
|
|
730
|
-
copyAndFormatTpl(
|
|
730
|
+
await copyAndFormatTpl(
|
|
731
731
|
this.fs,
|
|
732
732
|
this.templatePath("lib.rollup.config.mjs.ejs"),
|
|
733
733
|
this.destinationPath("rollup.config.mjs"),
|
|
@@ -115,9 +115,24 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
115
115
|
default: false,
|
|
116
116
|
description: "only check js",
|
|
117
117
|
});
|
|
118
|
+
|
|
119
|
+
this.option("enableHashSlash", {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
required: false,
|
|
122
|
+
default: false,
|
|
123
|
+
description: "enable #/ in paths",
|
|
124
|
+
});
|
|
118
125
|
}
|
|
119
126
|
|
|
120
|
-
|
|
127
|
+
default() {
|
|
128
|
+
if (this.options.baseUrl) {
|
|
129
|
+
throw new Error(
|
|
130
|
+
"baseUrl option is not longer supported. Use enableHashSlash instead.",
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
async writing() {
|
|
121
136
|
if (this.fs.exists("flow-typed")) this.fs.delete("flow-typed");
|
|
122
137
|
if (this.fs.exists(this.destinationPath(".flowconfig"))) {
|
|
123
138
|
this.fs.delete(this.destinationPath(".flowconfig"));
|
|
@@ -179,6 +194,9 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
179
194
|
}
|
|
180
195
|
|
|
181
196
|
if (this.options.dom) {
|
|
197
|
+
if (this.options.isApp && pkg.devDependencies?.vite) {
|
|
198
|
+
return ["@pob/root/tsconfigs/targets/vite.json"];
|
|
199
|
+
}
|
|
182
200
|
return ["@pob/root/tsconfigs/targets/webpack.json"];
|
|
183
201
|
}
|
|
184
202
|
return [];
|
|
@@ -238,9 +256,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
238
256
|
packageName[0] === "@"
|
|
239
257
|
? // eslint-disable-next-line unicorn/no-nested-ternary
|
|
240
258
|
yoConfig.pob.project.type === "app"
|
|
241
|
-
? `packages/${packageName.slice(
|
|
242
|
-
packageName.indexOf("/") + 1,
|
|
243
|
-
)}`
|
|
259
|
+
? `packages/${packageName.slice(packageName.indexOf("/") + 1)}`
|
|
244
260
|
: packageName
|
|
245
261
|
: `packages/${packageName}`
|
|
246
262
|
}`,
|
|
@@ -261,9 +277,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
261
277
|
monorepoPackageSrcPaths = [...packageLocations.entries()].map(
|
|
262
278
|
([packageName, packageLocation]) => [
|
|
263
279
|
packageName,
|
|
264
|
-
`${packageLocation}/${
|
|
265
|
-
isTypescriptPackageMap.get(packageName) ? "src" : "lib"
|
|
266
|
-
}`,
|
|
280
|
+
`${packageLocation}/${isTypescriptPackageMap.get(packageName) ? "src" : "lib"}`,
|
|
267
281
|
],
|
|
268
282
|
);
|
|
269
283
|
monorepoPackageReferences = yoConfig.pob.monorepo.packageNames
|
|
@@ -291,7 +305,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
291
305
|
- allows IDE and typedoc to behave correctly
|
|
292
306
|
- generate useless definition files for not excluded tests files. However, it also use them for cache.
|
|
293
307
|
*/
|
|
294
|
-
copyAndFormatTpl(
|
|
308
|
+
await copyAndFormatTpl(
|
|
295
309
|
this.fs,
|
|
296
310
|
this.options.onlyCheck
|
|
297
311
|
? this.templatePath("tsconfig.check-js.json.ejs")
|
|
@@ -308,6 +322,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
308
322
|
monorepoPackageReferences,
|
|
309
323
|
rootDir: this.options.rootDir,
|
|
310
324
|
srcDirectory: this.options.srcDirectory || this.options.rootDir,
|
|
325
|
+
enableHashSlash: this.options.enableHashSlash,
|
|
311
326
|
scriptsDirectory: this.fs.exists(this.destinationPath("scripts"))
|
|
312
327
|
? "scripts"
|
|
313
328
|
: undefined,
|
|
@@ -321,7 +336,6 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
321
336
|
(!this.options.isApp || this.options.isAppLibrary),
|
|
322
337
|
incremental: monorepoComposite,
|
|
323
338
|
dom,
|
|
324
|
-
baseUrl: this.options.baseUrl,
|
|
325
339
|
resolveJsonModule: this.options.resolveJsonModule,
|
|
326
340
|
forceExcludeNodeModules: this.options.forceExcludeNodeModules,
|
|
327
341
|
forceAllowJs: this.options.forceAllowJs,
|
|
@@ -338,7 +352,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
338
352
|
// this.options.builddefs // &&
|
|
339
353
|
// // (!composite || monorepoPackageNames.length !== 0)
|
|
340
354
|
// ) {
|
|
341
|
-
// copyAndFormatTpl(
|
|
355
|
+
// await copyAndFormatTpl(
|
|
342
356
|
// this.fs,
|
|
343
357
|
// this.templatePath('tsconfig.build.json.ejs'),
|
|
344
358
|
// tsconfigBuildPath,
|
|
@@ -17,9 +17,6 @@
|
|
|
17
17
|
<% } -%>
|
|
18
18
|
"compilerOptions": {
|
|
19
19
|
"rootDir": "<%= rootDir %>",
|
|
20
|
-
<% if (baseUrl !== 'none') { -%>
|
|
21
|
-
"baseUrl": "<%= baseUrl %>", /* Base directory to resolve non-absolute module names. */
|
|
22
|
-
<% } -%>
|
|
23
20
|
<% if (emitDefinitions || build) { -%>
|
|
24
21
|
"outDir": "<%= build ? 'dist' : 'dist/definitions' %>",
|
|
25
22
|
<% if (build) { -%>
|
|
@@ -87,12 +84,16 @@
|
|
|
87
84
|
"esModuleInterop": true<% if (monorepoPackageSrcPaths) { %>,<% } %> /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
88
85
|
<% } -%>
|
|
89
86
|
|
|
90
|
-
<% if (monorepoPackageSrcPaths && monorepoPackageSrcPaths.length !== 0) { -%>
|
|
87
|
+
<% if (monorepoPackageSrcPaths && monorepoPackageSrcPaths.length !== 0 || enableHashSlash) { -%>
|
|
91
88
|
"paths": {
|
|
92
|
-
<%
|
|
89
|
+
<% if (enableHashSlash) { -%>
|
|
90
|
+
"#/*": ["./<%= srcDirectory %>/*"]<% if (monorepoPackageSrcPaths && monorepoPackageSrcPaths.length !== 0) { -%>,<% } %>
|
|
91
|
+
<% } if (monorepoPackageSrcPaths && monorepoPackageSrcPaths.length !== 0) { -%>
|
|
92
|
+
<% monorepoPackageSrcPaths.forEach(([packageName, packageLocation], index) => { -%>
|
|
93
93
|
"<%= packageName %>": ["<%= packageLocation %>"],
|
|
94
94
|
"<%= packageName %>/*": ["<%= packageLocation %>/*"]<%= index === monorepoPackageSrcPaths.length -1 ? '' : ',' -%>
|
|
95
95
|
<% }) %>
|
|
96
|
+
<% } %>
|
|
96
97
|
}<% } %>
|
|
97
98
|
}<% if (monorepoPackageReferences && monorepoPackageReferences.length) { -%>,
|
|
98
99
|
"references": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[install]
|
|
2
2
|
# Only install package versions published at least 3 days ago
|
|
3
3
|
minimumReleaseAge = 259200 # seconds - in #23162 it'll allow "3d" too
|
|
4
|
-
minimumReleaseAgeExcludes = ["@pob/root", "@pob/esbuild", "@pob/
|
|
4
|
+
minimumReleaseAgeExcludes = ["@pob/root", "@pob/esbuild", "@pob/rollup", "@pob/rollup-esbuild", "@pob/rollup-typescript", "@pob/sort-object", "@pob/sort-pkg", "@pob/version", "pob-dependencies", "pob-dependencies", "alouette", "alouette-icons", "nightingale", "nightingale-logger"]
|
|
@@ -2,7 +2,6 @@ import fs from "node:fs";
|
|
|
2
2
|
import Generator from "yeoman-generator";
|
|
3
3
|
import inMonorepo from "../../../utils/inMonorepo.js";
|
|
4
4
|
import { latestLTS, maintenanceLTS } from "../../../utils/nodeVersions.js";
|
|
5
|
-
import * as packageUtils from "../../../utils/package.js";
|
|
6
5
|
import { copyAndFormatTpl } from "../../../utils/writeAndFormat.js";
|
|
7
6
|
|
|
8
7
|
export const ciContexts = [];
|
|
@@ -37,8 +36,7 @@ export default class CoreCIGenerator extends Generator {
|
|
|
37
36
|
this.option("testRunner", {
|
|
38
37
|
type: String,
|
|
39
38
|
required: false,
|
|
40
|
-
|
|
41
|
-
description: "test runner: jest | node",
|
|
39
|
+
description: "test runner: vitest | node",
|
|
42
40
|
});
|
|
43
41
|
|
|
44
42
|
this.option("e2eTesting", {
|
|
@@ -98,7 +96,7 @@ export default class CoreCIGenerator extends Generator {
|
|
|
98
96
|
});
|
|
99
97
|
}
|
|
100
98
|
|
|
101
|
-
default() {
|
|
99
|
+
async default() {
|
|
102
100
|
if (fs.existsSync(this.destinationPath(".circleci"))) {
|
|
103
101
|
fs.rmdirSync(this.destinationPath(".circleci"), { recursive: true });
|
|
104
102
|
}
|
|
@@ -111,7 +109,7 @@ export default class CoreCIGenerator extends Generator {
|
|
|
111
109
|
this.options.testing && !!pkg.scripts && !!pkg.scripts.test;
|
|
112
110
|
const build = this.options.build;
|
|
113
111
|
|
|
114
|
-
copyAndFormatTpl(
|
|
112
|
+
await copyAndFormatTpl(
|
|
115
113
|
this.fs,
|
|
116
114
|
this.templatePath(
|
|
117
115
|
this.options.splitJobs
|
|
@@ -169,7 +167,7 @@ export default class CoreCIGenerator extends Generator {
|
|
|
169
167
|
!this.options.isApp &&
|
|
170
168
|
this.options.documentation
|
|
171
169
|
) {
|
|
172
|
-
copyAndFormatTpl(
|
|
170
|
+
await copyAndFormatTpl(
|
|
173
171
|
this.fs,
|
|
174
172
|
this.templatePath("github-action-documentation-workflow.yml.ejs"),
|
|
175
173
|
this.destinationPath(".github/workflows/gh-pages.yml"),
|
|
@@ -193,12 +191,6 @@ export default class CoreCIGenerator extends Generator {
|
|
|
193
191
|
this.fs.delete(this.destinationPath(".travis.yml"));
|
|
194
192
|
this.fs.delete(this.destinationPath("circle.yml"));
|
|
195
193
|
|
|
196
|
-
if (!this.options.enable) {
|
|
197
|
-
packageUtils.removeDevDependencies(pkg, ["jest-junit-reporter"]);
|
|
198
|
-
} else {
|
|
199
|
-
packageUtils.removeDevDependencies(pkg, ["jest-junit-reporter"]);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
194
|
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
203
195
|
}
|
|
204
196
|
}
|
|
@@ -85,8 +85,8 @@ jobs:
|
|
|
85
85
|
run: yarn install --immutable --immutable-cache
|
|
86
86
|
<% } -%>
|
|
87
87
|
|
|
88
|
-
- name:
|
|
89
|
-
run: <%= packageManager %> run
|
|
88
|
+
- name: Format
|
|
89
|
+
run: <%= packageManager %> run format:check
|
|
90
90
|
<% if (typescript) { -%>
|
|
91
91
|
|
|
92
92
|
- name: Typescript
|
|
@@ -146,7 +146,7 @@ jobs:
|
|
|
146
146
|
CI: true
|
|
147
147
|
|
|
148
148
|
- name: Send results to codecov
|
|
149
|
-
uses: codecov/codecov-action@
|
|
149
|
+
uses: codecov/codecov-action@v6
|
|
150
150
|
if: matrix.node-version == <%= nodeLatestMajorVersion %> && github.actor != 'dependabot[bot]'
|
|
151
151
|
with:
|
|
152
152
|
fail_ci_if_error: true
|
|
@@ -58,8 +58,8 @@ jobs:
|
|
|
58
58
|
if: startsWith(matrix.node-version, '<%= nodeLatestMajorVersion %>.')
|
|
59
59
|
|
|
60
60
|
<% } -%>
|
|
61
|
-
- name:
|
|
62
|
-
run: <%= packageManager %> run
|
|
61
|
+
- name: Format
|
|
62
|
+
run: <%= packageManager %> run format:check
|
|
63
63
|
if: startsWith(matrix.node-version, '<%= nodeLatestMajorVersion %>.')
|
|
64
64
|
<% if (typescript) { -%>
|
|
65
65
|
|
|
@@ -86,7 +86,7 @@ jobs:
|
|
|
86
86
|
CI: true
|
|
87
87
|
|
|
88
88
|
- name: Send results to codecov
|
|
89
|
-
uses: codecov/codecov-action@
|
|
89
|
+
uses: codecov/codecov-action@v6
|
|
90
90
|
with:
|
|
91
91
|
fail_ci_if_error: true
|
|
92
92
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -234,9 +234,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
234
234
|
pkg,
|
|
235
235
|
doesMjsCheckPackagesExists || doesJsCheckPackagesExists,
|
|
236
236
|
{
|
|
237
|
-
checks: `node scripts/check-packages.${
|
|
238
|
-
doesMjsCheckPackagesExists ? "mjs" : "js"
|
|
239
|
-
}`,
|
|
237
|
+
checks: `node scripts/check-packages.${doesMjsCheckPackagesExists ? "mjs" : "js"}`,
|
|
240
238
|
},
|
|
241
239
|
);
|
|
242
240
|
} else if (inMonorepo && !inMonorepo.root) {
|
|
@@ -300,9 +298,7 @@ export default class CorePackageGenerator extends Generator {
|
|
|
300
298
|
url: props.authorUrl || (author && author.url),
|
|
301
299
|
};
|
|
302
300
|
|
|
303
|
-
pkg.author = `${author.name} <${author.email}>${
|
|
304
|
-
author.url ? ` (${author.url})` : ""
|
|
305
|
-
}`;
|
|
301
|
+
pkg.author = `${author.name} <${author.email}>${author.url ? ` (${author.url})` : ""}`;
|
|
306
302
|
}
|
|
307
303
|
|
|
308
304
|
if (!pkg.license) {
|
|
@@ -5,7 +5,7 @@ import { writeAndFormatJson } from "../../../utils/writeAndFormat.js";
|
|
|
5
5
|
export default class CoreSortPackageGenerator extends Generator {
|
|
6
6
|
writing() {
|
|
7
7
|
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
8
|
-
writeAndFormatJson(
|
|
8
|
+
return writeAndFormatJson(
|
|
9
9
|
this.fs,
|
|
10
10
|
this.destinationPath("package.json"),
|
|
11
11
|
// eslint-disable-next-line unicorn/no-array-sort
|