pob 18.1.1 → 18.3.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 CHANGED
@@ -3,6 +3,47 @@
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
+ ## [18.3.0](https://github.com/christophehurpeau/pob/compare/pob@18.2.0...pob@18.3.0) (2024-02-17)
7
+
8
+
9
+ ### Features
10
+
11
+ * add directory in extraEntries for usage in files ([17839e6](https://github.com/christophehurpeau/pob/commit/17839e65d6a4f5c50e8f7e4e9da635fc3e0b7382))
12
+ * custom test folder ([f3214b9](https://github.com/christophehurpeau/pob/commit/f3214b9554dd2ce057786dad762a9eef07a25c41))
13
+ * **deps:** update dependency semver to v7.6.0 ([#1930](https://github.com/christophehurpeau/pob/issues/1930)) ([dfc8761](https://github.com/christophehurpeau/pob/commit/dfc8761b8123fbb5a9bdf25ba296a20043e25aae))
14
+ * **deps:** update dependency yeoman-environment to v4.2.1 ([#1901](https://github.com/christophehurpeau/pob/issues/1901)) ([e8bb372](https://github.com/christophehurpeau/pob/commit/e8bb372cd141cedc2736913b84e861768636f26e))
15
+ * **deps:** update dependency yeoman-environment to v4.3.0 ([#1917](https://github.com/christophehurpeau/pob/issues/1917)) ([453fdd9](https://github.com/christophehurpeau/pob/commit/453fdd96725e740306c9341595f1b9e1af15f3fc))
16
+ * **deps:** update yarn monorepo ([#1918](https://github.com/christophehurpeau/pob/issues/1918)) ([288ed84](https://github.com/christophehurpeau/pob/commit/288ed84945daa7813dcfb692ee459676a119b9bf))
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * fix export when omitVersionInFileName is set ([501367f](https://github.com/christophehurpeau/pob/commit/501367f0072f9ac41ace22312c0576afd7b1645a))
22
+ * fix jest enabled condition ([c10f8b1](https://github.com/christophehurpeau/pob/commit/c10f8b19139d41ef1565a5e7314dbdee5d67cdba))
23
+ * fix srcDirectory for app library ([7df6ba1](https://github.com/christophehurpeau/pob/commit/7df6ba14228326ee9b00b3fa2ec7af1204398860))
24
+
25
+ Version bump for dependency: yarn-workspace-utils
26
+ Version bump for dependency: root
27
+
28
+
29
+ ## [18.2.0](https://github.com/christophehurpeau/pob/compare/pob@18.1.1...pob@18.2.0) (2023-12-31)
30
+
31
+
32
+ ### Features
33
+
34
+ * initial work for monorepo node test runner ([c013532](https://github.com/christophehurpeau/pob/commit/c013532d6f204eb59861a95d946604f858cabe1a))
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * monorepo test runner ([d0d443f](https://github.com/christophehurpeau/pob/commit/d0d443ff95c03671378bb1f7a2c947075b982a04))
40
+ * **pob:** fix test override existing detection ([a030544](https://github.com/christophehurpeau/pob/commit/a03054400ded303aa8129f271a5abf1ee0701355))
41
+ * **pob:** fix test override existing detection ([4c54e86](https://github.com/christophehurpeau/pob/commit/4c54e86ba53e0cdad4ffa784ee8d89b96a139a4f))
42
+
43
+ Version bump for dependency: yarn-workspace-utils
44
+ Version bump for dependency: root
45
+
46
+
6
47
  ## [18.1.1](https://github.com/christophehurpeau/pob/compare/pob@18.1.0...pob@18.1.1) (2023-12-29)
7
48
 
8
49
 
@@ -127,7 +127,7 @@ export default class PobAppGenerator extends Generator {
127
127
  this.config.save();
128
128
  }
129
129
 
130
- async default() {
130
+ default() {
131
131
  const srcDirectory =
132
132
  this.appConfig.type === 'yarn-plugin' ? 'sources' : 'src';
133
133
  const isAppLibrary = this.appConfig.type === 'node-library';
@@ -137,7 +137,7 @@ export default class PobAppGenerator extends Generator {
137
137
  this.appConfig.type === 'node-library' ||
138
138
  this.appConfig.type === 'alp-node'
139
139
  ) {
140
- await this.composeWith('pob:common:babel', {
140
+ this.composeWith('pob:common:babel', {
141
141
  updateOnly: this.options.updateOnly,
142
142
  onlyLatestLTS: true,
143
143
  isApp: true,
@@ -148,7 +148,7 @@ export default class PobAppGenerator extends Generator {
148
148
  fromPob: this.options.fromPob,
149
149
  buildDirectory: 'build',
150
150
  });
151
- await this.composeWith('pob:common:transpiler', {
151
+ this.composeWith('pob:common:transpiler', {
152
152
  updateOnly: this.options.updateOnly,
153
153
  onlyLatestLTS: true,
154
154
  isApp: true,
@@ -165,7 +165,7 @@ export default class PobAppGenerator extends Generator {
165
165
  const pkg = this.fs.readJSON(this.destinationPath('package.json'));
166
166
 
167
167
  if (!inMonorepo || inMonorepo.root) {
168
- await this.composeWith('pob:common:husky', {});
168
+ this.composeWith('pob:common:husky', {});
169
169
  }
170
170
 
171
171
  const babelEnvs = (pkg.pob && pkg.pob.babelEnvs) || [];
@@ -190,7 +190,7 @@ export default class PobAppGenerator extends Generator {
190
190
  pkg,
191
191
  ).filter(Boolean);
192
192
 
193
- await this.composeWith('pob:common:typescript', {
193
+ this.composeWith('pob:common:typescript', {
194
194
  enable: typescript,
195
195
  isApp: true,
196
196
  isAppLibrary,
@@ -235,17 +235,22 @@ export default class PobAppGenerator extends Generator {
235
235
  })(),
236
236
  });
237
237
 
238
- await this.composeWith('pob:common:remove-old-dependencies');
238
+ this.composeWith('pob:common:remove-old-dependencies');
239
239
 
240
240
  const enableReleasePlease =
241
241
  !inMonorepo && this.appConfig.testing && this.appConfig.ci;
242
242
 
243
243
  if (this.appConfig.type !== 'remix') {
244
- await this.composeWith('pob:common:testing', {
244
+ this.composeWith('pob:common:testing', {
245
245
  enable: this.appConfig.testing,
246
246
  disableYarnGitCache: this.options.disableYarnGitCache,
247
247
  enableReleasePlease,
248
248
  testing: this.appConfig.testing,
249
+ runner: this.appConfig.testing
250
+ ? (inMonorepo
251
+ ? inMonorepo.pobMonorepoConfig.testRunner
252
+ : this.appConfig.testRunner) || 'jest'
253
+ : undefined,
249
254
  e2eTesting: this.appConfig.e2e ? '.' : '',
250
255
  typescript,
251
256
  build: typescript && this.appConfig.type !== 'expo',
@@ -259,11 +264,11 @@ export default class PobAppGenerator extends Generator {
259
264
  srcDirectory,
260
265
  });
261
266
 
262
- await this.composeWith('pob:app:e2e-testing', {
267
+ this.composeWith('pob:app:e2e-testing', {
263
268
  enable: this.appConfig.e2e,
264
269
  });
265
270
 
266
- await this.composeWith('pob:common:format-lint', {
271
+ this.composeWith('pob:common:format-lint', {
267
272
  isApp: true,
268
273
  documentation: false,
269
274
  testing: this.appConfig.testing,
@@ -281,7 +286,7 @@ export default class PobAppGenerator extends Generator {
281
286
  buildDirectory: this.appConfig.type === 'expo' ? '.expo' : 'build',
282
287
  });
283
288
 
284
- await this.composeWith('pob:common:release', {
289
+ this.composeWith('pob:common:release', {
285
290
  enable:
286
291
  !inMonorepo &&
287
292
  this.appConfig.testing &&
@@ -296,7 +301,7 @@ export default class PobAppGenerator extends Generator {
296
301
  });
297
302
  }
298
303
 
299
- await this.composeWith('pob:core:vscode', {
304
+ this.composeWith('pob:core:vscode', {
300
305
  root: !inMonorepo,
301
306
  monorepo: false,
302
307
  packageManager: this.options.packageManager,
@@ -310,7 +315,7 @@ export default class PobAppGenerator extends Generator {
310
315
  ignorePaths.push('/.env*', '!/.env.example');
311
316
  }
312
317
 
313
- await this.composeWith('pob:core:gitignore', {
318
+ this.composeWith('pob:core:gitignore', {
314
319
  root: !inMonorepo || inMonorepo.root,
315
320
  documentation: false,
316
321
  testing: this.appConfig.testing,
@@ -319,16 +324,16 @@ export default class PobAppGenerator extends Generator {
319
324
  buildInGit: false,
320
325
  });
321
326
 
322
- await this.composeWith('pob:core:npm', { enable: false });
327
+ this.composeWith('pob:core:npm', { enable: false });
323
328
 
324
329
  switch (this.appConfig.type) {
325
330
  case 'next.js':
326
- await this.composeWith('pob:app:nextjs', {
331
+ this.composeWith('pob:app:nextjs', {
327
332
  export: this.appConfig.export,
328
333
  });
329
334
  break;
330
335
  case 'remix':
331
- await this.composeWith('pob:app:remix', {});
336
+ this.composeWith('pob:app:remix', {});
332
337
  break;
333
338
  }
334
339
 
@@ -341,7 +346,7 @@ export default class PobAppGenerator extends Generator {
341
346
  }
342
347
  }
343
348
 
344
- async writing() {
349
+ writing() {
345
350
  // Re-read the content at this point because a composed generator might modify it.
346
351
  const pkg = this.fs.readJSON(this.destinationPath('package.json'));
347
352
 
@@ -355,6 +360,6 @@ export default class PobAppGenerator extends Generator {
355
360
 
356
361
  this.fs.writeJSON(this.destinationPath('package.json'), pkg);
357
362
 
358
- await this.composeWith('pob:core:sort-package');
363
+ this.composeWith('pob:core:sort-package');
359
364
  }
360
365
  }
@@ -404,12 +404,14 @@ export default class CommonLintGenerator extends Generator {
404
404
  ? `{${pkg.type === 'commonjs' ? 'mjs' : 'cjs'},js}`
405
405
  : `${hasReact ? '{ts,tsx}' : 'ts'}`;
406
406
 
407
+ const testRunner = globalTesting
408
+ ? inMonorepo.pobConfig.monorepo.testRunner
409
+ : this.options.testRunner;
407
410
  const testsOverride =
408
411
  this.options.testing || globalTesting
409
412
  ? {
410
413
  files: [`**/*.test.${ext}`, `__tests__/**/*.${ext}`],
411
- ...(this.options.testRunner == null ||
412
- this.options.testRunner === 'jest'
414
+ ...(testRunner == null || testRunner === 'jest'
413
415
  ? { env: { jest: true } }
414
416
  : {}),
415
417
  rules: {
@@ -6,7 +6,9 @@ function updateOverrides(config, testsOverride) {
6
6
  : config.overrides.findIndex(
7
7
  testsOverride.env?.jest
8
8
  ? (override) => override.env && override.env.jest
9
- : (override) => override.extends.includes(testsOverride.extends[0]),
9
+ : (override) =>
10
+ override?.env?.jest ||
11
+ override.extends?.includes(testsOverride.extends[0]),
10
12
  );
11
13
  if (!testsOverride) {
12
14
  if (existingTestsOverrideIndex !== -1) {
@@ -1,3 +1,4 @@
1
+ import fs from 'node:fs';
1
2
  import path from 'node:path';
2
3
  import Generator from 'yeoman-generator';
3
4
  import inMonorepo from '../../../utils/inMonorepo.js';
@@ -115,9 +116,9 @@ export default class CommonTestingGenerator extends Generator {
115
116
  });
116
117
  }
117
118
 
118
- async default() {
119
+ default() {
119
120
  if (!inMonorepo || inMonorepo.root) {
120
- await this.composeWith('pob:core:ci', {
121
+ this.composeWith('pob:core:ci', {
121
122
  enable: this.options.ci,
122
123
  enableReleasePlease: this.options.enableReleasePlease,
123
124
  enableYarnVersion: this.options.enableYarnVersion,
@@ -135,7 +136,7 @@ export default class CommonTestingGenerator extends Generator {
135
136
  onlyLatestLTS: this.options.onlyLatestLTS,
136
137
  });
137
138
  } else {
138
- await this.composeWith('pob:core:ci', {
139
+ this.composeWith('pob:core:ci', {
139
140
  enable: false,
140
141
  });
141
142
  }
@@ -170,8 +171,21 @@ export default class CommonTestingGenerator extends Generator {
170
171
  (this.options.monorepo
171
172
  ? yoConfigPobMonorepo.react ?? packageUtils.hasReact(pkg)
172
173
  : packageUtils.hasReact(pkg));
174
+ const testRunner = globalTesting
175
+ ? inMonorepo.pobConfig.monorepo.testRunner || 'jest'
176
+ : this.options.runner;
173
177
 
174
- const isJestRunner = this.options.runner === 'jest';
178
+ const isJestRunner = testRunner === 'jest';
179
+
180
+ const tsTestUtil = 'ts-node'; // : 'babel' | 'tsimp' | 'ts-node' | 'swc'
181
+ packageUtils.addOrRemoveDevDependencies(
182
+ pkg,
183
+ this.options.enable &&
184
+ (!inMonorepo || inMonorepo.root) &&
185
+ testRunner === 'node' &&
186
+ this.options.typescript,
187
+ [tsTestUtil],
188
+ );
175
189
 
176
190
  if (
177
191
  !this.options.enable ||
@@ -187,7 +201,6 @@ export default class CommonTestingGenerator extends Generator {
187
201
  this.fs.delete(this.destinationPath('jest.config.json'));
188
202
  }
189
203
 
190
- const tsTestUtil = 'ts-node'; // : 'tsimp' | 'ts-node' | 'swc
191
204
  const tsTestLoaderOption = (() => {
192
205
  switch (tsTestUtil) {
193
206
  case 'tsimp':
@@ -198,13 +211,9 @@ export default class CommonTestingGenerator extends Generator {
198
211
  return '--import=@swc-node/register/esm';
199
212
  }
200
213
  })();
201
- packageUtils.addOrRemoveDevDependencies(
202
- pkg,
203
- this.options.enable &&
204
- this.options.runner === 'node' &&
205
- this.options.typescript,
206
- [tsTestUtil],
207
- );
214
+
215
+ const hasTestFolder =
216
+ !this.options.monorepo && fs.existsSync(this.destinationPath('test'));
208
217
 
209
218
  const createTestCommand = ({
210
219
  coverage,
@@ -212,8 +221,10 @@ export default class CommonTestingGenerator extends Generator {
212
221
  coverageJson,
213
222
  watch,
214
223
  shouldUseExperimentalVmModules,
224
+ workspacesPattern,
225
+ hasReact,
215
226
  }) => {
216
- switch (this.options.runner) {
227
+ switch (testRunner) {
217
228
  case 'jest': {
218
229
  return `${
219
230
  shouldUseExperimentalVmModules
@@ -232,6 +243,9 @@ export default class CommonTestingGenerator extends Generator {
232
243
  }`;
233
244
  }
234
245
  case 'node': {
246
+ if (!workspacesPattern && this.options.monorepo) {
247
+ throw new Error('Invalid workspacesPattern');
248
+ }
235
249
  return `${tsTestUtil === 'tsimp' ? 'TSIMP_DIAG=ignore ' : ''}${
236
250
  tsTestUtil === 'ts-node'
237
251
  ? 'TS_NODE_PROJECT=tsconfig.test.json '
@@ -246,16 +260,25 @@ export default class CommonTestingGenerator extends Generator {
246
260
  : ''
247
261
  }node ${
248
262
  this.options.typescript ? `${tsTestLoaderOption} ` : ''
249
- }--test ${this.options.srcDirectory}/${
250
- this.options.typescript ? '**/*.test.ts' : '**/*.test.js'
251
- }`;
263
+ }--test ${this.options.monorepo ? `${workspacesPattern}/` : ''}${`${
264
+ hasTestFolder ? 'test/*' : `${this.options.srcDirectory}/**/*.test`
265
+ }.${this.options.typescript ? 'ts' : 'js'}`}`;
252
266
  }
253
267
  default: {
254
- throw new Error('Invalid runner');
268
+ throw new Error(`Invalid runner: "${testRunner}"`);
255
269
  }
256
270
  }
257
271
  };
258
272
 
273
+ const jestConfigPath = this.destinationPath('jest.config.json');
274
+ packageUtils.addOrRemoveDevDependencies(
275
+ pkg,
276
+ this.options.enable &&
277
+ (enableForMonorepo || !globalTesting) &&
278
+ testRunner === 'jest',
279
+ ['jest', '@types/jest'],
280
+ );
281
+
259
282
  if (!this.options.enable) {
260
283
  // if (inMonorepo) {
261
284
  // if (pkg.scripts.test === 'echo "No tests"') {
@@ -263,27 +286,32 @@ export default class CommonTestingGenerator extends Generator {
263
286
  // }
264
287
  // delete pkg.scripts['generate:test-coverage'];
265
288
  // }
266
- if (pkg.scripts) {
267
- delete pkg.scripts.test;
268
- delete pkg.scripts['generate:test-coverage'];
269
- delete pkg.scripts['test:watch'];
270
- delete pkg.scripts['test:coverage'];
271
- delete pkg.scripts['test:coverage:json'];
272
- delete pkg.scripts['test:coverage:lcov'];
273
- }
289
+ packageUtils.removeScripts([
290
+ 'test',
291
+ 'test:coverage',
292
+ 'generate:test-coverage',
293
+ 'test:watch',
294
+ 'test:coverage',
295
+ 'test:coverage:json',
296
+ 'test:coverage:lcov',
297
+ ]);
274
298
 
275
299
  writeAndFormatJson(this.fs, this.destinationPath('package.json'), pkg);
276
300
  } else {
277
- const jestConfigPath = this.destinationPath('jest.config.json');
278
- if (this.options.runner === 'jest') {
279
- packageUtils.addOrRemoveDevDependencies(
280
- pkg,
281
- enableForMonorepo || !globalTesting,
282
- ['jest', '@types/jest'],
283
- );
301
+ let workspacesPattern;
302
+ if (this.options.monorepo) {
303
+ const workspacesWithoutStar = pkg.workspaces.map((workspace) => {
304
+ if (!workspace.endsWith('/*')) {
305
+ throw new Error(`Invalid workspace format: ${workspace}`);
306
+ }
307
+ return workspace.slice(0, -2);
308
+ });
309
+ workspacesPattern =
310
+ workspacesWithoutStar.length === 1
311
+ ? workspacesWithoutStar[0]
312
+ : `@(${workspacesWithoutStar.join('|')})`;
284
313
  }
285
314
 
286
- packageUtils.removeScripts(['test:coverage']);
287
315
  if (this.options.monorepo && !globalTesting) {
288
316
  packageUtils.addScripts(pkg, {
289
317
  test: 'yarn workspaces foreach --parallel -Av run test',
@@ -292,36 +320,33 @@ export default class CommonTestingGenerator extends Generator {
292
320
  const shouldUseExperimentalVmModules = pkg.type === 'module';
293
321
 
294
322
  packageUtils.addScripts(pkg, {
295
- test: createTestCommand({ shouldUseExperimentalVmModules }),
323
+ test: createTestCommand({
324
+ workspacesPattern,
325
+ shouldUseExperimentalVmModules,
326
+ }),
296
327
  'test:watch': createTestCommand({
328
+ workspacesPattern,
297
329
  shouldUseExperimentalVmModules,
298
330
  watch: true,
299
331
  }),
300
332
  'test:coverage': createTestCommand({
333
+ workspacesPattern,
301
334
  shouldUseExperimentalVmModules,
302
335
  coverage: true,
303
336
  }),
304
337
  'test:coverage:lcov': createTestCommand({
338
+ workspacesPattern,
305
339
  shouldUseExperimentalVmModules,
306
340
  coverageLcov: true,
307
341
  }),
308
342
  'test:coverage:json': createTestCommand({
343
+ workspacesPattern,
309
344
  shouldUseExperimentalVmModules,
310
345
  coverageJson: true,
311
346
  }),
312
347
  });
313
348
 
314
349
  if (isJestRunner) {
315
- const workspacesWithoutStar = pkg.workspaces.map((workspace) => {
316
- if (!workspace.endsWith('/*')) {
317
- throw new Error(`Invalid workspace format: ${workspace}`);
318
- }
319
- return workspace.slice(0, -2);
320
- });
321
- const workspacesPattern =
322
- workspacesWithoutStar.length === 1
323
- ? workspacesWithoutStar[0]
324
- : `@(${workspacesWithoutStar.join('|')})`;
325
350
  hasReact = yoConfigPobMonorepo.packageNames.some((pkgName) =>
326
351
  pkgName.startsWith('react-'),
327
352
  );
@@ -353,133 +378,151 @@ export default class CommonTestingGenerator extends Generator {
353
378
  }
354
379
  writeAndFormatJson(this.fs, jestConfigPath, jestConfig);
355
380
  }
356
- } else if (globalTesting) {
357
- if (pkg.scripts) {
358
- delete pkg.scripts['generate:test-coverage'];
359
- delete pkg.scripts['test:watch'];
360
- delete pkg.scripts['test:coverage'];
361
- }
362
- packageUtils.addScripts(pkg, {
363
- test: `yarn ../../ run test -- ${path
364
- .relative('../..', '.')
365
- .replace('\\', '/')}`,
366
- });
367
381
  } else {
368
- const babelEnvs = pkg.pob?.babelEnvs || [];
369
- const transpileWithBabel = packageUtils.transpileWithBabel(pkg);
370
- const withTypescript = babelEnvs.length > 0 || pkg.pob?.typescript;
371
-
372
- const shouldUseExperimentalVmModules =
373
- pkg.type === 'module' && !inMonorepo;
374
-
375
- packageUtils.addScripts(pkg, {
376
- test: createTestCommand({ shouldUseExperimentalVmModules }),
377
- 'test:watch': createTestCommand({
378
- shouldUseExperimentalVmModules,
379
- watch: true,
380
- }),
381
- 'test:coverage': createTestCommand({
382
- shouldUseExperimentalVmModules,
383
- coverage: true,
384
- }),
385
- 'test:coverage:lcov': createTestCommand({
386
- shouldUseExperimentalVmModules,
387
- coverageLcov: true,
388
- }),
389
- 'test:coverage:json': createTestCommand({
390
- shouldUseExperimentalVmModules,
391
- coverageJson: true,
392
- }),
393
- });
394
-
395
- if (this.options.runner === 'jest') {
396
- const srcDirectory =
397
- transpileWithBabel || withTypescript
398
- ? this.options.srcDirectory
399
- : 'lib';
382
+ const tsconfigTestPath = this.destinationPath('tsconfig.test.json');
383
+ if (testRunner === 'node' && withTypescript) {
384
+ const nodeVersion = this.options.onlyLatestLTS ? '20' : '18';
385
+ copyAndFormatTpl(
386
+ this.fs,
387
+ this.templatePath('tsconfig.test.json.ejs'),
388
+ tsconfigTestPath,
389
+ {
390
+ nodeVersion,
391
+ },
392
+ );
393
+ } else {
394
+ this.fs.delete(tsconfigTestPath);
395
+ }
400
396
 
401
- const jestConfig = this.fs.readJSON(jestConfigPath, pkg.jest ?? {});
402
- delete pkg.jest;
403
- Object.assign(jestConfig, {
404
- cacheDirectory: './node_modules/.cache/jest',
405
- testMatch: [
406
- `<rootDir>/${srcDirectory}/**/__tests__/**/*.${
407
- withTypescript ? 'ts' : '?(m)js'
408
- }${hasReact ? '?(x)' : ''}`,
409
- `<rootDir>/${srcDirectory}/**/*.test.${
410
- withTypescript ? 'ts' : '?(m)js'
411
- }${hasReact ? '?(x)' : ''}`,
412
- ],
413
- collectCoverageFrom: [
414
- `${srcDirectory}/**/*.${withTypescript ? 'ts' : '?(m)js'}${
415
- hasReact ? '?(x)' : ''
416
- }`,
417
- ],
418
- moduleFileExtensions: [
419
- withTypescript && 'ts',
420
- withTypescript && hasReact && 'tsx',
421
- 'js',
422
- // 'jsx',
423
- 'json',
424
- ].filter(Boolean),
425
- // transform: {
426
- // [`^.+\\.ts${hasReact ? 'x?' : ''}$`]: 'babel-jest',
427
- // },
397
+ if (globalTesting) {
398
+ if (pkg.scripts) {
399
+ delete pkg.scripts['generate:test-coverage'];
400
+ delete pkg.scripts['test:watch'];
401
+ delete pkg.scripts['test:coverage'];
402
+ }
403
+ packageUtils.addScripts(pkg, {
404
+ test: `yarn ../../ run test -- ${path
405
+ .relative('../..', '.')
406
+ .replace('\\', '/')}`,
407
+ });
408
+ } else {
409
+ const babelEnvs = pkg.pob?.babelEnvs || [];
410
+ const transpileWithBabel = packageUtils.transpileWithBabel(pkg);
411
+ const withTypescript = babelEnvs.length > 0 || pkg.pob?.typescript;
412
+
413
+ const shouldUseExperimentalVmModules =
414
+ pkg.type === 'module' && !inMonorepo;
415
+
416
+ packageUtils.addScripts(pkg, {
417
+ test: createTestCommand({ shouldUseExperimentalVmModules }),
418
+ 'test:watch': createTestCommand({
419
+ shouldUseExperimentalVmModules,
420
+ watch: true,
421
+ }),
422
+ 'test:coverage': createTestCommand({
423
+ shouldUseExperimentalVmModules,
424
+ coverage: true,
425
+ }),
426
+ 'test:coverage:lcov': createTestCommand({
427
+ shouldUseExperimentalVmModules,
428
+ coverageLcov: true,
429
+ }),
430
+ 'test:coverage:json': createTestCommand({
431
+ shouldUseExperimentalVmModules,
432
+ coverageJson: true,
433
+ }),
428
434
  });
429
- if (transpileWithEsbuild) {
430
- jestConfig.transform = {
431
- [hasReact ? '^.+\\.tsx?$' : '^.+\\.ts$']: [
432
- 'jest-esbuild',
433
- {
434
- format: shouldUseExperimentalVmModules ? 'esm' : 'cjs',
435
- },
435
+
436
+ if (testRunner === 'jest') {
437
+ const srcDirectory =
438
+ transpileWithBabel || withTypescript
439
+ ? this.options.srcDirectory
440
+ : 'lib';
441
+
442
+ const jestConfig = this.fs.readJSON(jestConfigPath, pkg.jest ?? {});
443
+ delete pkg.jest;
444
+ Object.assign(jestConfig, {
445
+ cacheDirectory: './node_modules/.cache/jest',
446
+ testMatch: [
447
+ `<rootDir>/${srcDirectory}/**/__tests__/**/*.${
448
+ withTypescript ? 'ts' : '?(m)js'
449
+ }${hasReact ? '?(x)' : ''}`,
450
+ `<rootDir>/${srcDirectory}/**/*.test.${
451
+ withTypescript ? 'ts' : '?(m)js'
452
+ }${hasReact ? '?(x)' : ''}`,
453
+ ],
454
+ collectCoverageFrom: [
455
+ `${srcDirectory}/**/*.${withTypescript ? 'ts' : '?(m)js'}${
456
+ hasReact ? '?(x)' : ''
457
+ }`,
436
458
  ],
437
- };
438
- } else if (!transpileWithBabel) {
439
- delete jestConfig.transform;
440
- } else if (jestConfig.transform) {
441
- jestConfig.transform = Object.fromEntries(
442
- Object.entries(jestConfig.transform).filter(
443
- ([key, value]) =>
444
- !(
445
- value &&
446
- Array.isArray(value) &&
447
- value[0] === 'jest-esbuild'
448
- ),
449
- ),
450
- );
451
- if (Object.keys(jestConfig.transform).length === 0) {
459
+ moduleFileExtensions: [
460
+ withTypescript && 'ts',
461
+ withTypescript && hasReact && 'tsx',
462
+ 'js',
463
+ // 'jsx',
464
+ 'json',
465
+ ].filter(Boolean),
466
+ // transform: {
467
+ // [`^.+\\.ts${hasReact ? 'x?' : ''}$`]: 'babel-jest',
468
+ // },
469
+ });
470
+ if (transpileWithEsbuild) {
471
+ jestConfig.transform = {
472
+ [hasReact ? '^.+\\.tsx?$' : '^.+\\.ts$']: [
473
+ 'jest-esbuild',
474
+ {
475
+ format: shouldUseExperimentalVmModules ? 'esm' : 'cjs',
476
+ },
477
+ ],
478
+ };
479
+ } else if (!transpileWithBabel) {
452
480
  delete jestConfig.transform;
481
+ } else if (jestConfig.transform) {
482
+ jestConfig.transform = Object.fromEntries(
483
+ Object.entries(jestConfig.transform).filter(
484
+ ([key, value]) =>
485
+ !(
486
+ value &&
487
+ Array.isArray(value) &&
488
+ value[0] === 'jest-esbuild'
489
+ ),
490
+ ),
491
+ );
492
+ if (Object.keys(jestConfig.transform).length === 0) {
493
+ delete jestConfig.transform;
494
+ }
453
495
  }
454
- }
455
496
 
456
- if (shouldUseExperimentalVmModules) {
457
- jestConfig.extensionsToTreatAsEsm = [
458
- withTypescript && '.ts',
459
- withTypescript && hasReact && '.tsx',
460
- ].filter(Boolean);
461
- } else {
462
- delete jestConfig.extensionsToTreatAsEsm;
463
- }
497
+ if (shouldUseExperimentalVmModules) {
498
+ jestConfig.extensionsToTreatAsEsm = [
499
+ withTypescript && '.ts',
500
+ withTypescript && hasReact && '.tsx',
501
+ ].filter(Boolean);
502
+ } else {
503
+ delete jestConfig.extensionsToTreatAsEsm;
504
+ }
464
505
 
465
- if (
466
- babelEnvs.length === 0 ||
467
- babelEnvs.some((env) => env.target === 'node')
468
- ) {
469
- // jestConfig.testEnvironment = 'node'; this is the default now
470
- delete jestConfig.testEnvironment;
471
- } else {
472
- delete jestConfig.testEnvironment;
473
- }
506
+ if (
507
+ babelEnvs.length === 0 ||
508
+ babelEnvs.some((env) => env.target === 'node')
509
+ ) {
510
+ // jestConfig.testEnvironment = 'node'; this is the default now
511
+ delete jestConfig.testEnvironment;
512
+ } else {
513
+ delete jestConfig.testEnvironment;
514
+ }
474
515
 
475
- writeAndFormatJson(this.fs, jestConfigPath, jestConfig);
516
+ writeAndFormatJson(this.fs, jestConfigPath, jestConfig);
517
+ }
476
518
  }
477
519
  }
478
520
  }
479
521
 
480
522
  if (
481
523
  transpileWithBabel &&
482
- ((this.options.monorepo && globalTesting) || !globalTesting)
524
+ ((this.options.monorepo && globalTesting) || !globalTesting) &&
525
+ testRunner === 'jest'
483
526
  ) {
484
527
  // cjs for jest compat
485
528
  copyAndFormatTpl(
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": [
3
+ "./tsconfig.json",
4
+ "@pob/root/tsconfigs/targets/node-<%= nodeVersion %>.json"
5
+ ],
6
+ "ts-node": {
7
+ "esm": true,
8
+ "transpileOnly": true
9
+ }
10
+ }
@@ -335,21 +335,24 @@ export default class CommonTranspilerGenerator extends Generator {
335
335
 
336
336
  const defaultNodeEnvVersion = defaultNodeEnv && defaultNodeEnv.version;
337
337
 
338
- envs.forEach(({ target, version, formats }) => {
338
+ envs.forEach(({ target, version, formats, omitVersionInFileName }) => {
339
339
  if (target === 'node' && entry === 'browser') return;
340
340
 
341
341
  const exportTarget = {};
342
342
 
343
343
  if (target === 'node') {
344
344
  const cjsExt = pkg.type === 'module' ? 'cjs' : 'cjs.js';
345
+ const filenameWithoutExt = `${entryDistName}-${target}${
346
+ omitVersionInFileName ? '' : version
347
+ }`;
345
348
  if (!formats || formats.includes('es')) {
346
- exportTarget.import = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.mjs`;
349
+ exportTarget.import = `./${this.options.buildDirectory}/${filenameWithoutExt}.mjs`;
347
350
 
348
351
  if (formats && formats.includes('cjs')) {
349
- exportTarget.require = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
352
+ exportTarget.require = `./${this.options.buildDirectory}/${filenameWithoutExt}.${cjsExt}`;
350
353
  }
351
354
  } else if (formats && formats.includes('cjs')) {
352
- exportTarget.default = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
355
+ exportTarget.default = `./${this.options.buildDirectory}/${filenameWithoutExt}.${cjsExt}`;
353
356
  }
354
357
  // eslint: https://github.com/benmosher/eslint-plugin-import/issues/2132
355
358
  // jest: https://github.com/facebook/jest/issues/9771
@@ -99,9 +99,9 @@ export default class CoreGitGenerator extends Generator {
99
99
  }
100
100
  }
101
101
 
102
- async default() {
102
+ default() {
103
103
  if (this.gitHost === 'github') {
104
- await this.composeWith('pob:core:git:github', {
104
+ this.composeWith('pob:core:git:github', {
105
105
  shouldCreate: !this.originUrl,
106
106
  gitHostAccount: this.gitHostAccount,
107
107
  repoName: this.repoName,
@@ -60,6 +60,13 @@ export default class CoreNpmGenerator extends Generator {
60
60
  }
61
61
  });
62
62
  }
63
+ if (pkg.pob?.extraEntries) {
64
+ pkg.pob?.extraEntries.forEach((extraEntry) => {
65
+ if (extraEntry.directory) {
66
+ files.add(extraEntry.directory);
67
+ }
68
+ });
69
+ }
63
70
 
64
71
  pkg.files = [...files].filter(Boolean);
65
72
  } else {
@@ -229,14 +229,14 @@ export default class PobLibGenerator extends Generator {
229
229
 
230
230
  this.fs.writeJSON(this.destinationPath('package.json'), pkg);
231
231
 
232
- await this.composeWith('pob:common:babel', {
232
+ this.composeWith('pob:common:babel', {
233
233
  updateOnly: this.options.updateOnly,
234
234
  testing: !!this.pobjson.testing,
235
235
  documentation: !!this.pobjson.documentation,
236
236
  fromPob: this.options.fromPob,
237
237
  onlyLatestLTS: false,
238
238
  });
239
- await this.composeWith('pob:common:transpiler', {
239
+ this.composeWith('pob:common:transpiler', {
240
240
  updateOnly: this.options.updateOnly,
241
241
  testing: !!this.pobjson.testing,
242
242
  documentation: !!this.pobjson.documentation,
@@ -245,7 +245,7 @@ export default class PobLibGenerator extends Generator {
245
245
  });
246
246
  }
247
247
 
248
- async default() {
248
+ default() {
249
249
  const pkg = this.fs.readJSON(this.destinationPath('package.json'));
250
250
  const babelEnvs = pkg.pob.babelEnvs || [];
251
251
 
@@ -255,7 +255,7 @@ export default class PobLibGenerator extends Generator {
255
255
  const browser =
256
256
  withBabel && babelEnvs.some((env) => env.target === 'browser');
257
257
 
258
- await this.composeWith('pob:common:typescript', {
258
+ this.composeWith('pob:common:typescript', {
259
259
  enable: withTypescript,
260
260
  isApp: false,
261
261
  dom: browser,
@@ -266,21 +266,23 @@ export default class PobLibGenerator extends Generator {
266
266
  onlyLatestLTS: false,
267
267
  });
268
268
 
269
- await this.composeWith('pob:common:husky', {});
269
+ this.composeWith('pob:common:husky', {});
270
270
 
271
- await this.composeWith('pob:common:remove-old-dependencies');
271
+ this.composeWith('pob:common:remove-old-dependencies');
272
272
 
273
273
  const enableReleasePlease =
274
274
  !inMonorepo && this.pobjson.testing && this.pobjson.testing.ci;
275
275
 
276
- await this.composeWith('pob:common:testing', {
276
+ this.composeWith('pob:common:testing', {
277
277
  enable: this.pobjson.testing,
278
278
  disableYarnGitCache: this.options.disableYarnGitCache,
279
279
  enableReleasePlease,
280
280
  testing: this.pobjson.testing,
281
281
  e2eTesting: false,
282
282
  runner: this.pobjson.testing
283
- ? this.pobjson.testing.runner || 'jest'
283
+ ? (inMonorepo
284
+ ? inMonorepo.pobMonorepoConfig.testRunner
285
+ : this.pobjson.testing.runner) || 'jest'
284
286
  : undefined,
285
287
  build: withBabel || withTypescript,
286
288
  typescript: withTypescript,
@@ -290,35 +292,38 @@ export default class PobLibGenerator extends Generator {
290
292
  packageManager: this.options.packageManager,
291
293
  isApp: false,
292
294
  splitCIJobs: false,
295
+ srcDirectory: withBabel || withTypescript ? 'src' : 'lib',
293
296
  });
294
297
 
295
298
  // must be after testing
296
- await this.composeWith('pob:common:format-lint', {
299
+ this.composeWith('pob:common:format-lint', {
297
300
  typescript: withTypescript,
298
301
  documentation:
299
302
  !!this.pobjson.documentation ||
300
303
  !!(this.pobjson.testing && this.pobjson.testing.codecov),
301
304
  testing: !!this.pobjson.testing,
302
- testRunner: this.pobjson.testing?.runner,
305
+ testRunner: inMonorepo
306
+ ? inMonorepo.pobMonorepoConfig.testRunner
307
+ : this.pobjson.testing?.runner,
303
308
  packageManager: this.options.packageManager,
304
309
  yarnNodeLinker: this.options.yarnNodeLinker,
305
310
  ignorePaths: withBabel || withTypescript ? '/dist' : '',
306
311
  });
307
312
 
308
- await this.composeWith('pob:lib:doc', {
313
+ this.composeWith('pob:lib:doc', {
309
314
  enabled: this.pobjson.documentation,
310
315
  testing: this.pobjson.testing,
311
316
  });
312
317
 
313
318
  // must be after doc, testing
314
- await this.composeWith('pob:lib:readme', {
319
+ this.composeWith('pob:lib:readme', {
315
320
  documentation: !!this.pobjson.documentation,
316
321
  testing: !!this.pobjson.testing,
317
322
  ci: this.pobjson.testing && this.pobjson.testing.ci,
318
323
  codecov: this.pobjson.testing && this.pobjson.testing.codecov,
319
324
  });
320
325
 
321
- await this.composeWith('pob:common:release', {
326
+ this.composeWith('pob:common:release', {
322
327
  enable: !inMonorepo && this.pobjson.testing,
323
328
  enablePublish: true,
324
329
  withBabel,
@@ -330,7 +335,7 @@ export default class PobLibGenerator extends Generator {
330
335
  updateOnly: this.options.updateOnly,
331
336
  });
332
337
 
333
- await this.composeWith('pob:core:vscode', {
338
+ this.composeWith('pob:core:vscode', {
334
339
  root: !inMonorepo,
335
340
  monorepo: false,
336
341
  packageManager: this.options.packageManager,
@@ -340,7 +345,7 @@ export default class PobLibGenerator extends Generator {
340
345
  });
341
346
 
342
347
  // must be after doc, testing
343
- await this.composeWith('pob:core:gitignore', {
348
+ this.composeWith('pob:core:gitignore', {
344
349
  root: !inMonorepo,
345
350
  withBabel: babelEnvs.length > 0,
346
351
  typescript: withTypescript,
@@ -348,14 +353,14 @@ export default class PobLibGenerator extends Generator {
348
353
  testing: !!this.pobjson.testing,
349
354
  });
350
355
 
351
- await this.composeWith('pob:core:npm', {
356
+ this.composeWith('pob:core:npm', {
352
357
  enable: !pkg.private,
353
358
  srcDirectory: withBabel || withTypescript ? 'src' : 'lib',
354
359
  distDirectory: withBabel || withTypescript ? 'dist' : '',
355
360
  });
356
361
  }
357
362
 
358
- async writing() {
363
+ writing() {
359
364
  // Re-read the content at this point because a composed generator might modify it.
360
365
  const pkg = this.fs.readJSON(this.destinationPath('package.json'));
361
366
 
@@ -420,6 +425,6 @@ export default class PobLibGenerator extends Generator {
420
425
  this.config.set('lib', pobjson);
421
426
  this.config.save();
422
427
 
423
- await this.composeWith('pob:core:sort-package');
428
+ this.composeWith('pob:core:sort-package');
424
429
  }
425
430
  }
@@ -201,7 +201,7 @@ export default class PobMonorepoGenerator extends Generator {
201
201
  this.config.delete('pob-config');
202
202
  }
203
203
 
204
- async default() {
204
+ default() {
205
205
  const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
206
206
 
207
207
  const packageNames = this.packageNames;
@@ -216,15 +216,16 @@ export default class PobMonorepoGenerator extends Generator {
216
216
  throw new Error('packages should not be empty');
217
217
  }
218
218
 
219
- await this.composeWith('pob:common:husky', {});
219
+ this.composeWith('pob:common:husky', {});
220
220
 
221
221
  const isYarnVersionEnabled = this.pobLernaConfig.ci;
222
222
 
223
223
  const splitCIJobs = this.packageNames.length > 8;
224
224
 
225
- await this.composeWith('pob:common:testing', {
225
+ this.composeWith('pob:common:testing', {
226
226
  monorepo: true,
227
227
  enable: this.pobLernaConfig.testing,
228
+ runner: this.pobLernaConfig.testRunner || 'jest',
228
229
  disableYarnGitCache: this.options.disableYarnGitCache,
229
230
  enableReleasePlease: false,
230
231
  enableYarnVersion: isYarnVersionEnabled,
@@ -241,7 +242,7 @@ export default class PobMonorepoGenerator extends Generator {
241
242
  splitCIJobs,
242
243
  });
243
244
 
244
- await this.composeWith('pob:common:format-lint', {
245
+ this.composeWith('pob:common:format-lint', {
245
246
  monorepo: true,
246
247
  documentation: this.pobLernaConfig.documentation,
247
248
  typescript: this.pobLernaConfig.typescript,
@@ -259,7 +260,7 @@ export default class PobMonorepoGenerator extends Generator {
259
260
  rootIgnorePaths: [],
260
261
  });
261
262
 
262
- await this.composeWith('pob:lib:doc', {
263
+ this.composeWith('pob:lib:doc', {
263
264
  enabled: this.pobLernaConfig.documentation,
264
265
  testing: this.pobLernaConfig.testing,
265
266
  packageNames: JSON.stringify(packageNames),
@@ -267,7 +268,7 @@ export default class PobMonorepoGenerator extends Generator {
267
268
  packageManager: this.options.packageManager,
268
269
  });
269
270
 
270
- await this.composeWith('pob:core:vscode', {
271
+ this.composeWith('pob:core:vscode', {
271
272
  root: true,
272
273
  monorepo: true,
273
274
  packageManager: this.options.packageManager,
@@ -279,16 +280,16 @@ export default class PobMonorepoGenerator extends Generator {
279
280
  });
280
281
 
281
282
  // Always add a gitignore, because npm publish uses it.
282
- await this.composeWith('pob:core:gitignore', {
283
+ this.composeWith('pob:core:gitignore', {
283
284
  root: true,
284
285
  typescript: this.pobLernaConfig.typescript,
285
286
  documentation: this.pobLernaConfig.documentation,
286
287
  testing: this.pobLernaConfig.testing,
287
288
  });
288
289
 
289
- await this.composeWith('pob:common:remove-old-dependencies');
290
+ this.composeWith('pob:common:remove-old-dependencies');
290
291
 
291
- await this.composeWith('pob:common:release', {
292
+ this.composeWith('pob:common:release', {
292
293
  enable: true,
293
294
  enablePublish: !this.options.isAppProject,
294
295
  withBabel: this.pobLernaConfig.typescript,
@@ -299,11 +300,12 @@ export default class PobMonorepoGenerator extends Generator {
299
300
  updateOnly: this.options.updateOnly,
300
301
  });
301
302
 
302
- await this.composeWith('pob:monorepo:typescript', {
303
+ this.composeWith('pob:monorepo:typescript', {
303
304
  enable: this.pobLernaConfig.typescript,
304
305
  isAppProject: this.options.isAppProject,
305
306
  packageNames: JSON.stringify(packageNames),
306
307
  packagePaths: JSON.stringify(packagePaths),
308
+ testRunner: this.pobLernaConfig.testRunner,
307
309
  });
308
310
 
309
311
  this.fs.writeJSON(this.destinationPath('package.json'), pkg);
@@ -315,7 +317,7 @@ export default class PobMonorepoGenerator extends Generator {
315
317
  }
316
318
  }
317
319
 
318
- async writing() {
320
+ writing() {
319
321
  if (!this.options.isAppProject) {
320
322
  const pkg = this.fs.readJSON(this.destinationPath('package.json'), {});
321
323
 
@@ -354,7 +356,7 @@ export default class PobMonorepoGenerator extends Generator {
354
356
  this.fs.writeJSON(this.destinationPath('package.json'), pkg);
355
357
  }
356
358
 
357
- await this.composeWith('pob:core:sort-package');
359
+ this.composeWith('pob:core:sort-package');
358
360
  }
359
361
 
360
362
  end() {
@@ -1,3 +1,4 @@
1
+ import { existsSync } from 'node:fs';
1
2
  import Generator from 'yeoman-generator';
2
3
  import * as packageUtils from '../../../utils/package.js';
3
4
  import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
@@ -27,6 +28,12 @@ export default class MonorepoTypescriptGenerator extends Generator {
27
28
  type: String,
28
29
  required: true,
29
30
  });
31
+
32
+ this.option('testRunner', {
33
+ type: String,
34
+ required: false,
35
+ default: 'jest',
36
+ });
30
37
  }
31
38
 
32
39
  writing() {
@@ -85,11 +92,13 @@ export default class MonorepoTypescriptGenerator extends Generator {
85
92
  const tsconfigPath = this.destinationPath('tsconfig.json');
86
93
  const tsconfigCheckPath = this.destinationPath('tsconfig.check.json');
87
94
  const tsconfigBuildPath = this.destinationPath('tsconfig.build.json');
95
+ const tsconfigTestPath = this.destinationPath('tsconfig.test.json');
88
96
 
89
97
  if (!this.options.enable) {
90
98
  this.fs.delete(tsconfigPath);
91
99
  this.fs.delete(tsconfigCheckPath);
92
100
  this.fs.delete(tsconfigBuildPath);
101
+ this.fs.delete(tsconfigTestPath);
93
102
  } else {
94
103
  const packagePaths = JSON.parse(this.options.packagePaths);
95
104
 
@@ -99,9 +108,24 @@ export default class MonorepoTypescriptGenerator extends Generator {
99
108
  tsconfigPath,
100
109
  {
101
110
  packagePaths,
111
+ tsConfigSuffix: false,
102
112
  },
103
113
  );
104
114
 
115
+ if (this.options.testRunner === 'node') {
116
+ copyAndFormatTpl(
117
+ this.fs,
118
+ this.templatePath('tsconfig.json.ejs'),
119
+ tsconfigTestPath,
120
+ {
121
+ packagePaths: packagePaths.filter((packagePath) =>
122
+ existsSync(`${packagePath}/tsconfig.test.json`),
123
+ ),
124
+ tsConfigSuffix: 'test',
125
+ },
126
+ );
127
+ }
128
+
105
129
  this.fs.delete(tsconfigCheckPath);
106
130
  this.fs.delete(tsconfigBuildPath);
107
131
  // if (this.options.isAppProject) {
@@ -2,7 +2,7 @@
2
2
  "files": [],
3
3
  "references": [
4
4
  <% packagePaths.forEach((packagePath, index) => { -%>
5
- { "path": "<%= packagePath %>/tsconfig.json" }<%= index === packagePaths.length -1 ? '' : ',' %>
5
+ { "path": "<%= packagePath %>/tsconfig<%= tsConfigSuffix ? `.${tsConfigSuffix}` : '' %>.json" }<%= index === packagePaths.length -1 ? '' : ',' %>
6
6
  <% }) -%>
7
7
  ]
8
8
  }
@@ -113,15 +113,15 @@ export default class PobBaseGenerator extends Generator {
113
113
  this.config.set('project', this.projectConfig);
114
114
  }
115
115
 
116
- async default() {
117
- await this.composeWith('pob:core:yarn', {
116
+ default() {
117
+ this.composeWith('pob:core:yarn', {
118
118
  type: this.projectConfig.type,
119
119
  enable: this.isRoot && this.projectConfig.packageManager === 'yarn',
120
120
  yarnNodeLinker: this.projectConfig.yarnNodeLinker,
121
121
  disableYarnGitCache: this.projectConfig.disableYarnGitCache,
122
122
  });
123
123
 
124
- await this.composeWith('pob:core:package', {
124
+ this.composeWith('pob:core:package', {
125
125
  updateOnly: this.options.updateOnly,
126
126
  private: this.isMonorepo,
127
127
  isMonorepo: this.isMonorepo,
@@ -130,13 +130,13 @@ export default class PobBaseGenerator extends Generator {
130
130
  });
131
131
 
132
132
  if (this.isMonorepo) {
133
- await this.composeWith('pob:monorepo:workspaces', {
133
+ this.composeWith('pob:monorepo:workspaces', {
134
134
  force: this.options.force,
135
135
  isAppProject: this.projectConfig.type === 'app',
136
136
  packageManager: this.projectConfig.packageManager,
137
137
  disableYarnGitCache: this.projectConfig.disableYarnGitCache,
138
138
  });
139
- await this.composeWith('pob:monorepo:lerna', {
139
+ this.composeWith('pob:monorepo:lerna', {
140
140
  force: this.options.force,
141
141
  isAppProject: this.projectConfig.type === 'app',
142
142
  packageManager: this.projectConfig.packageManager,
@@ -147,13 +147,13 @@ export default class PobBaseGenerator extends Generator {
147
147
  this.fs.delete('Makefile');
148
148
  this.fs.delete(this.destinationPath('.commitrc.js'));
149
149
 
150
- await this.composeWith('pob:core:editorconfig');
150
+ this.composeWith('pob:core:editorconfig');
151
151
 
152
- await this.composeWith('pob:core:clean', {
152
+ this.composeWith('pob:core:clean', {
153
153
  root: this.isRoot,
154
154
  });
155
155
 
156
- await this.composeWith('pob:core:renovate', {
156
+ this.composeWith('pob:core:renovate', {
157
157
  updateOnly: this.options.updateOnly,
158
158
  app: this.projectConfig.type === 'app',
159
159
  });
@@ -167,7 +167,7 @@ export default class PobBaseGenerator extends Generator {
167
167
  if (!this.hasAncestor) {
168
168
  const splitCIJobs =
169
169
  inMonorepo && inMonorepo.pobMonorepoConfig?.packageNames.length > 8;
170
- await this.composeWith('pob:core:git', {
170
+ this.composeWith('pob:core:git', {
171
171
  onlyLatestLTS,
172
172
  splitCIJobs,
173
173
  });
@@ -192,7 +192,7 @@ export default class PobBaseGenerator extends Generator {
192
192
  }
193
193
 
194
194
  if (this.isMonorepo) {
195
- await this.composeWith(
195
+ this.composeWith(
196
196
  // pob:monorepo <= for searching PobMonorepoGenerator.js
197
197
  fileURLToPath(
198
198
  new URL('../monorepo/PobMonorepoGenerator.js', import.meta.url),
@@ -209,7 +209,7 @@ export default class PobBaseGenerator extends Generator {
209
209
  } else {
210
210
  switch (this.projectConfig.type) {
211
211
  case 'lib':
212
- await this.composeWith('pob:lib', {
212
+ this.composeWith('pob:lib', {
213
213
  monorepo: this.isMonorepo,
214
214
  isRoot: this.isRoot,
215
215
  disableYarnGitCache: this.projectConfig.disableYarnGitCache,
@@ -220,7 +220,7 @@ export default class PobBaseGenerator extends Generator {
220
220
  });
221
221
  break;
222
222
  case 'app':
223
- await this.composeWith('pob:app', {
223
+ this.composeWith('pob:app', {
224
224
  monorepo: this.isMonorepo,
225
225
  isRoot: this.isRoot,
226
226
  disableYarnGitCache: this.projectConfig.disableYarnGitCache,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "18.1.1",
3
+ "version": "18.3.0",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
@@ -39,16 +39,16 @@
39
39
  "pob": {},
40
40
  "prettier": "@pob/root/prettier-config",
41
41
  "dependencies": {
42
- "@pob/eslint-config": "53.0.0",
43
- "@pob/eslint-config-typescript": "53.1.0",
44
- "@pob/eslint-config-typescript-react": "53.0.0",
42
+ "@pob/eslint-config": "54.0.0",
43
+ "@pob/eslint-config-typescript": "54.0.0",
44
+ "@pob/eslint-config-typescript-react": "54.0.0",
45
45
  "@pob/sort-eslint-config": "5.2.1",
46
46
  "@pob/sort-object": "6.2.1",
47
47
  "@pob/sort-pkg": "7.0.0",
48
48
  "@types/inquirer": "9.0.7",
49
- "@yarnpkg/cli": "4.0.2",
50
- "@yarnpkg/core": "4.0.2",
51
- "@yarnpkg/fslib": "3.0.1",
49
+ "@yarnpkg/cli": "4.1.0",
50
+ "@yarnpkg/core": "4.0.3",
51
+ "@yarnpkg/fslib": "3.0.2",
52
52
  "@yeoman/types": "1.1.2",
53
53
  "eslint": "8.56.0",
54
54
  "findup-sync": "^5.0.0",
@@ -62,15 +62,15 @@
62
62
  "mem-fs-editor": "11.0.0",
63
63
  "minimist": "1.2.8",
64
64
  "parse-author": "2.0.0",
65
- "pob-dependencies": "11.0.0",
65
+ "pob-dependencies": "11.1.0",
66
66
  "prettier": "2.8.8",
67
- "semver": "7.5.4",
67
+ "semver": "7.6.0",
68
68
  "validate-npm-package-name": "^5.0.0",
69
- "yarn-workspace-utils": "3.1.1",
70
- "yeoman-environment": "4.1.3",
69
+ "yarn-workspace-utils": "3.2.0",
70
+ "yeoman-environment": "4.3.0",
71
71
  "yeoman-generator": "7.1.1"
72
72
  },
73
73
  "devDependencies": {
74
- "@pob/root": "9.0.0"
74
+ "@pob/root": "9.2.0"
75
75
  }
76
76
  }