pob 34.1.0 → 35.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/lib/generators/app/PobAppGenerator.js +90 -87
  3. package/lib/generators/app/e2e-testing/AppE2ETestingGenerator.js +5 -1
  4. package/lib/generators/app/ignorePaths.js +1 -2
  5. package/lib/generators/common/babel/CommonBabelGenerator.js +3 -3
  6. package/lib/generators/common/format-lint/CommonLintGenerator.js +17 -17
  7. package/lib/generators/common/format-lint/templates/{prettierignore.ejs → oxfmtrc.jsonc.ejs} +15 -8
  8. package/lib/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js +6 -1
  9. package/lib/generators/common/testing/CommonTestingGenerator.js +30 -162
  10. package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +3 -3
  11. package/lib/generators/common/typescript/CommonTypescriptGenerator.js +33 -16
  12. package/lib/generators/common/typescript/templates/tsconfig.check-js.json.ejs +3 -0
  13. package/lib/generators/common/typescript/templates/tsconfig.json.ejs +6 -5
  14. package/lib/generators/core/bun/templates/bunfig.toml.ejs +1 -1
  15. package/lib/generators/core/ci/CoreCIGenerator.js +4 -12
  16. package/lib/generators/core/ci/templates/github-action-push-workflow-split.yml.ejs +2 -2
  17. package/lib/generators/core/ci/templates/github-action-push-workflow.yml.ejs +2 -2
  18. package/lib/generators/core/package/CorePackageGenerator.js +2 -6
  19. package/lib/generators/core/renovate/CoreRenovateGenerator.js +1 -1
  20. package/lib/generators/core/sort-package/CoreSortPackageGenerator.js +1 -1
  21. package/lib/generators/core/vscode/CoreVSCodeGenerator.js +4 -4
  22. package/lib/generators/core/vscode/templates/settings.json.ejs +1 -1
  23. package/lib/generators/core/yarn/CoreYarnGenerator.js +6 -6
  24. package/lib/generators/lib/PobLibGenerator.js +2 -7
  25. package/lib/generators/lib/doc/LibDocGenerator.js +6 -4
  26. package/lib/generators/lib/readme/LibReadmeGenerator.js +2 -2
  27. package/lib/generators/monorepo/PobMonorepoGenerator.js +2 -2
  28. package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +1 -1
  29. package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +4 -5
  30. package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +15 -10
  31. package/lib/generators/pob/PobBaseGenerator.js +4 -4
  32. package/lib/utils/ensureJsonFileFormatted.js +7 -11
  33. package/lib/utils/writeAndFormat.js +16 -31
  34. package/package.json +28 -30
  35. 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
- async prompting() {
110
+ prompting() {
111
111
  if (this.options.enable && this.options.runner === "jest") {
112
- const { confirm } = await this.prompt([
113
- {
114
- type: "confirm",
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
- let hasReact =
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 || "jest"
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 (isJestRunner && !transpileWithBabel && withTypescript) {
198
- throw new Error("SWC is no longer supported. Migrate to vitest.");
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
- shouldUseExperimentalVmModules,
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,13 +303,6 @@ 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
307
  packageUtils.addOrRemoveDevDependencies(
365
308
  pkg,
@@ -386,7 +329,11 @@ export default class CommonTestingGenerator extends Generator {
386
329
  "test:coverage:lcov",
387
330
  ]);
388
331
 
389
- writeAndFormatJson(this.fs, this.destinationPath("package.json"), pkg);
332
+ await writeAndFormatJson(
333
+ this.fs,
334
+ this.destinationPath("package.json"),
335
+ pkg,
336
+ );
390
337
  } else {
391
338
  let workspacesPattern;
392
339
  if (this.options.monorepo) {
@@ -408,7 +355,7 @@ export default class CommonTestingGenerator extends Generator {
408
355
  });
409
356
  } else {
410
357
  if (this.testRunner === "vitest") {
411
- copyAndFormatTpl(
358
+ await copyAndFormatTpl(
412
359
  this.fs,
413
360
  this.templatePath("vite.config.js.ejs"),
414
361
  vitestConfigPath,
@@ -419,64 +366,24 @@ export default class CommonTestingGenerator extends Generator {
419
366
  }
420
367
 
421
368
  if (this.options.monorepo) {
422
- const shouldUseExperimentalVmModules = pkg.type === "module";
423
-
424
369
  packageUtils.removeScripts(pkg, ["test:coverage:lcov"]);
425
370
  packageUtils.addScripts(pkg, {
426
371
  test: createTestCommand({
427
372
  workspacesPattern,
428
- shouldUseExperimentalVmModules,
429
373
  }),
430
374
  "test:watch": createTestCommand({
431
375
  workspacesPattern,
432
- shouldUseExperimentalVmModules,
433
376
  watch: true,
434
377
  }),
435
378
  "test:coverage": createTestCommand({
436
379
  workspacesPattern,
437
- shouldUseExperimentalVmModules,
438
380
  coverage: true,
439
381
  }),
440
382
  "test:coverage:json": createTestCommand({
441
383
  workspacesPattern,
442
- shouldUseExperimentalVmModules,
443
384
  coverageJson: true,
444
385
  }),
445
386
  });
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
387
  } else {
481
388
  const tsconfigTestPath = this.destinationPath("tsconfig.test.json");
482
389
  this.fs.delete(tsconfigTestPath);
@@ -500,26 +407,21 @@ export default class CommonTestingGenerator extends Generator {
500
407
  pkg.pob?.bundler === "rollup-babel" ||
501
408
  pkg.pob?.typescript;
502
409
 
503
- const shouldUseExperimentalVmModules =
504
- pkg.type === "module" && !inMonorepo;
505
-
506
410
  packageUtils.removeScripts(pkg, ["test:coverage:lcov"]);
507
411
  packageUtils.addScripts(pkg, {
508
- test: createTestCommand({ shouldUseExperimentalVmModules }),
412
+ test: createTestCommand({}),
509
413
  "test:watch": createTestCommand({
510
- shouldUseExperimentalVmModules,
511
414
  watch: true,
512
415
  }),
513
416
  "test:coverage": createTestCommand({
514
- shouldUseExperimentalVmModules,
515
417
  coverage: true,
516
418
  }),
517
419
  "test:coverage:json": createTestCommand({
518
- shouldUseExperimentalVmModules,
519
420
  coverageJson: true,
520
421
  }),
521
422
  });
522
423
 
424
+ // TODO migrate some config to vitest. Keeping this if until then.
523
425
  if (testRunner === "jest") {
524
426
  const srcDirectory = this.options.build
525
427
  ? this.options.srcDirectory
@@ -561,7 +463,7 @@ export default class CommonTestingGenerator extends Generator {
561
463
  [hasReact ? "^.+\\.tsx?$" : "^.+\\.ts$"]: [
562
464
  "jest-esbuild",
563
465
  {
564
- format: shouldUseExperimentalVmModules ? "esm" : "cjs",
466
+ // format: shouldUseExperimentalVmModules ? "esm" : "cjs",
565
467
  },
566
468
  ],
567
469
  };
@@ -583,15 +485,6 @@ export default class CommonTestingGenerator extends Generator {
583
485
  }
584
486
  }
585
487
 
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
488
  if (
596
489
  !pkg.pob?.envs ||
597
490
  pkg.pob?.envs.length === 0 ||
@@ -603,45 +496,20 @@ export default class CommonTestingGenerator extends Generator {
603
496
  delete jestConfig.testEnvironment;
604
497
  }
605
498
 
606
- writeAndFormatJson(this.fs, jestConfigPath, jestConfig);
499
+ await writeAndFormatJson(this.fs, jestConfigPath, jestConfig);
607
500
  }
608
501
  }
609
502
  }
610
503
  }
611
504
  }
612
505
 
613
- if (
614
- this.options.enable &&
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
- }
506
+ // legacy jest babel config
507
+ this.fs.delete("babel.config.cjs");
644
508
 
645
- writeAndFormatJson(this.fs, this.destinationPath("package.json"), pkg);
509
+ return writeAndFormatJson(
510
+ this.fs,
511
+ this.destinationPath("package.json"),
512
+ pkg,
513
+ );
646
514
  }
647
515
  }
@@ -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,15 +115,37 @@ 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
- writing() {
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"));
124
139
  }
125
140
 
126
141
  const pkg = this.fs.readJSON(this.destinationPath("package.json"));
142
+ const envs = pkg.pob?.envs || [
143
+ {
144
+ target: "node",
145
+ version: `${maintenanceLTS}`,
146
+ },
147
+ ];
148
+ const withNode = envs.some((env) => env.target === "node");
127
149
 
128
150
  const presets = (() => {
129
151
  const babelEnvs =
@@ -144,12 +166,7 @@ export default class CommonTypescriptGenerator extends Generator {
144
166
  const nodeVersion = this.options.onlyLatestLTS
145
167
  ? `${latestLTS}`
146
168
  : `${maintenanceLTS}`;
147
- const envs = pkg.pob?.envs || [
148
- {
149
- target: "node",
150
- version: `${maintenanceLTS}`,
151
- },
152
- ];
169
+
153
170
  if (
154
171
  pkg.pob.rollup === false ||
155
172
  pkg.pob.bundler === false ||
@@ -177,6 +194,9 @@ export default class CommonTypescriptGenerator extends Generator {
177
194
  }
178
195
 
179
196
  if (this.options.dom) {
197
+ if (this.options.isApp && pkg.devDependencies?.vite) {
198
+ return ["@pob/root/tsconfigs/targets/vite.json"];
199
+ }
180
200
  return ["@pob/root/tsconfigs/targets/webpack.json"];
181
201
  }
182
202
  return [];
@@ -236,9 +256,7 @@ export default class CommonTypescriptGenerator extends Generator {
236
256
  packageName[0] === "@"
237
257
  ? // eslint-disable-next-line unicorn/no-nested-ternary
238
258
  yoConfig.pob.project.type === "app"
239
- ? `packages/${packageName.slice(
240
- packageName.indexOf("/") + 1,
241
- )}`
259
+ ? `packages/${packageName.slice(packageName.indexOf("/") + 1)}`
242
260
  : packageName
243
261
  : `packages/${packageName}`
244
262
  }`,
@@ -259,9 +277,7 @@ export default class CommonTypescriptGenerator extends Generator {
259
277
  monorepoPackageSrcPaths = [...packageLocations.entries()].map(
260
278
  ([packageName, packageLocation]) => [
261
279
  packageName,
262
- `${packageLocation}/${
263
- isTypescriptPackageMap.get(packageName) ? "src" : "lib"
264
- }`,
280
+ `${packageLocation}/${isTypescriptPackageMap.get(packageName) ? "src" : "lib"}`,
265
281
  ],
266
282
  );
267
283
  monorepoPackageReferences = yoConfig.pob.monorepo.packageNames
@@ -289,7 +305,7 @@ export default class CommonTypescriptGenerator extends Generator {
289
305
  - allows IDE and typedoc to behave correctly
290
306
  - generate useless definition files for not excluded tests files. However, it also use them for cache.
291
307
  */
292
- copyAndFormatTpl(
308
+ await copyAndFormatTpl(
293
309
  this.fs,
294
310
  this.options.onlyCheck
295
311
  ? this.templatePath("tsconfig.check-js.json.ejs")
@@ -306,6 +322,7 @@ export default class CommonTypescriptGenerator extends Generator {
306
322
  monorepoPackageReferences,
307
323
  rootDir: this.options.rootDir,
308
324
  srcDirectory: this.options.srcDirectory || this.options.rootDir,
325
+ enableHashSlash: this.options.enableHashSlash,
309
326
  scriptsDirectory: this.fs.exists(this.destinationPath("scripts"))
310
327
  ? "scripts"
311
328
  : undefined,
@@ -319,7 +336,6 @@ export default class CommonTypescriptGenerator extends Generator {
319
336
  (!this.options.isApp || this.options.isAppLibrary),
320
337
  incremental: monorepoComposite,
321
338
  dom,
322
- baseUrl: this.options.baseUrl,
323
339
  resolveJsonModule: this.options.resolveJsonModule,
324
340
  forceExcludeNodeModules: this.options.forceExcludeNodeModules,
325
341
  forceAllowJs: this.options.forceAllowJs,
@@ -327,6 +343,7 @@ export default class CommonTypescriptGenerator extends Generator {
327
343
  additionalIncludes: this.options.additionalIncludes
328
344
  .split(",")
329
345
  .filter(Boolean),
346
+ node: withNode,
330
347
  presets,
331
348
  },
332
349
  );
@@ -335,7 +352,7 @@ export default class CommonTypescriptGenerator extends Generator {
335
352
  // this.options.builddefs // &&
336
353
  // // (!composite || monorepoPackageNames.length !== 0)
337
354
  // ) {
338
- // copyAndFormatTpl(
355
+ // await copyAndFormatTpl(
339
356
  // this.fs,
340
357
  // this.templatePath('tsconfig.build.json.ejs'),
341
358
  // tsconfigBuildPath,
@@ -10,6 +10,9 @@
10
10
  "tsBuildInfoFile": "node_modules/.cache/tsc/tsbuildinfo",
11
11
  <% if (composite) { -%>
12
12
  "composite": true,
13
+ <% } -%>
14
+ <% if (node) { -%>
15
+ "types": ["node"],
13
16
  <% } -%>
14
17
  "noEmit": true
15
18
  },
@@ -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
- <% monorepoPackageSrcPaths.forEach(([packageName, packageLocation], index) => { %>
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/pretty-pkg", "@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"]
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
- default: "jest",
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: Prettier
89
- run: <%= packageManager %> run lint:prettier
88
+ - name: Format
89
+ run: <%= packageManager %> run format:check
90
90
  <% if (typescript) { -%>
91
91
 
92
92
  - name: Typescript
@@ -58,8 +58,8 @@ jobs:
58
58
  if: startsWith(matrix.node-version, '<%= nodeLatestMajorVersion %>.')
59
59
 
60
60
  <% } -%>
61
- - name: Prettier
62
- run: <%= packageManager %> run lint:prettier
61
+ - name: Format
62
+ run: <%= packageManager %> run format:check
63
63
  if: startsWith(matrix.node-version, '<%= nodeLatestMajorVersion %>.')
64
64
  <% if (typescript) { -%>
65
65
 
@@ -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) {
@@ -81,7 +81,7 @@ export default class CoreRenovateGenerator extends Generator {
81
81
  ].filter(Boolean);
82
82
  }
83
83
 
84
- writeAndFormatJson(
84
+ return writeAndFormatJson(
85
85
  this.fs,
86
86
  this.destinationPath("renovate.json"),
87
87
  renovateConfig,
@@ -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