pob 11.9.0 → 13.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 +64 -0
- package/lib/generators/common/babel/CommonBabelGenerator.js +15 -12
- package/lib/generators/common/format-lint/CommonLintGenerator.js +4 -4
- package/lib/generators/common/testing/CommonTestingGenerator.js +133 -99
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +2 -2
- package/lib/generators/core/ci/CoreCIGenerator.js +4 -3
- package/lib/generators/core/ci/templates/github-action-documentation-workflow.yml.ejs +1 -1
- package/lib/generators/core/ci/templates/github-action-push-workflow-split.yml.ejs +2 -2
- package/lib/generators/core/ci/templates/github-action-push-workflow.yml.ejs +2 -2
- package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +0 -1
- package/lib/generators/core/package/CorePackageGenerator.js +2 -2
- package/lib/generators/core/vscode/CoreVSCodeGenerator.js +4 -62
- package/lib/generators/core/yarn/CoreYarnGenerator.js +1 -1
- package/lib/generators/lib/PobLibGenerator.js +20 -0
- package/package.json +16 -17
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,70 @@
|
|
|
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
|
+
## [13.0.0](https://github.com/christophehurpeau/pob/compare/pob@12.0.0...pob@13.0.0) (2023-06-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### ⚠ BREAKING CHANGES
|
|
10
|
+
|
|
11
|
+
* requires node 18
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **deps:** update dependency eslint to v8.39.0 ([#1617](https://github.com/christophehurpeau/pob/issues/1617)) ([b42979d](https://github.com/christophehurpeau/pob/commit/b42979d8586e55afee60b1280059916293879711))
|
|
16
|
+
* **deps:** update dependency eslint to v8.40.0 ([#1627](https://github.com/christophehurpeau/pob/issues/1627)) ([6d5dfe6](https://github.com/christophehurpeau/pob/commit/6d5dfe6a3576c53b9da773605e35729dcd8e5610))
|
|
17
|
+
* **deps:** update dependency eslint to v8.41.0 ([#1646](https://github.com/christophehurpeau/pob/issues/1646)) ([11c8395](https://github.com/christophehurpeau/pob/commit/11c8395a08bd281c8960b6ba62999f67b21334aa))
|
|
18
|
+
* **deps:** update dependency yeoman-environment to v3.16.1 ([#1630](https://github.com/christophehurpeau/pob/issues/1630)) ([5ca9ad5](https://github.com/christophehurpeau/pob/commit/5ca9ad515ead63c31c10dccac40c5942974f5760))
|
|
19
|
+
* **deps:** update dependency yeoman-environment to v3.17.0 ([#1638](https://github.com/christophehurpeau/pob/issues/1638)) ([3d1a154](https://github.com/christophehurpeau/pob/commit/3d1a1546d088b4020873eca0ae566ae3ac41a45d))
|
|
20
|
+
* **deps:** update dependency yeoman-environment to v3.18.1 ([#1643](https://github.com/christophehurpeau/pob/issues/1643)) ([e1144ed](https://github.com/christophehurpeau/pob/commit/e1144ed11f476729f90634b7e6c7530af1f959f4))
|
|
21
|
+
* **deps:** update dependency yeoman-environment to v3.19.0 ([#1656](https://github.com/christophehurpeau/pob/issues/1656)) ([82b613f](https://github.com/christophehurpeau/pob/commit/82b613f2ada3ecef8c47b247d32b677a88b596e9))
|
|
22
|
+
* remove legacy code-workspace ([c5bcdc7](https://github.com/christophehurpeau/pob/commit/c5bcdc7735dfda0b369a3045ecc618f8ea11794d))
|
|
23
|
+
* requires node 18 ([bd35158](https://github.com/christophehurpeau/pob/commit/bd351582c2c3977d8d22c15b831e277acc97a00e))
|
|
24
|
+
* update ci to node 18 ([1e4cf82](https://github.com/christophehurpeau/pob/commit/1e4cf828521d24c7142544de3dc3b1dbd62dc9a8))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* **deps:** update @pob/eslint-config to v50.0.5 ([#1629](https://github.com/christophehurpeau/pob/issues/1629)) ([c7065bc](https://github.com/christophehurpeau/pob/commit/c7065bc1757c12fadb848ddd8333c0684b8880e4))
|
|
30
|
+
* **deps:** update dependency prettier to v2.8.8 ([#1619](https://github.com/christophehurpeau/pob/issues/1619)) ([40f1313](https://github.com/christophehurpeau/pob/commit/40f13138243c0b53c52293314111458e6c8d2d6a))
|
|
31
|
+
* **deps:** update dependency semver to v7.5.1 ([#1636](https://github.com/christophehurpeau/pob/issues/1636)) ([9556202](https://github.com/christophehurpeau/pob/commit/95562027a2cdb674b7081c614235e4a07bbc1a22))
|
|
32
|
+
* **deps:** update dependency semver to v7.5.2 ([#1680](https://github.com/christophehurpeau/pob/issues/1680)) ([312c2b2](https://github.com/christophehurpeau/pob/commit/312c2b2c2e2149dbd6a99203fdbe579ffddff98e))
|
|
33
|
+
* **deps:** update dependency semver to v7.5.3 ([#1682](https://github.com/christophehurpeau/pob/issues/1682)) ([8e8b2ef](https://github.com/christophehurpeau/pob/commit/8e8b2efa7ad39077299c5bcdb2c55941038e989a))
|
|
34
|
+
* **deps:** update dependency yeoman-environment to v3.16.2 ([#1632](https://github.com/christophehurpeau/pob/issues/1632)) ([feb4f3a](https://github.com/christophehurpeau/pob/commit/feb4f3a1a819a67444261d1731d39e1fcb62b77d))
|
|
35
|
+
* **deps:** update dependency yeoman-environment to v3.18.2 ([#1644](https://github.com/christophehurpeau/pob/issues/1644)) ([a64dede](https://github.com/christophehurpeau/pob/commit/a64dede35c0b698409644061539bd6f40a0f3c09))
|
|
36
|
+
* **deps:** update dependency yeoman-environment to v3.18.4 ([#1649](https://github.com/christophehurpeau/pob/issues/1649)) ([51059b6](https://github.com/christophehurpeau/pob/commit/51059b64357b32f32f0dc85735111dff3f980fd4))
|
|
37
|
+
* **deps:** update dependency yeoman-environment to v3.19.1 ([#1658](https://github.com/christophehurpeau/pob/issues/1658)) ([0d9ccf7](https://github.com/christophehurpeau/pob/commit/0d9ccf777d0b1216ea9db2bb27c3fec19f0317e2))
|
|
38
|
+
* **deps:** update dependency yeoman-environment to v3.19.2 ([#1659](https://github.com/christophehurpeau/pob/issues/1659)) ([94d5b8b](https://github.com/christophehurpeau/pob/commit/94d5b8be10fd16e07cb7fd56d28393276814a92e))
|
|
39
|
+
* **deps:** update dependency yeoman-environment to v3.19.3 ([#1660](https://github.com/christophehurpeau/pob/issues/1660)) ([9e0452e](https://github.com/christophehurpeau/pob/commit/9e0452e04fc6eab054d949b7954b02eb39c33e8f))
|
|
40
|
+
* **deps:** update yeoman group ([#1645](https://github.com/christophehurpeau/pob/issues/1645)) ([1686097](https://github.com/christophehurpeau/pob/commit/1686097cfb644bbb5ae78a647b1cd9cc07e1f440))
|
|
41
|
+
* dont enable gh-pages with node testing runner ([f1d0fe5](https://github.com/christophehurpeau/pob/commit/f1d0fe512bf4f1d014d2fa7959bb1fbadac48025))
|
|
42
|
+
* fix tsconfig paths ([5aaa499](https://github.com/christophehurpeau/pob/commit/5aaa499fc5fb3a69e33705e1a72e49dbb69739db))
|
|
43
|
+
* sort supportedArchitectures in yarn.yml alpha ([045c7a6](https://github.com/christophehurpeau/pob/commit/045c7a6d9e3697f68debe68a47300bbf239df58e))
|
|
44
|
+
* update github ci required ([fd5afbf](https://github.com/christophehurpeau/pob/commit/fd5afbf935095fb0613f85496d1d2eb2e81ed8ea))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## [12.0.0](https://github.com/christophehurpeau/pob/compare/pob@11.9.0...pob@12.0.0) (2023-04-18)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### ⚠ BREAKING CHANGES
|
|
52
|
+
|
|
53
|
+
* require node 18 for pob and monorepo
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
* **deps:** update dependency eslint to v8.38.0 ([#1596](https://github.com/christophehurpeau/pob/issues/1596)) ([6e0c03b](https://github.com/christophehurpeau/pob/commit/6e0c03b39fe040e9af465fa1e29ec757af3a9311))
|
|
58
|
+
* **deps:** update dependency semver to v7.4.0 ([#1599](https://github.com/christophehurpeau/pob/issues/1599)) ([d71ada7](https://github.com/christophehurpeau/pob/commit/d71ada7ca259ccf83b3226221fb6288e5cf42fcc))
|
|
59
|
+
* **deps:** update dependency semver to v7.5.0 ([#1608](https://github.com/christophehurpeau/pob/issues/1608)) ([1dda98b](https://github.com/christophehurpeau/pob/commit/1dda98b556f670f1316fea18b31a9ce806dd114e))
|
|
60
|
+
* **pob:** add node runner as testing option ([c96f6d8](https://github.com/christophehurpeau/pob/commit/c96f6d888a3cc62a5cba50f069e1c51124acb0d9))
|
|
61
|
+
* require node 18 for pob and monorepo ([5953695](https://github.com/christophehurpeau/pob/commit/5953695fc2a7a440bfaebc8abce8533b05a68f65))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### Bug Fixes
|
|
65
|
+
|
|
66
|
+
* fix rootIgnorePatterns for monorepo ([6731118](https://github.com/christophehurpeau/pob/commit/673111827a0c378febae87f7fefa9917cd8354c3))
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
6
70
|
## [11.9.0](https://github.com/christophehurpeau/pob/compare/pob@11.8.1...pob@11.9.0) (2023-04-03)
|
|
7
71
|
|
|
8
72
|
|
|
@@ -54,7 +54,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
54
54
|
let babelEnvs = pkg.pob.babelEnvs;
|
|
55
55
|
if (
|
|
56
56
|
!babelEnvs.some(
|
|
57
|
-
(env) => env.target === 'node' && String(env.version) === '
|
|
57
|
+
(env) => env.target === 'node' && String(env.version) === '18',
|
|
58
58
|
) &&
|
|
59
59
|
babelEnvs.some(
|
|
60
60
|
(env) =>
|
|
@@ -62,16 +62,18 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
62
62
|
(String(env.version) === '8' ||
|
|
63
63
|
String(env.version) === '6' ||
|
|
64
64
|
String(env.version) === '10' ||
|
|
65
|
-
String(env.version) === '12'
|
|
65
|
+
String(env.version) === '12' ||
|
|
66
|
+
String(env.version) === '14' ||
|
|
67
|
+
String(env.version) === '16'),
|
|
66
68
|
)
|
|
67
69
|
) {
|
|
68
70
|
babelEnvs.unshift({
|
|
69
71
|
target: 'node',
|
|
70
|
-
version: '
|
|
72
|
+
version: '18',
|
|
71
73
|
});
|
|
72
74
|
}
|
|
73
75
|
babelEnvs = babelEnvs.filter(
|
|
74
|
-
(env) => env.target !== 'node' || env.version >=
|
|
76
|
+
(env) => env.target !== 'node' || env.version >= 18,
|
|
75
77
|
);
|
|
76
78
|
|
|
77
79
|
pkg.pob.babelEnvs = babelEnvs;
|
|
@@ -97,7 +99,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
97
99
|
babelEnvs
|
|
98
100
|
.filter((env) => env.target === 'node')
|
|
99
101
|
.map((env) => {
|
|
100
|
-
if (env.version === '14') return '
|
|
102
|
+
if (env.version === '14' || env.version === '16') return '18';
|
|
101
103
|
return env.version;
|
|
102
104
|
}),
|
|
103
105
|
),
|
|
@@ -147,8 +149,8 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
147
149
|
default: nodeVersions,
|
|
148
150
|
choices: [
|
|
149
151
|
{
|
|
150
|
-
name: '
|
|
151
|
-
value: '
|
|
152
|
+
name: '18 (Active LTS)',
|
|
153
|
+
value: '18',
|
|
152
154
|
},
|
|
153
155
|
],
|
|
154
156
|
},
|
|
@@ -201,7 +203,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
201
203
|
formats:
|
|
202
204
|
babelConfig.formats && babelConfig.formats.includes('cjs')
|
|
203
205
|
? // eslint-disable-next-line unicorn/no-nested-ternary
|
|
204
|
-
version === '16'
|
|
206
|
+
version === '16' || version === '18'
|
|
205
207
|
? babelConfig.formats
|
|
206
208
|
: undefined
|
|
207
209
|
: undefined,
|
|
@@ -385,11 +387,12 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
385
387
|
case '10':
|
|
386
388
|
case '12':
|
|
387
389
|
case '14':
|
|
388
|
-
pkg.engines.node = '>=16.0.0';
|
|
389
|
-
break;
|
|
390
390
|
case '16':
|
|
391
391
|
pkg.engines.node = '>=16.0.0';
|
|
392
392
|
break;
|
|
393
|
+
case '18':
|
|
394
|
+
pkg.engines.node = '>=18.0.0';
|
|
395
|
+
break;
|
|
393
396
|
default:
|
|
394
397
|
throw new Error(`Invalid min node version: ${minNodeVersion}`);
|
|
395
398
|
}
|
|
@@ -410,8 +413,8 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
410
413
|
} else {
|
|
411
414
|
packageUtils.removeDependencies(pkg, ['@types/node']);
|
|
412
415
|
packageUtils.removeDevDependencies(pkg, ['@types/node']);
|
|
413
|
-
//
|
|
414
|
-
pkg.engines.node = '>=
|
|
416
|
+
// Supports oldest current or active LTS version of node
|
|
417
|
+
pkg.engines.node = '>=18.0.0';
|
|
415
418
|
}
|
|
416
419
|
|
|
417
420
|
/* browserslist */
|
|
@@ -423,8 +423,8 @@ export default class CommonLintGenerator extends Generator {
|
|
|
423
423
|
if ((!inLerna || !inLerna.root) && useBabel) {
|
|
424
424
|
const buildPath = `/${this.options.buildDirectory}`;
|
|
425
425
|
if (
|
|
426
|
-
!this.options.
|
|
427
|
-
!this.options.
|
|
426
|
+
!this.options.rootIgnorePatterns ||
|
|
427
|
+
!this.options.rootIgnorePatterns.includes(buildPath)
|
|
428
428
|
) {
|
|
429
429
|
ignorePatterns.add(buildPath);
|
|
430
430
|
}
|
|
@@ -433,8 +433,8 @@ export default class CommonLintGenerator extends Generator {
|
|
|
433
433
|
ignorePatterns.add('/rollup.config.mjs');
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
-
if (this.options.
|
|
437
|
-
this.options.
|
|
436
|
+
if (this.options.rootIgnorePatterns) {
|
|
437
|
+
this.options.rootIgnorePatterns
|
|
438
438
|
.split('\n')
|
|
439
439
|
.filter(Boolean)
|
|
440
440
|
.forEach((ignorePath) => {
|
|
@@ -20,6 +20,12 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
20
20
|
desc: 'enable testing',
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
+
this.option('runner', {
|
|
24
|
+
type: String,
|
|
25
|
+
defaults: 'jest',
|
|
26
|
+
desc: 'test runner (jest or node)',
|
|
27
|
+
});
|
|
28
|
+
|
|
23
29
|
this.option('enableReleasePlease', {
|
|
24
30
|
type: Boolean,
|
|
25
31
|
defaults: true,
|
|
@@ -128,10 +134,13 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
128
134
|
? yoConfigPobMonorepo.react ?? packageUtils.hasReact(pkg)
|
|
129
135
|
: packageUtils.hasReact(pkg));
|
|
130
136
|
|
|
131
|
-
if (
|
|
137
|
+
if (this.options.enable || this.options.runner !== 'jest') {
|
|
132
138
|
packageUtils.removeDevDependencies(pkg, ['jest', '@types/jest']);
|
|
133
139
|
|
|
134
140
|
delete pkg.jest;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!this.options.enable) {
|
|
135
144
|
// if (inLerna) {
|
|
136
145
|
// if (pkg.scripts.test === 'echo "No tests"') {
|
|
137
146
|
// delete pkg.scripts.test;
|
|
@@ -142,15 +151,18 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
142
151
|
delete pkg.scripts.test;
|
|
143
152
|
delete pkg.scripts['generate:test-coverage'];
|
|
144
153
|
delete pkg.scripts['test:watch'];
|
|
154
|
+
delete pkg.scripts['test:coverage'];
|
|
145
155
|
}
|
|
146
156
|
|
|
147
157
|
this.fs.writeJSON(this.destinationPath('package.json'), pkg);
|
|
148
158
|
} else {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
159
|
+
if (this.options.runner === 'jest') {
|
|
160
|
+
packageUtils.addOrRemoveDevDependencies(
|
|
161
|
+
pkg,
|
|
162
|
+
enableForMonorepo || !globalTesting,
|
|
163
|
+
['jest', '@types/jest'],
|
|
164
|
+
);
|
|
165
|
+
}
|
|
154
166
|
|
|
155
167
|
packageUtils.removeScripts(['test:coverage']);
|
|
156
168
|
if (this.options.monorepo && !globalTesting) {
|
|
@@ -161,57 +173,68 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
161
173
|
} else if (this.options.monorepo) {
|
|
162
174
|
const shouldUseExperimentalVmModules = pkg.type === 'module';
|
|
163
175
|
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
?
|
|
167
|
-
|
|
168
|
-
|
|
176
|
+
const testCommand =
|
|
177
|
+
this.options.runner === 'jest'
|
|
178
|
+
? `${
|
|
179
|
+
shouldUseExperimentalVmModules
|
|
180
|
+
? 'NODE_OPTIONS=--experimental-vm-modules '
|
|
181
|
+
: ''
|
|
182
|
+
}jest`
|
|
183
|
+
: 'node --test';
|
|
169
184
|
|
|
170
185
|
packageUtils.addScripts(pkg, {
|
|
171
|
-
test:
|
|
186
|
+
test: testCommand,
|
|
187
|
+
'test:watch': `${testCommand} --watch`,
|
|
188
|
+
'test:coverage':
|
|
189
|
+
this.options.runner === 'jest'
|
|
190
|
+
? `${testCommand} --coverage --coverageReporters=json --coverageReporters=text`
|
|
191
|
+
: testCommand, // not yet configured
|
|
172
192
|
});
|
|
173
193
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
194
|
+
if (this.options.runner === 'jest') {
|
|
195
|
+
const workspacesWithoutStar = pkg.workspaces.map((workspace) => {
|
|
196
|
+
if (!workspace.endsWith('/*')) {
|
|
197
|
+
throw new Error(`Invalid workspace format: ${workspace}`);
|
|
198
|
+
}
|
|
199
|
+
return workspace.slice(0, -2);
|
|
200
|
+
});
|
|
201
|
+
const workspacesPattern =
|
|
202
|
+
workspacesWithoutStar.length === 1
|
|
203
|
+
? workspacesWithoutStar[0]
|
|
204
|
+
: `@(${workspacesWithoutStar.join('|')})`;
|
|
205
|
+
hasReact = yoConfigPobMonorepo.packageNames.some((pkgName) =>
|
|
206
|
+
pkgName.startsWith('react-'),
|
|
207
|
+
);
|
|
208
|
+
|
|
209
|
+
if (!pkg.jest) pkg.jest = {};
|
|
210
|
+
Object.assign(pkg.jest, {
|
|
211
|
+
cacheDirectory: './node_modules/.cache/jest',
|
|
212
|
+
testEnvironment: 'node',
|
|
213
|
+
testMatch: [
|
|
214
|
+
`<rootDir>/${workspacesPattern}/*/@(src|lib)/**/__tests__/**/*.${
|
|
215
|
+
transpileWithBabel ? '(ts|js|cjs|mjs)' : '(js|cjs|mjs)'
|
|
216
|
+
}${hasReact ? '?(x)' : ''}`,
|
|
217
|
+
`<rootDir>/${workspacesPattern}/*/@(src|lib)/**/*.test.${
|
|
218
|
+
transpileWithBabel ? '(ts|js|cjs|mjs)' : '(js|cjs|mjs)'
|
|
219
|
+
}${hasReact ? '?(x)' : ''}`,
|
|
220
|
+
],
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
if (shouldUseExperimentalVmModules) {
|
|
224
|
+
pkg.jest.extensionsToTreatAsEsm = [
|
|
225
|
+
transpileWithBabel && '.ts',
|
|
226
|
+
transpileWithBabel && hasReact && '.tsx',
|
|
227
|
+
].filter(Boolean);
|
|
228
|
+
} else {
|
|
229
|
+
delete pkg.jest.extensionsToTreatAsEsm;
|
|
177
230
|
}
|
|
178
|
-
return workspace.slice(0, -2);
|
|
179
|
-
});
|
|
180
|
-
const workspacesPattern =
|
|
181
|
-
workspacesWithoutStar.length === 1
|
|
182
|
-
? workspacesWithoutStar[0]
|
|
183
|
-
: `@(${workspacesWithoutStar.join('|')})`;
|
|
184
|
-
hasReact = yoConfigPobMonorepo.packageNames.some((pkgName) =>
|
|
185
|
-
pkgName.startsWith('react-'),
|
|
186
|
-
);
|
|
187
|
-
|
|
188
|
-
if (!pkg.jest) pkg.jest = {};
|
|
189
|
-
Object.assign(pkg.jest, {
|
|
190
|
-
cacheDirectory: './node_modules/.cache/jest',
|
|
191
|
-
testEnvironment: 'node',
|
|
192
|
-
testMatch: [
|
|
193
|
-
`<rootDir>/${workspacesPattern}/*/@(src|lib)/**/__tests__/**/*.${
|
|
194
|
-
transpileWithBabel ? '(ts|js|cjs|mjs)' : '(js|cjs|mjs)'
|
|
195
|
-
}${hasReact ? '?(x)' : ''}`,
|
|
196
|
-
`<rootDir>/${workspacesPattern}/*/@(src|lib)/**/*.test.${
|
|
197
|
-
transpileWithBabel ? '(ts|js|cjs|mjs)' : '(js|cjs|mjs)'
|
|
198
|
-
}${hasReact ? '?(x)' : ''}`,
|
|
199
|
-
],
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
if (shouldUseExperimentalVmModules) {
|
|
203
|
-
pkg.jest.extensionsToTreatAsEsm = [
|
|
204
|
-
transpileWithBabel && '.ts',
|
|
205
|
-
transpileWithBabel && hasReact && '.tsx',
|
|
206
|
-
].filter(Boolean);
|
|
207
|
-
} else {
|
|
208
|
-
delete pkg.jest.extensionsToTreatAsEsm;
|
|
209
231
|
}
|
|
210
232
|
} else if (globalTesting) {
|
|
211
233
|
delete pkg.jest;
|
|
212
234
|
if (pkg.scripts) {
|
|
213
235
|
delete pkg.scripts['generate:test-coverage'];
|
|
214
236
|
delete pkg.scripts['test:watch'];
|
|
237
|
+
delete pkg.scripts['test:coverage'];
|
|
215
238
|
}
|
|
216
239
|
packageUtils.addScripts(pkg, {
|
|
217
240
|
test: `yarn ../../ run test -- ${path
|
|
@@ -225,67 +248,78 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
225
248
|
const shouldUseExperimentalVmModules =
|
|
226
249
|
pkg.type === 'module' && !inLerna;
|
|
227
250
|
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
?
|
|
231
|
-
|
|
232
|
-
|
|
251
|
+
const testCommand =
|
|
252
|
+
this.options.runner === 'jest'
|
|
253
|
+
? `${
|
|
254
|
+
shouldUseExperimentalVmModules
|
|
255
|
+
? 'NODE_OPTIONS=--experimental-vm-modules '
|
|
256
|
+
: ''
|
|
257
|
+
}jest`
|
|
258
|
+
: 'node --test';
|
|
233
259
|
|
|
234
260
|
packageUtils.addScripts(pkg, {
|
|
235
|
-
test:
|
|
236
|
-
'test:watch': `${
|
|
261
|
+
test: testCommand,
|
|
262
|
+
'test:watch': `${testCommand} --watch`,
|
|
263
|
+
'test:coverage':
|
|
264
|
+
this.options.runner === 'jest'
|
|
265
|
+
? `${testCommand} --coverage --coverageReporters=json --coverageReporters=text`
|
|
266
|
+
: testCommand, // not yet configured,
|
|
237
267
|
});
|
|
238
268
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
+
if (this.options.runner === 'jest') {
|
|
270
|
+
const srcDirectory = transpileWithBabel ? 'src' : 'lib';
|
|
271
|
+
|
|
272
|
+
if (!pkg.jest) pkg.jest = {};
|
|
273
|
+
Object.assign(pkg.jest, {
|
|
274
|
+
cacheDirectory: './node_modules/.cache/jest',
|
|
275
|
+
testMatch: [
|
|
276
|
+
`<rootDir>/${srcDirectory}/**/__tests__/**/*.${
|
|
277
|
+
transpileWithBabel ? 'ts' : '?(m)js'
|
|
278
|
+
}${hasReact ? '?(x)' : ''}`,
|
|
279
|
+
`<rootDir>/${srcDirectory}/**/*.test.${
|
|
280
|
+
transpileWithBabel ? 'ts' : '?(m)js'
|
|
281
|
+
}${hasReact ? '?(x)' : ''}`,
|
|
282
|
+
],
|
|
283
|
+
collectCoverageFrom: [
|
|
284
|
+
`${srcDirectory}/**/*.${transpileWithBabel ? 'ts' : '?(m)js'}${
|
|
285
|
+
hasReact ? '?(x)' : ''
|
|
286
|
+
}`,
|
|
287
|
+
],
|
|
288
|
+
moduleFileExtensions: [
|
|
289
|
+
transpileWithBabel && 'ts',
|
|
290
|
+
transpileWithBabel && hasReact && 'tsx',
|
|
291
|
+
'js',
|
|
292
|
+
// 'jsx',
|
|
293
|
+
'json',
|
|
294
|
+
].filter(Boolean),
|
|
295
|
+
// transform: {
|
|
296
|
+
// [`^.+\\.ts${hasReact ? 'x?' : ''}$`]: 'babel-jest',
|
|
297
|
+
// },
|
|
298
|
+
});
|
|
299
|
+
delete pkg.jest.transform;
|
|
300
|
+
|
|
301
|
+
if (shouldUseExperimentalVmModules) {
|
|
302
|
+
pkg.jest.extensionsToTreatAsEsm = [
|
|
303
|
+
transpileWithBabel && '.ts',
|
|
304
|
+
transpileWithBabel && hasReact && '.tsx',
|
|
305
|
+
].filter(Boolean);
|
|
306
|
+
} else {
|
|
307
|
+
delete pkg.jest.extensionsToTreatAsEsm;
|
|
308
|
+
}
|
|
269
309
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
310
|
+
if (
|
|
311
|
+
babelEnvs.length === 0 ||
|
|
312
|
+
babelEnvs.some((env) => env.target === 'node')
|
|
313
|
+
) {
|
|
314
|
+
pkg.jest.testEnvironment = 'node';
|
|
315
|
+
} else {
|
|
316
|
+
delete pkg.jest.testEnvironment;
|
|
317
|
+
}
|
|
278
318
|
|
|
279
|
-
|
|
280
|
-
babelEnvs.length === 0 ||
|
|
281
|
-
babelEnvs.some((env) => env.target === 'node')
|
|
282
|
-
) {
|
|
283
|
-
pkg.jest.testEnvironment = 'node';
|
|
319
|
+
if (!transpileWithBabel) delete pkg.jest.transform;
|
|
284
320
|
} else {
|
|
285
|
-
delete pkg.jest
|
|
321
|
+
delete pkg.jest;
|
|
286
322
|
}
|
|
287
|
-
|
|
288
|
-
if (!transpileWithBabel) delete pkg.jest.transform;
|
|
289
323
|
}
|
|
290
324
|
}
|
|
291
325
|
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
<% if (monorepoPackageSrcPaths && monorepoPackageSrcPaths.length !== 0) { -%>
|
|
71
71
|
"paths": {
|
|
72
72
|
<% monorepoPackageSrcPaths.forEach(([packageName, packageLocation], index) => { %>
|
|
73
|
-
"<%= packageName %>": ["
|
|
74
|
-
"<%= packageName %>/*": ["
|
|
73
|
+
"<%= packageName %>": ["<%= packageLocation %>"],
|
|
74
|
+
"<%= packageName %>/*": ["<%= packageLocation %>/*"]<%= index === monorepoPackageSrcPaths.length -1 ? '' : ',' -%>
|
|
75
75
|
<% }) %>
|
|
76
76
|
}<% } %>
|
|
77
77
|
}<% if (monorepoPackageReferences && monorepoPackageReferences.length) { -%>,
|
|
@@ -152,12 +152,12 @@ export default class CoreCIGenerator extends Generator {
|
|
|
152
152
|
checks && 'checks',
|
|
153
153
|
build && 'build',
|
|
154
154
|
'lint',
|
|
155
|
-
testing && !this.options.onlyLatestLTS && 'test (16)',
|
|
156
155
|
testing && 'test (18)',
|
|
156
|
+
testing && !this.options.onlyLatestLTS && 'test (20)',
|
|
157
157
|
].filter(Boolean)
|
|
158
158
|
: [
|
|
159
|
-
!this.options.onlyLatestLTS && 'build (16.x)',
|
|
160
159
|
'build (18.x)',
|
|
160
|
+
!this.options.onlyLatestLTS && 'build (20.x)',
|
|
161
161
|
].filter(Boolean)),
|
|
162
162
|
);
|
|
163
163
|
} else {
|
|
@@ -167,7 +167,8 @@ export default class CoreCIGenerator extends Generator {
|
|
|
167
167
|
if (
|
|
168
168
|
this.options.enable &&
|
|
169
169
|
!this.options.isApp &&
|
|
170
|
-
(this.options.documentation ||
|
|
170
|
+
(this.options.documentation ||
|
|
171
|
+
(this.options.testing && this.options.testing.runner !== 'node'))
|
|
171
172
|
) {
|
|
172
173
|
copyAndFormatTpl(
|
|
173
174
|
this.fs,
|
|
@@ -72,7 +72,7 @@ jobs:
|
|
|
72
72
|
|
|
73
73
|
strategy:
|
|
74
74
|
matrix:
|
|
75
|
-
node-version: [
|
|
75
|
+
node-version: [18, 20]
|
|
76
76
|
|
|
77
77
|
steps:
|
|
78
78
|
- uses: actions/checkout@v3
|
|
@@ -90,7 +90,7 @@ jobs:
|
|
|
90
90
|
if: matrix.node-version != 18
|
|
91
91
|
|
|
92
92
|
- name: Generate Test Coverage
|
|
93
|
-
run: <%= packageManager %> run test
|
|
93
|
+
run: <%= packageManager %> run test:coverage
|
|
94
94
|
if: matrix.node-version == 18
|
|
95
95
|
|
|
96
96
|
- name: Send results to codecov
|
|
@@ -8,7 +8,7 @@ jobs:
|
|
|
8
8
|
|
|
9
9
|
strategy:
|
|
10
10
|
matrix:
|
|
11
|
-
node-version: [<% if (!onlyLatestLTS) { -%>
|
|
11
|
+
node-version: [<% if (!onlyLatestLTS) { -%>18.x, <% } -%>20.x]
|
|
12
12
|
|
|
13
13
|
steps:
|
|
14
14
|
- uses: actions/checkout@v3
|
|
@@ -54,7 +54,7 @@ jobs:
|
|
|
54
54
|
<% if (codecov) { -%>
|
|
55
55
|
|
|
56
56
|
- name: Generate Test Coverage
|
|
57
|
-
run: <%= packageManager %> run test
|
|
57
|
+
run: <%= packageManager %> run test:coverage
|
|
58
58
|
if: startsWith(matrix.node-version, '18.')
|
|
59
59
|
env:
|
|
60
60
|
CI: true
|
|
@@ -40,12 +40,12 @@ export default class CorePackageGenerator extends Generator {
|
|
|
40
40
|
if (
|
|
41
41
|
!pkg.engines.node ||
|
|
42
42
|
!(
|
|
43
|
-
pkg.engines.node.startsWith('>=
|
|
43
|
+
pkg.engines.node.startsWith('>=18.') ||
|
|
44
44
|
pkg.engines.node.startsWith('>=16.')
|
|
45
45
|
)
|
|
46
46
|
) {
|
|
47
47
|
// this might be overridden by babel generator
|
|
48
|
-
pkg.engines.node = '>=
|
|
48
|
+
pkg.engines.node = '>=18.0.0';
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
if (!this.options.updateOnly) {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import Generator from 'yeoman-generator';
|
|
2
2
|
import { readJSON5 } from '../../../utils/json5.js';
|
|
3
|
-
import {
|
|
4
|
-
copyAndFormatTpl,
|
|
5
|
-
writeAndFormatJson,
|
|
6
|
-
} from '../../../utils/writeAndFormat.js';
|
|
3
|
+
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
7
4
|
|
|
8
5
|
export default class CoreVSCodeGenerator extends Generator {
|
|
9
6
|
constructor(args, opts) {
|
|
@@ -106,69 +103,14 @@ export default class CoreVSCodeGenerator extends Generator {
|
|
|
106
103
|
);
|
|
107
104
|
|
|
108
105
|
if (this.options.monorepo) {
|
|
109
|
-
const packageNames = JSON.parse(this.options.packageNames);
|
|
110
|
-
const packageLocations = JSON.parse(this.options.packageLocations);
|
|
111
|
-
const folders = packageLocations.map((location, i) => ({
|
|
112
|
-
name: packageNames[i],
|
|
113
|
-
path: `../${location}`,
|
|
114
|
-
}));
|
|
115
|
-
folders.sort((a, b) => a.name.localeCompare(b.name, 'en'));
|
|
116
|
-
|
|
117
|
-
packageLocations.forEach((location) => {
|
|
118
|
-
writeAndFormatJson(
|
|
119
|
-
this.fs,
|
|
120
|
-
this.destinationPath(`${location}/.vscode/settings.json`),
|
|
121
|
-
{
|
|
122
|
-
'eslint.workingDirectories': ['../../'],
|
|
123
|
-
},
|
|
124
|
-
);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const extensions = readJSON5(
|
|
128
|
-
this.fs,
|
|
129
|
-
this.destinationPath('.vscode/extensions.json'),
|
|
130
|
-
{},
|
|
131
|
-
);
|
|
132
|
-
const settings = readJSON5(
|
|
133
|
-
this.fs,
|
|
134
|
-
this.destinationPath('.vscode/settings.json'),
|
|
135
|
-
{},
|
|
136
|
-
);
|
|
137
|
-
|
|
138
106
|
const projectName = pkg.name.replace('/', '-');
|
|
139
|
-
|
|
140
|
-
|
|
107
|
+
// legacy project code-workspace
|
|
108
|
+
this.fs.delete(
|
|
141
109
|
this.destinationPath(`.vscode/${projectName}.code-workspace`),
|
|
142
|
-
{
|
|
143
|
-
extensions,
|
|
144
|
-
settings: {
|
|
145
|
-
...settings,
|
|
146
|
-
...(settings['typescript.tsdk']
|
|
147
|
-
? { 'typescript.tsdk': '✨ root/node_modules/typescript/lib' }
|
|
148
|
-
: {}),
|
|
149
|
-
...(this.options.testing
|
|
150
|
-
? {
|
|
151
|
-
'jest.jestCommandLine':
|
|
152
|
-
'NODE_OPTIONS=--experimental-vm-modules node_modules/.bin/jest',
|
|
153
|
-
// disable all folders to enable only root.
|
|
154
|
-
'jest.disabledWorkspaceFolders': folders.map(
|
|
155
|
-
(folder) => folder.name,
|
|
156
|
-
),
|
|
157
|
-
}
|
|
158
|
-
: {}),
|
|
159
|
-
},
|
|
160
|
-
folders: [
|
|
161
|
-
{
|
|
162
|
-
name: '✨ root',
|
|
163
|
-
path: '..',
|
|
164
|
-
},
|
|
165
|
-
...folders,
|
|
166
|
-
],
|
|
167
|
-
},
|
|
168
110
|
);
|
|
169
111
|
}
|
|
170
112
|
} else {
|
|
171
|
-
|
|
113
|
+
this.fs.delete('.vscode');
|
|
172
114
|
}
|
|
173
115
|
}
|
|
174
116
|
}
|
|
@@ -105,8 +105,8 @@ export default class CoreYarnGenerator extends Generator {
|
|
|
105
105
|
// https://yarnpkg.dev/releases/3-1/
|
|
106
106
|
// make sure all supported architectures are in yarn cache
|
|
107
107
|
config.supportedArchitectures = {
|
|
108
|
-
os: ['linux', 'darwin'],
|
|
109
108
|
cpu: ['x64', 'arm64'],
|
|
109
|
+
os: ['linux', 'darwin'],
|
|
110
110
|
};
|
|
111
111
|
writeAndFormat(this.fs, '.yarnrc.yml', yml.dump(config, {}));
|
|
112
112
|
} else {
|
|
@@ -170,9 +170,26 @@ export default class PobLibGenerator extends Generator {
|
|
|
170
170
|
? this.pobjson.documentation
|
|
171
171
|
: true,
|
|
172
172
|
},
|
|
173
|
+
{
|
|
174
|
+
type: 'checkbox',
|
|
175
|
+
name: 'runner',
|
|
176
|
+
message: 'Testing runner ?',
|
|
177
|
+
default: 'jest',
|
|
178
|
+
choices: [
|
|
179
|
+
{
|
|
180
|
+
name: 'Jest',
|
|
181
|
+
value: 'jest',
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'node:test',
|
|
185
|
+
value: 'node',
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
},
|
|
173
189
|
]);
|
|
174
190
|
|
|
175
191
|
this.pobjson.documentation = !!answers.documentation;
|
|
192
|
+
this.pobjson.runner = !!answers.runner;
|
|
176
193
|
}
|
|
177
194
|
|
|
178
195
|
// testing
|
|
@@ -248,6 +265,9 @@ export default class PobLibGenerator extends Generator {
|
|
|
248
265
|
enable: this.pobjson.testing,
|
|
249
266
|
enableReleasePlease,
|
|
250
267
|
testing: this.pobjson.testing,
|
|
268
|
+
runner: this.pobjson.testing
|
|
269
|
+
? this.pobjson.testing.runner || 'jest'
|
|
270
|
+
: undefined,
|
|
251
271
|
build: withBabel,
|
|
252
272
|
typescript: withBabel,
|
|
253
273
|
documentation: !!this.pobjson.documentation,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"type": "module",
|
|
20
20
|
"engines": {
|
|
21
|
-
"node": ">=
|
|
21
|
+
"node": ">=18.0.0"
|
|
22
22
|
},
|
|
23
23
|
"main": "./lib/index.js",
|
|
24
24
|
"exports": {
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@lerna/package-graph": "5.5.4",
|
|
40
40
|
"@lerna/project": "5.5.4",
|
|
41
|
-
"@pob/eslint-config": "50.0.
|
|
42
|
-
"@pob/eslint-config-typescript": "50.0.
|
|
43
|
-
"@pob/eslint-config-typescript-react": "50.0.
|
|
44
|
-
"@pob/sort-eslint-config": "
|
|
45
|
-
"@pob/sort-object": "
|
|
46
|
-
"@pob/sort-pkg": "
|
|
47
|
-
"eslint": "8.
|
|
41
|
+
"@pob/eslint-config": "50.0.5",
|
|
42
|
+
"@pob/eslint-config-typescript": "50.0.5",
|
|
43
|
+
"@pob/eslint-config-typescript-react": "50.0.5",
|
|
44
|
+
"@pob/sort-eslint-config": "5.0.0",
|
|
45
|
+
"@pob/sort-object": "6.0.0",
|
|
46
|
+
"@pob/sort-pkg": "6.0.0",
|
|
47
|
+
"eslint": "8.41.0",
|
|
48
48
|
"findup-sync": "^5.0.0",
|
|
49
49
|
"git-remote-url": "^1.0.1",
|
|
50
50
|
"github-username": "^6.0.0",
|
|
@@ -56,16 +56,15 @@
|
|
|
56
56
|
"mem-fs": "2.3.0",
|
|
57
57
|
"mem-fs-editor": "9.7.0",
|
|
58
58
|
"minimist": "1.2.8",
|
|
59
|
-
"node-fetch": "3.3.1",
|
|
60
59
|
"parse-author": "2.0.0",
|
|
61
|
-
"pob-dependencies": "
|
|
62
|
-
"prettier": "2.8.
|
|
63
|
-
"semver": "7.3
|
|
64
|
-
"yeoman-environment": "3.
|
|
65
|
-
"yeoman-generator": "5.
|
|
60
|
+
"pob-dependencies": "8.0.0",
|
|
61
|
+
"prettier": "2.8.8",
|
|
62
|
+
"semver": "7.5.3",
|
|
63
|
+
"yeoman-environment": "3.19.3",
|
|
64
|
+
"yeoman-generator": "5.9.0"
|
|
66
65
|
},
|
|
67
66
|
"devDependencies": {
|
|
68
|
-
"@pob/root": "
|
|
67
|
+
"@pob/root": "8.0.0"
|
|
69
68
|
},
|
|
70
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "a4de26f443da5495cac89b819833057c5535e8be"
|
|
71
70
|
}
|