pob 17.3.0 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/lib/generators/app/PobAppGenerator.js +2 -0
- package/lib/generators/common/format-lint/CommonLintGenerator.js +11 -1
- package/lib/generators/common/format-lint/updateEslintConfig.js +17 -6
- package/lib/generators/common/testing/CommonTestingGenerator.js +40 -5
- package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +62 -60
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +15 -1
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +11 -3
- package/lib/generators/core/ci/CoreCIGenerator.js +7 -0
- package/lib/generators/core/ci/templates/github-action-documentation-workflow.yml.ejs +3 -2
- package/lib/generators/core/ci/templates/github-action-push-workflow.yml.ejs +1 -1
- package/lib/generators/lib/PobLibGenerator.js +39 -35
- package/lib/generators/monorepo/PobMonorepoGenerator.js +1 -0
- package/package.json +13 -13
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,42 @@
|
|
|
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.0.0](https://github.com/christophehurpeau/pob/compare/pob@17.4.0...pob@18.0.0) (2023-12-29)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* improve tsconfigs ([9112fb1](https://github.com/christophehurpeau/pob/commit/9112fb13dd1ed9ab5191a39c92140a0d8653ff3a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* fix documentation lcov ([ff6166f](https://github.com/christophehurpeau/pob/commit/ff6166f77ad4faf6039d0dc69337ac6e20fa10af))
|
|
17
|
+
* fix experimental-test-coverage option ([d598efd](https://github.com/christophehurpeau/pob/commit/d598efd3818cd1e26dfb34f4f636bc2469400fe7))
|
|
18
|
+
* fix test override existing detection ([744d556](https://github.com/christophehurpeau/pob/commit/744d5569541d27c5c4beee84a620f0e40f369b29))
|
|
19
|
+
* **pob:** fix node test runner coverage ([e9ba7b1](https://github.com/christophehurpeau/pob/commit/e9ba7b1f035bb318fe9e20cddd93df295a4df1d1))
|
|
20
|
+
* **pob:** fix test override existing detection ([5916c16](https://github.com/christophehurpeau/pob/commit/5916c16162a28e333410315d8d82fbf3bea2f5cc))
|
|
21
|
+
* **pob:** update test runner ([29f7f0c](https://github.com/christophehurpeau/pob/commit/29f7f0c539401fcb9086fa913beb7935da7a8857))
|
|
22
|
+
|
|
23
|
+
Version bump for dependency: sort-eslint-config
|
|
24
|
+
Version bump for dependency: sort-object
|
|
25
|
+
Version bump for dependency: sort-pkg
|
|
26
|
+
Version bump for dependency: yarn-workspace-utils
|
|
27
|
+
Version bump for dependency: root
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## [17.4.0](https://github.com/christophehurpeau/pob/compare/pob@17.3.0...pob@17.4.0) (2023-12-28)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
* **deps:** update @pob/eslint-config to v53 (major) ([#1886](https://github.com/christophehurpeau/pob/issues/1886)) ([de65f51](https://github.com/christophehurpeau/pob/commit/de65f51549afac0be03a124dba04dbb3a76f1b4e))
|
|
36
|
+
* **deps:** update dependency @pob/eslint-config-typescript to v53.1.0 ([#1887](https://github.com/christophehurpeau/pob/issues/1887)) ([cca20c4](https://github.com/christophehurpeau/pob/commit/cca20c4e44aafdf05ba7928e02b290d2445d00cb))
|
|
37
|
+
* keep configuring ts-node and typescript for ts without babel ([8483dc0](https://github.com/christophehurpeau/pob/commit/8483dc080170befe5a3be3e4dfc8fe7d8e74d0ae))
|
|
38
|
+
|
|
39
|
+
Version bump for dependency: yarn-workspace-utils
|
|
40
|
+
|
|
41
|
+
|
|
6
42
|
## [17.3.0](https://github.com/christophehurpeau/pob/compare/pob@17.2.1...pob@17.3.0) (2023-12-28)
|
|
7
43
|
|
|
8
44
|
|
|
@@ -193,6 +193,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
193
193
|
enable: typescript,
|
|
194
194
|
isApp: true,
|
|
195
195
|
isAppLibrary,
|
|
196
|
+
nextConfig: this.appConfig.type === 'next.js',
|
|
196
197
|
// nextjs now supports src
|
|
197
198
|
rootDir: this.appConfig.type === 'expo' ? '.' : srcDirectory,
|
|
198
199
|
srcDirectory,
|
|
@@ -265,6 +266,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
265
266
|
isApp: true,
|
|
266
267
|
documentation: false,
|
|
267
268
|
testing: this.appConfig.testing,
|
|
269
|
+
testRunner: this.appConfig.testRunner,
|
|
268
270
|
babel,
|
|
269
271
|
typescript,
|
|
270
272
|
node,
|
|
@@ -45,6 +45,12 @@ export default class CommonLintGenerator extends Generator {
|
|
|
45
45
|
required: true,
|
|
46
46
|
desc: 'Testing enabled',
|
|
47
47
|
});
|
|
48
|
+
this.option('testRunner', {
|
|
49
|
+
type: String,
|
|
50
|
+
required: false,
|
|
51
|
+
default: 'jest',
|
|
52
|
+
desc: 'test runner: jest | node',
|
|
53
|
+
});
|
|
48
54
|
|
|
49
55
|
this.option('typescript', {
|
|
50
56
|
type: Boolean,
|
|
@@ -402,7 +408,10 @@ export default class CommonLintGenerator extends Generator {
|
|
|
402
408
|
this.options.testing || globalTesting
|
|
403
409
|
? {
|
|
404
410
|
files: [`**/*.test.${ext}`, `__tests__/**/*.${ext}`],
|
|
405
|
-
|
|
411
|
+
...(this.options.testRunner == null ||
|
|
412
|
+
this.options.testRunner === 'jest'
|
|
413
|
+
? { env: { jest: true } }
|
|
414
|
+
: {}),
|
|
406
415
|
rules: {
|
|
407
416
|
'import/no-extraneous-dependencies': [
|
|
408
417
|
'error',
|
|
@@ -419,6 +428,7 @@ export default class CommonLintGenerator extends Generator {
|
|
|
419
428
|
|
|
420
429
|
if (useTypescript) {
|
|
421
430
|
testsOverride.extends = ['@pob/eslint-config-typescript/test'];
|
|
431
|
+
delete testsOverride.rules['import/no-extraneous-dependencies'];
|
|
422
432
|
}
|
|
423
433
|
}
|
|
424
434
|
|
|
@@ -4,7 +4,9 @@ function updateOverrides(config, testsOverride) {
|
|
|
4
4
|
const existingTestsOverrideIndex = !config.overrides
|
|
5
5
|
? -1
|
|
6
6
|
: config.overrides.findIndex(
|
|
7
|
-
|
|
7
|
+
testsOverride.env?.jest
|
|
8
|
+
? (override) => override.env && override.env.jest
|
|
9
|
+
: (override) => override.extends.includes(testsOverride.extends[0]),
|
|
8
10
|
);
|
|
9
11
|
if (!testsOverride) {
|
|
10
12
|
if (existingTestsOverrideIndex !== -1) {
|
|
@@ -14,12 +16,21 @@ function updateOverrides(config, testsOverride) {
|
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
18
|
} else {
|
|
17
|
-
|
|
19
|
+
if (testsOverride.rules && Object.keys(testsOverride.rules).length === 0) {
|
|
20
|
+
delete testsOverride.rules;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
if (existingTestsOverrideIndex !== -1) {
|
|
19
|
-
|
|
20
|
-
config.overrides[existingTestsOverrideIndex]
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
const existingTestsOverride =
|
|
25
|
+
config.overrides[existingTestsOverrideIndex];
|
|
26
|
+
Object.assign(existingTestsOverride, testsOverride);
|
|
27
|
+
|
|
28
|
+
if (
|
|
29
|
+
existingTestsOverride.rules &&
|
|
30
|
+
Object.keys(existingTestsOverride.rules).length === 0
|
|
31
|
+
) {
|
|
32
|
+
delete existingTestsOverride.rules;
|
|
33
|
+
}
|
|
23
34
|
} else {
|
|
24
35
|
if (!config.overrides) config.overrides = [];
|
|
25
36
|
config.overrides.push(testsOverride);
|
|
@@ -123,6 +123,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
123
123
|
enableYarnVersion: this.options.enableYarnVersion,
|
|
124
124
|
disableYarnGitCache: this.options.disableYarnGitCache,
|
|
125
125
|
testing: this.options.enable,
|
|
126
|
+
testRunner: this.options.runner,
|
|
126
127
|
e2eTesting: this.options.e2eTesting,
|
|
127
128
|
build: this.options.build,
|
|
128
129
|
typescript: this.options.typescript,
|
|
@@ -192,7 +193,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
192
193
|
case 'tsimp':
|
|
193
194
|
return '--import=tsimp/import';
|
|
194
195
|
case 'ts-node':
|
|
195
|
-
return '--loader=ts-node/esm';
|
|
196
|
+
return '--loader=ts-node/esm --experimental-specifier-resolution=node';
|
|
196
197
|
case '@swc-node/register':
|
|
197
198
|
return '--import=@swc-node/register/esm';
|
|
198
199
|
}
|
|
@@ -207,6 +208,8 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
207
208
|
|
|
208
209
|
const createTestCommand = ({
|
|
209
210
|
coverage,
|
|
211
|
+
coverageLcov,
|
|
212
|
+
coverageJson,
|
|
210
213
|
watch,
|
|
211
214
|
shouldUseExperimentalVmModules,
|
|
212
215
|
}) => {
|
|
@@ -217,8 +220,14 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
217
220
|
? 'NODE_OPTIONS=--experimental-vm-modules '
|
|
218
221
|
: ''
|
|
219
222
|
}jest${watch ? ' --watch' : ''}${
|
|
220
|
-
coverage
|
|
221
|
-
?
|
|
223
|
+
coverage || coverageJson || coverageLcov
|
|
224
|
+
? ` --coverage ${
|
|
225
|
+
coverageLcov
|
|
226
|
+
? '--coverageReporters=lcov'
|
|
227
|
+
: `--coverageReporters=json${
|
|
228
|
+
coverageJson ? '' : ' --coverageReporters=text'
|
|
229
|
+
}`
|
|
230
|
+
}`
|
|
222
231
|
: ''
|
|
223
232
|
}`;
|
|
224
233
|
}
|
|
@@ -227,8 +236,16 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
227
236
|
tsTestUtil === 'ts-node'
|
|
228
237
|
? 'TS_NODE_PROJECT=tsconfig.test.json '
|
|
229
238
|
: ''
|
|
230
|
-
}
|
|
231
|
-
coverage
|
|
239
|
+
}${
|
|
240
|
+
coverage || coverageJson || coverageLcov
|
|
241
|
+
? `npx c8${
|
|
242
|
+
coverageLcov || coverageJson
|
|
243
|
+
? ` --reporter=${coverageJson ? 'json' : 'lcov'}`
|
|
244
|
+
: ''
|
|
245
|
+
} --src ./${this.options.srcDirectory} `
|
|
246
|
+
: ''
|
|
247
|
+
}node ${
|
|
248
|
+
this.options.typescript ? `${tsTestLoaderOption} ` : ''
|
|
232
249
|
}--test ${this.options.srcDirectory}/${
|
|
233
250
|
this.options.typescript ? '**/*.test.ts' : '**/*.test.js'
|
|
234
251
|
}`;
|
|
@@ -251,6 +268,8 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
251
268
|
delete pkg.scripts['generate:test-coverage'];
|
|
252
269
|
delete pkg.scripts['test:watch'];
|
|
253
270
|
delete pkg.scripts['test:coverage'];
|
|
271
|
+
delete pkg.scripts['test:coverage:json'];
|
|
272
|
+
delete pkg.scripts['test:coverage:lcov'];
|
|
254
273
|
}
|
|
255
274
|
|
|
256
275
|
writeAndFormatJson(this.fs, this.destinationPath('package.json'), pkg);
|
|
@@ -282,6 +301,14 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
282
301
|
shouldUseExperimentalVmModules,
|
|
283
302
|
coverage: true,
|
|
284
303
|
}),
|
|
304
|
+
'test:coverage:lcov': createTestCommand({
|
|
305
|
+
shouldUseExperimentalVmModules,
|
|
306
|
+
coverageLcov: true,
|
|
307
|
+
}),
|
|
308
|
+
'test:coverage:json': createTestCommand({
|
|
309
|
+
shouldUseExperimentalVmModules,
|
|
310
|
+
coverageJson: true,
|
|
311
|
+
}),
|
|
285
312
|
});
|
|
286
313
|
|
|
287
314
|
if (isJestRunner) {
|
|
@@ -355,6 +382,14 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
355
382
|
shouldUseExperimentalVmModules,
|
|
356
383
|
coverage: true,
|
|
357
384
|
}),
|
|
385
|
+
'test:coverage:lcov': createTestCommand({
|
|
386
|
+
shouldUseExperimentalVmModules,
|
|
387
|
+
coverageLcov: true,
|
|
388
|
+
}),
|
|
389
|
+
'test:coverage:json': createTestCommand({
|
|
390
|
+
shouldUseExperimentalVmModules,
|
|
391
|
+
coverageJson: true,
|
|
392
|
+
}),
|
|
358
393
|
});
|
|
359
394
|
|
|
360
395
|
if (this.options.runner === 'jest') {
|
|
@@ -264,7 +264,15 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
264
264
|
delete pkg['browser-dev'];
|
|
265
265
|
delete pkg['module-dev'];
|
|
266
266
|
|
|
267
|
-
const
|
|
267
|
+
const envs = pkg.pob.babelEnvs ||
|
|
268
|
+
pkg.pob.envs || [
|
|
269
|
+
{
|
|
270
|
+
target: 'node',
|
|
271
|
+
version: '18',
|
|
272
|
+
},
|
|
273
|
+
];
|
|
274
|
+
|
|
275
|
+
const esAllBrowserEnv = envs.find(
|
|
268
276
|
(env) =>
|
|
269
277
|
env.target === 'browser' &&
|
|
270
278
|
env.version === undefined &&
|
|
@@ -298,7 +306,7 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
298
306
|
const isBrowserOnly =
|
|
299
307
|
withBabel &&
|
|
300
308
|
entry === 'browser' &&
|
|
301
|
-
(
|
|
309
|
+
(envs?.every((env) => env.target === 'browser') ||
|
|
302
310
|
(this.entries.length === 2 && this.entries.includes('index')));
|
|
303
311
|
const entryDistName = isBrowserOnly ? 'index' : entry;
|
|
304
312
|
const exportName = entry === 'index' ? '.' : `./${entry}`;
|
|
@@ -313,73 +321,67 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
313
321
|
};
|
|
314
322
|
|
|
315
323
|
const defaultNodeEnv =
|
|
316
|
-
withBabel
|
|
324
|
+
withBabel || withTypescript
|
|
325
|
+
? envs.find((env) => env.target === 'node')
|
|
326
|
+
: undefined;
|
|
317
327
|
|
|
318
328
|
const defaultNodeEnvVersion = defaultNodeEnv && defaultNodeEnv.version;
|
|
319
329
|
|
|
320
|
-
|
|
321
|
-
if (
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const exportTarget = {};
|
|
331
|
-
|
|
332
|
-
if (target === 'node') {
|
|
333
|
-
const cjsExt = pkg.type === 'module' ? 'cjs' : 'cjs.js';
|
|
334
|
-
if (!formats || formats.includes('es')) {
|
|
335
|
-
exportTarget.import = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.mjs`;
|
|
336
|
-
|
|
337
|
-
if (formats && formats.includes('cjs')) {
|
|
338
|
-
exportTarget.require = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
|
|
339
|
-
}
|
|
340
|
-
} else if (formats && formats.includes('cjs')) {
|
|
341
|
-
exportTarget.default = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
|
|
342
|
-
}
|
|
343
|
-
// eslint: https://github.com/benmosher/eslint-plugin-import/issues/2132
|
|
344
|
-
// jest: https://github.com/facebook/jest/issues/9771
|
|
345
|
-
if (!pkg.main && exportName === '.') {
|
|
346
|
-
pkg.main =
|
|
347
|
-
pkg.type === 'module'
|
|
348
|
-
? exportTarget.import
|
|
349
|
-
: exportTarget.default ||
|
|
350
|
-
exportTarget.require ||
|
|
351
|
-
exportTarget.import;
|
|
352
|
-
}
|
|
353
|
-
} else if (target === 'browser') {
|
|
354
|
-
if (!formats || formats.includes('es')) {
|
|
355
|
-
exportTarget.import = `./${
|
|
356
|
-
this.options.buildDirectory
|
|
357
|
-
}/${entryDistName}-${target}${version || ''}.es.js`;
|
|
358
|
-
}
|
|
330
|
+
envs.forEach(({ target, version, formats }) => {
|
|
331
|
+
if (target === 'node' && entry === 'browser') return;
|
|
332
|
+
|
|
333
|
+
const exportTarget = {};
|
|
334
|
+
|
|
335
|
+
if (target === 'node') {
|
|
336
|
+
const cjsExt = pkg.type === 'module' ? 'cjs' : 'cjs.js';
|
|
337
|
+
if (!formats || formats.includes('es')) {
|
|
338
|
+
exportTarget.import = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.mjs`;
|
|
359
339
|
|
|
360
340
|
if (formats && formats.includes('cjs')) {
|
|
361
|
-
exportTarget.require = `./${
|
|
362
|
-
this.options.buildDirectory
|
|
363
|
-
}/index-${target}${version || ''}.cjs.js`;
|
|
341
|
+
exportTarget.require = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
|
|
364
342
|
}
|
|
343
|
+
} else if (formats && formats.includes('cjs')) {
|
|
344
|
+
exportTarget.default = `./${this.options.buildDirectory}/${entryDistName}-${target}${version}.${cjsExt}`;
|
|
345
|
+
}
|
|
346
|
+
// eslint: https://github.com/benmosher/eslint-plugin-import/issues/2132
|
|
347
|
+
// jest: https://github.com/facebook/jest/issues/9771
|
|
348
|
+
if (!pkg.main && exportName === '.') {
|
|
349
|
+
pkg.main =
|
|
350
|
+
pkg.type === 'module'
|
|
351
|
+
? exportTarget.import
|
|
352
|
+
: exportTarget.default ||
|
|
353
|
+
exportTarget.require ||
|
|
354
|
+
exportTarget.import;
|
|
355
|
+
}
|
|
356
|
+
} else if (target === 'browser') {
|
|
357
|
+
if (!formats || formats.includes('es')) {
|
|
358
|
+
exportTarget.import = `./${
|
|
359
|
+
this.options.buildDirectory
|
|
360
|
+
}/${entryDistName}-${target}${version || ''}.es.js`;
|
|
365
361
|
}
|
|
366
362
|
|
|
367
|
-
if (
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
targets[target] = {
|
|
372
|
-
...targets[target],
|
|
373
|
-
...exportTarget,
|
|
374
|
-
};
|
|
375
|
-
} else {
|
|
376
|
-
targets[target] = {
|
|
377
|
-
[`${target}:${version}`]: exportTarget,
|
|
378
|
-
...targets[target],
|
|
379
|
-
};
|
|
363
|
+
if (formats && formats.includes('cjs')) {
|
|
364
|
+
exportTarget.require = `./${
|
|
365
|
+
this.options.buildDirectory
|
|
366
|
+
}/index-${target}${version || ''}.cjs.js`;
|
|
380
367
|
}
|
|
381
|
-
}
|
|
382
|
-
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
if (
|
|
371
|
+
!version ||
|
|
372
|
+
(target === 'node' && version === defaultNodeEnvVersion)
|
|
373
|
+
) {
|
|
374
|
+
targets[target] = {
|
|
375
|
+
...targets[target],
|
|
376
|
+
...exportTarget,
|
|
377
|
+
};
|
|
378
|
+
} else {
|
|
379
|
+
targets[target] = {
|
|
380
|
+
[`${target}:${version}`]: exportTarget,
|
|
381
|
+
...targets[target],
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
});
|
|
383
385
|
|
|
384
386
|
pkg.exports[exportName] = targets;
|
|
385
387
|
});
|
|
@@ -90,6 +90,10 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
90
90
|
default: '',
|
|
91
91
|
desc: 'typescript plugins',
|
|
92
92
|
});
|
|
93
|
+
this.option('nextConfig', {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
default: false,
|
|
96
|
+
});
|
|
93
97
|
this.option('additionalIncludes', {
|
|
94
98
|
type: String,
|
|
95
99
|
default: '',
|
|
@@ -125,7 +129,12 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
125
129
|
}
|
|
126
130
|
if (withTypescript) {
|
|
127
131
|
const nodeVersion = this.options.onlyLatestLTS ? '20' : '18';
|
|
128
|
-
const envs = pkg.pob?.envs
|
|
132
|
+
const envs = pkg.pob?.envs || [
|
|
133
|
+
{
|
|
134
|
+
target: 'node',
|
|
135
|
+
version: '18',
|
|
136
|
+
},
|
|
137
|
+
];
|
|
129
138
|
if (pkg.pob.rollup === false) {
|
|
130
139
|
return [`@pob/root/tsconfigs/targets/node-${nodeVersion}.json`];
|
|
131
140
|
}
|
|
@@ -136,6 +145,10 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
136
145
|
}
|
|
137
146
|
return ['@pob/root/tsconfigs/targets/rollup-es2015.json'];
|
|
138
147
|
}
|
|
148
|
+
|
|
149
|
+
if (this.options.dom) {
|
|
150
|
+
return ['@pob/root/tsconfigs/targets/webpack.json'];
|
|
151
|
+
}
|
|
139
152
|
return [];
|
|
140
153
|
})();
|
|
141
154
|
|
|
@@ -253,6 +266,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
253
266
|
srcDirectory: this.options.srcDirectory || this.options.rootDir,
|
|
254
267
|
jsx,
|
|
255
268
|
jsxPreserve: this.options.jsxPreserve,
|
|
269
|
+
nextConfig: this.options.nextConfig,
|
|
256
270
|
composite,
|
|
257
271
|
dom,
|
|
258
272
|
baseUrl: this.options.baseUrl,
|
|
@@ -62,6 +62,17 @@
|
|
|
62
62
|
<% if(forceAllowJs) { -%>
|
|
63
63
|
"allowJs": true,
|
|
64
64
|
<% } -%>
|
|
65
|
+
<% if(nextConfig) { -%>
|
|
66
|
+
"strictNullChecks": true,
|
|
67
|
+
"module": "esnext",
|
|
68
|
+
"moduleResolution": "node",
|
|
69
|
+
"lib": ["dom", "esnext"],
|
|
70
|
+
"esModuleInterop": true,
|
|
71
|
+
"isolatedModules": true,
|
|
72
|
+
<% } -%>
|
|
73
|
+
<% if (resolveJsonModule) { -%>
|
|
74
|
+
"resolveJsonModule": <%= resolveJsonModule %>,
|
|
75
|
+
<% } -%>
|
|
65
76
|
<% if(plugins && plugins.length > 0) { -%>
|
|
66
77
|
"plugins": [<%- plugins.map((pluginName) => `{"name": "${pluginName}"}`).join(', ') %>],
|
|
67
78
|
<% } -%>
|
|
@@ -69,9 +80,6 @@
|
|
|
69
80
|
<% if(!presets || presets.length === 0) { -%>
|
|
70
81
|
/* Module Resolution Options */
|
|
71
82
|
"moduleResolution": "bundler" /* Specify module resolution strategy. */,
|
|
72
|
-
<% if (resolveJsonModule) { -%>
|
|
73
|
-
"resolveJsonModule": <%= resolveJsonModule %>,
|
|
74
|
-
<% } -%>
|
|
75
83
|
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
76
84
|
"esModuleInterop": true<% if (monorepoPackageSrcPaths) { %>,<% } %> /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
77
85
|
<% } -%>
|
|
@@ -45,6 +45,12 @@ export default class CoreCIGenerator extends Generator {
|
|
|
45
45
|
default: true,
|
|
46
46
|
desc: 'enable testing',
|
|
47
47
|
});
|
|
48
|
+
this.option('testRunner', {
|
|
49
|
+
type: String,
|
|
50
|
+
required: false,
|
|
51
|
+
default: 'jest',
|
|
52
|
+
desc: 'test runner: jest | node',
|
|
53
|
+
});
|
|
48
54
|
|
|
49
55
|
this.option('e2eTesting', {
|
|
50
56
|
type: String,
|
|
@@ -204,6 +210,7 @@ export default class CoreCIGenerator extends Generator {
|
|
|
204
210
|
packageManager: this.options.packageManager,
|
|
205
211
|
disableYarnGitCache: this.options.disableYarnGitCache,
|
|
206
212
|
testing: this.options.testing,
|
|
213
|
+
testRunner: this.options.testRunner,
|
|
207
214
|
typedoc: this.options.documentation && this.options.typescript,
|
|
208
215
|
},
|
|
209
216
|
);
|
|
@@ -32,9 +32,10 @@ jobs:
|
|
|
32
32
|
run: yarn typedoc --tsconfig tsconfig.doc.json
|
|
33
33
|
<% } -%>
|
|
34
34
|
|
|
35
|
-
<% if (testing) { -%>
|
|
35
|
+
<% if (testing && testRunner === 'jest') { -%>
|
|
36
|
+
|
|
36
37
|
- name: Generate Coverage
|
|
37
|
-
run: yarn test
|
|
38
|
+
run: yarn test:coverage:lcov --coverageDirectory=docs/coverage/
|
|
38
39
|
<% } -%>
|
|
39
40
|
|
|
40
41
|
- name: Create nojekyll
|
|
@@ -162,22 +162,49 @@ export default class PobLibGenerator extends Generator {
|
|
|
162
162
|
// documentation
|
|
163
163
|
if (inMonorepo && !inMonorepo.root) {
|
|
164
164
|
this.pobjson.documentation = false;
|
|
165
|
-
} else
|
|
165
|
+
} else {
|
|
166
166
|
const answers = await this.prompt([
|
|
167
167
|
{
|
|
168
168
|
type: 'confirm',
|
|
169
169
|
name: 'documentation',
|
|
170
170
|
message: 'Would you like documentation (manually generated) ?',
|
|
171
|
+
when: !this.updateOnly || this.pobjson.documentation === undefined,
|
|
171
172
|
default:
|
|
172
173
|
this.pobjson.documentation != null
|
|
173
174
|
? this.pobjson.documentation
|
|
174
175
|
: true,
|
|
175
176
|
},
|
|
177
|
+
]);
|
|
178
|
+
|
|
179
|
+
Object.assign(this.pobjson, answers);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// testing
|
|
183
|
+
if (!this.updateOnly || this.pobjson.testing === undefined) {
|
|
184
|
+
const { testing } = await this.prompt({
|
|
185
|
+
type: 'confirm',
|
|
186
|
+
name: 'testing',
|
|
187
|
+
message: 'Would you like testing ?',
|
|
188
|
+
default: this.pobjson.testing || false,
|
|
189
|
+
});
|
|
190
|
+
this.pobjson.testing = !testing ? false : this.pobjson.testing || {};
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (this.pobjson.testing && !(inMonorepo || inMonorepo.root)) {
|
|
194
|
+
const testingPrompts = await this.prompt([
|
|
195
|
+
{
|
|
196
|
+
type: 'confirm',
|
|
197
|
+
name: 'ci',
|
|
198
|
+
message: 'Would you like ci with github actions ?',
|
|
199
|
+
when: !this.updateOnly || this.pobjson.testing?.ci === undefined,
|
|
200
|
+
default: this.pobjson.testing.ci !== false,
|
|
201
|
+
},
|
|
176
202
|
{
|
|
177
|
-
type: '
|
|
203
|
+
type: 'list',
|
|
178
204
|
name: 'runner',
|
|
179
205
|
message: 'Testing runner ?',
|
|
180
|
-
|
|
206
|
+
when: !this.updateOnly || this.pobjson.testing?.runner === undefined,
|
|
207
|
+
default: this.pobjson.testing?.runner || 'jest',
|
|
181
208
|
choices: [
|
|
182
209
|
{
|
|
183
210
|
name: 'Jest',
|
|
@@ -189,39 +216,15 @@ export default class PobLibGenerator extends Generator {
|
|
|
189
216
|
},
|
|
190
217
|
],
|
|
191
218
|
},
|
|
219
|
+
{
|
|
220
|
+
type: 'confirm',
|
|
221
|
+
name: 'codecov',
|
|
222
|
+
message: 'Would you like codecov ?',
|
|
223
|
+
when: !this.updateOnly || this.pobjson.testing?.codecov === undefined,
|
|
224
|
+
default: this.pobjson.testing.codecov === true,
|
|
225
|
+
},
|
|
192
226
|
]);
|
|
193
|
-
|
|
194
|
-
this.pobjson.documentation = !!answers.documentation;
|
|
195
|
-
this.pobjson.runner = !!answers.runner;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
// testing
|
|
199
|
-
if (!this.updateOnly) {
|
|
200
|
-
const { testing } = await this.prompt({
|
|
201
|
-
type: 'confirm',
|
|
202
|
-
name: 'testing',
|
|
203
|
-
message: 'Would you like testing ?',
|
|
204
|
-
default: this.pobjson.testing || false,
|
|
205
|
-
});
|
|
206
|
-
this.pobjson.testing = !testing ? false : this.pobjson.testing || {};
|
|
207
|
-
|
|
208
|
-
if (this.pobjson.testing && !(inMonorepo || inMonorepo.root)) {
|
|
209
|
-
const testingPrompts = await this.prompt([
|
|
210
|
-
{
|
|
211
|
-
type: 'confirm',
|
|
212
|
-
name: 'ci',
|
|
213
|
-
message: 'Would you like ci with github actions ?',
|
|
214
|
-
default: this.pobjson.testing.ci !== false,
|
|
215
|
-
},
|
|
216
|
-
{
|
|
217
|
-
type: 'confirm',
|
|
218
|
-
name: 'codecov',
|
|
219
|
-
message: 'Would you like codecov ?',
|
|
220
|
-
default: this.pobjson.testing.codecov === true,
|
|
221
|
-
},
|
|
222
|
-
]);
|
|
223
|
-
Object.assign(this.pobjson.testing, testingPrompts);
|
|
224
|
-
}
|
|
227
|
+
Object.assign(this.pobjson.testing, testingPrompts);
|
|
225
228
|
}
|
|
226
229
|
|
|
227
230
|
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
@@ -296,6 +299,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
296
299
|
!!this.pobjson.documentation ||
|
|
297
300
|
!!(this.pobjson.testing && this.pobjson.testing.codecov),
|
|
298
301
|
testing: !!this.pobjson.testing,
|
|
302
|
+
testRunner: this.pobjson.testing?.runner,
|
|
299
303
|
packageManager: this.options.packageManager,
|
|
300
304
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
301
305
|
ignorePaths: withBabel || withTypescript ? '/dist' : '',
|
|
@@ -246,6 +246,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
246
246
|
documentation: this.pobLernaConfig.documentation,
|
|
247
247
|
typescript: this.pobLernaConfig.typescript,
|
|
248
248
|
testing: this.pobLernaConfig.testing,
|
|
249
|
+
testRunner: this.pobLernaConfig.testRunner,
|
|
249
250
|
packageManager: this.options.packageManager,
|
|
250
251
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
251
252
|
appTypes: JSON.stringify(getAppTypes(this.packageConfigs)),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18.12.0"
|
|
22
22
|
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"bin": "./lib/pob.js",
|
|
23
25
|
"main": "./lib/index.js",
|
|
24
26
|
"exports": {
|
|
25
27
|
".": "./lib/index.js",
|
|
26
28
|
"./package.json": "./package.json"
|
|
27
29
|
},
|
|
28
|
-
"sideEffects": false,
|
|
29
|
-
"bin": "./lib/pob.js",
|
|
30
30
|
"files": [
|
|
31
31
|
"lib",
|
|
32
32
|
"bin"
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"lint": "yarn run lint:eslint",
|
|
37
37
|
"lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/pob"
|
|
38
38
|
},
|
|
39
|
-
"prettier": "@pob/root/prettier-config",
|
|
40
39
|
"pob": {},
|
|
40
|
+
"prettier": "@pob/root/prettier-config",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@pob/eslint-config": "
|
|
43
|
-
"@pob/eslint-config-typescript": "
|
|
44
|
-
"@pob/eslint-config-typescript-react": "
|
|
45
|
-
"@pob/sort-eslint-config": "5.2.
|
|
46
|
-
"@pob/sort-object": "6.2.
|
|
47
|
-
"@pob/sort-pkg": "
|
|
42
|
+
"@pob/eslint-config": "53.0.0",
|
|
43
|
+
"@pob/eslint-config-typescript": "53.1.0",
|
|
44
|
+
"@pob/eslint-config-typescript-react": "53.0.0",
|
|
45
|
+
"@pob/sort-eslint-config": "5.2.1",
|
|
46
|
+
"@pob/sort-object": "6.2.1",
|
|
47
|
+
"@pob/sort-pkg": "7.0.0",
|
|
48
48
|
"@types/inquirer": "9.0.7",
|
|
49
49
|
"@yarnpkg/cli": "4.0.2",
|
|
50
50
|
"@yarnpkg/core": "4.0.2",
|
|
@@ -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": "
|
|
65
|
+
"pob-dependencies": "11.0.0",
|
|
66
66
|
"prettier": "2.8.8",
|
|
67
67
|
"semver": "7.5.4",
|
|
68
68
|
"validate-npm-package-name": "^5.0.0",
|
|
69
|
-
"yarn-workspace-utils": "3.
|
|
69
|
+
"yarn-workspace-utils": "3.1.1",
|
|
70
70
|
"yeoman-environment": "4.1.3",
|
|
71
71
|
"yeoman-generator": "7.1.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@pob/root": "
|
|
74
|
+
"@pob/root": "9.0.0"
|
|
75
75
|
}
|
|
76
76
|
}
|