pob 11.6.0 → 11.8.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 +49 -0
- package/lib/generators/app/PobAppGenerator.js +9 -2
- package/lib/generators/app/ignorePaths.js +1 -0
- package/lib/generators/common/babel/CommonBabelGenerator.js +23 -87
- package/lib/generators/common/babel/templates/app.rollup.config.mjs.ejs +1 -1
- package/lib/generators/common/babel/templates/{lib.rollup.config.mjs.txt → lib.rollup.config.mjs.ejs} +1 -0
- package/lib/generators/common/format-lint/CommonLintGenerator.js +5 -2
- package/lib/generators/common/testing/CommonTestingGenerator.js +14 -0
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +9 -6
- package/lib/generators/core/ci/CoreCIGenerator.js +38 -5
- package/lib/generators/core/ci/templates/github-action-push-workflow-split.yml.ejs +135 -0
- package/lib/generators/core/ci/templates/{github-action-node-workflow.yml.ejs → github-action-push-workflow.yml.ejs} +1 -2
- package/lib/generators/core/git/CoreGitGenerator.js +8 -1
- package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +9 -6
- package/lib/generators/core/vscode/CoreVSCodeGenerator.js +2 -0
- package/lib/generators/core/vscode/templates/settings.json.ejs +6 -0
- package/lib/generators/lib/PobLibGenerator.js +2 -1
- package/lib/generators/monorepo/PobMonorepoGenerator.js +10 -0
- package/lib/generators/monorepo/lerna/templates/workflow-publish.yml.ejs +2 -2
- package/lib/generators/pob/PobBaseGenerator.js +17 -6
- package/lib/pob.js +51 -9
- package/package.json +16 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,55 @@
|
|
|
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
|
+
## [11.8.0](https://github.com/christophehurpeau/pob/compare/pob@11.7.0...pob@11.8.0) (2023-03-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add command to help migrate to monorepo ([5274068](https://github.com/christophehurpeau/pob/commit/52740680f63a0949a622831f38268d6d10007a07))
|
|
12
|
+
* drop webpack 4 legacy aliases ([e714540](https://github.com/christophehurpeau/pob/commit/e7145401e52dfe3cc6eff40f2f220b4b81bce561))
|
|
13
|
+
* **pob:** app add "node-library" ([bef77f5](https://github.com/christophehurpeau/pob/commit/bef77f5caee0b89aee5540c82146fea962acf6ff))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Bug Fixes
|
|
17
|
+
|
|
18
|
+
* fix "pob add" use monorepoArg ([92d4ca5](https://github.com/christophehurpeau/pob/commit/92d4ca5faf27fc1c054fd6c28cb5b8e8256d9f87))
|
|
19
|
+
* fix vscode config jestCommandLine ([434d7ad](https://github.com/christophehurpeau/pob/commit/434d7adfb4e73ba3021d516a149bcd1fb287a479))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [11.7.0](https://github.com/christophehurpeau/pob/compare/pob@11.6.0...pob@11.7.0) (2023-03-13)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* configure conventional-changelog-conventionalcommits for lerna ([77e7a22](https://github.com/christophehurpeau/pob/commit/77e7a223646b067ee554cdec42c1d9a309faced9))
|
|
29
|
+
* **deps:** update dependency eslint to v8.34.0 ([#1536](https://github.com/christophehurpeau/pob/issues/1536)) ([98769e9](https://github.com/christophehurpeau/pob/commit/98769e96ae30b00495b9fb3dd1310591daec84ae))
|
|
30
|
+
* **deps:** update dependency eslint to v8.35.0 ([#1552](https://github.com/christophehurpeau/pob/issues/1552)) ([c621a8b](https://github.com/christophehurpeau/pob/commit/c621a8b396978845ddef2cb058abb1eababde5b1))
|
|
31
|
+
* **deps:** update dependency eslint to v8.36.0 ([#1562](https://github.com/christophehurpeau/pob/issues/1562)) ([1bf4bee](https://github.com/christophehurpeau/pob/commit/1bf4beee1d330002052399a625c10f971c4f3b16))
|
|
32
|
+
* **deps:** update dependency mem-fs to v2.3.0 ([#1542](https://github.com/christophehurpeau/pob/issues/1542)) ([7b549fa](https://github.com/christophehurpeau/pob/commit/7b549fa07ac95bfe1c7d65a5768226d6b7f34e03))
|
|
33
|
+
* **deps:** update dependency mem-fs-editor to v9.7.0 ([#1554](https://github.com/christophehurpeau/pob/issues/1554)) ([afc1687](https://github.com/christophehurpeau/pob/commit/afc16876a6ffc8fbc10600a345e2f255e5486085))
|
|
34
|
+
* **deps:** update dependency yeoman-environment to v3.14.0 ([#1533](https://github.com/christophehurpeau/pob/issues/1533)) ([8426153](https://github.com/christophehurpeau/pob/commit/842615332b19b49d9a16560b4d018a2b01acb5a6))
|
|
35
|
+
* **deps:** update dependency yeoman-environment to v3.15.0 ([#1543](https://github.com/christophehurpeau/pob/issues/1543)) ([f2a186c](https://github.com/christophehurpeau/pob/commit/f2a186c40d090dac4a1c99b724d473131d68a835))
|
|
36
|
+
* **deps:** update dependency yeoman-generator to v5.8.0 ([#1541](https://github.com/christophehurpeau/pob/issues/1541)) ([664efed](https://github.com/christophehurpeau/pob/commit/664efed2802036b48c50bcd15e92c8ffc429cec3))
|
|
37
|
+
* **pob:** split ci for medium-sized monorepo ([bb0bdde](https://github.com/christophehurpeau/pob/commit/bb0bdde501c3da052653b5937b44a1c2a1fda3f0))
|
|
38
|
+
* support .d.ts in extraEntries ([ff348f1](https://github.com/christophehurpeau/pob/commit/ff348f1317947fb66ecb7162e20b4f45d4d79b2e))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* **deps:** update dependency minimist to v1.2.8 ([#1532](https://github.com/christophehurpeau/pob/issues/1532)) ([e0eddbe](https://github.com/christophehurpeau/pob/commit/e0eddbe2f0466242278fa3ab208998852ce47115))
|
|
44
|
+
* **deps:** update dependency node-fetch to v3.3.1 ([#1563](https://github.com/christophehurpeau/pob/issues/1563)) ([a86cf2e](https://github.com/christophehurpeau/pob/commit/a86cf2eaf232542910cc477f76cb78250cbaab8e))
|
|
45
|
+
* **deps:** update dependency prettier to v2.8.4 ([#1531](https://github.com/christophehurpeau/pob/issues/1531)) ([a25a94d](https://github.com/christophehurpeau/pob/commit/a25a94d7b144626493275dcc465d6dc2076469b5))
|
|
46
|
+
* **deps:** update dependency yeoman-environment to v3.14.1 ([#1535](https://github.com/christophehurpeau/pob/issues/1535)) ([f317e72](https://github.com/christophehurpeau/pob/commit/f317e7267e99c02314de5e9ea1a129dc6d0d6692))
|
|
47
|
+
* **deps:** update dependency yeoman-environment to v3.15.1 ([#1544](https://github.com/christophehurpeau/pob/issues/1544)) ([adb372c](https://github.com/christophehurpeau/pob/commit/adb372c72556a73543adc03258b5f4b2c312902f))
|
|
48
|
+
* **deps:** update dependency yeoman-generator to v5.7.1 ([#1538](https://github.com/christophehurpeau/pob/issues/1538)) ([a69b624](https://github.com/christophehurpeau/pob/commit/a69b62484ff3a1569b6642d8a3302d28e7f9c833))
|
|
49
|
+
* pass onlyLatestLTS option to testing generator ([c705998](https://github.com/christophehurpeau/pob/commit/c7059984913fa3b0b82b7b7813bc08c7ef525640))
|
|
50
|
+
* **pob:** dont delete prettier for pob monorepo ([7c0cbf7](https://github.com/christophehurpeau/pob/commit/7c0cbf753cbd53266d54fe78533d65753bfc1ebd))
|
|
51
|
+
* **pob:** fix baseUrl for libraries ([dfa705f](https://github.com/christophehurpeau/pob/commit/dfa705fd49d0bdc650719ec22ff25567d0a8a1d6))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
6
55
|
# [11.6.0](https://github.com/christophehurpeau/pob/compare/pob@11.5.0...pob@11.6.0) (2023-01-31)
|
|
7
56
|
|
|
8
57
|
|
|
@@ -73,6 +73,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
73
73
|
'next.js',
|
|
74
74
|
'remix',
|
|
75
75
|
'node',
|
|
76
|
+
'node-library', // monorepo library for app. Not a real library
|
|
76
77
|
'alp-node',
|
|
77
78
|
'other',
|
|
78
79
|
],
|
|
@@ -112,10 +113,14 @@ export default class PobAppGenerator extends Generator {
|
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
default() {
|
|
115
|
-
if (
|
|
116
|
+
if (
|
|
117
|
+
this.appConfig.type === 'node' ||
|
|
118
|
+
this.appConfig.type === 'node-library' ||
|
|
119
|
+
this.appConfig.type === 'alp-node'
|
|
120
|
+
) {
|
|
116
121
|
this.composeWith('pob:common:babel', {
|
|
117
122
|
updateOnly: this.options.updateOnly,
|
|
118
|
-
isApp:
|
|
123
|
+
isApp: this.appConfig.type !== 'node-library',
|
|
119
124
|
useAppConfig: this.appConfig.type === 'alp-node',
|
|
120
125
|
testing: this.appConfig.testing,
|
|
121
126
|
documentation: false,
|
|
@@ -185,6 +190,8 @@ export default class PobAppGenerator extends Generator {
|
|
|
185
190
|
ci: this.appConfig.ci,
|
|
186
191
|
packageManager: this.options.packageManager,
|
|
187
192
|
isApp: true,
|
|
193
|
+
splitCIJobs: false,
|
|
194
|
+
onlyLatestLTS: true,
|
|
188
195
|
});
|
|
189
196
|
|
|
190
197
|
this.composeWith('pob:common:format-lint', {
|
|
@@ -10,6 +10,7 @@ export const appIgnorePaths = {
|
|
|
10
10
|
remix: (config) => ['# remix paths', '/.cache', '/build', '/public/build'],
|
|
11
11
|
pobpack: (config) => ['/build', '/public'],
|
|
12
12
|
node: (config) => ['/build'],
|
|
13
|
+
'node-library': (config) => ['/build'],
|
|
13
14
|
'alp-node': (config) => ['/build'],
|
|
14
15
|
other: (config) => [],
|
|
15
16
|
};
|
|
@@ -162,11 +162,11 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
162
162
|
default: browserVersions,
|
|
163
163
|
choices: [
|
|
164
164
|
{
|
|
165
|
-
name: 'Modern
|
|
165
|
+
name: 'Modern',
|
|
166
166
|
value: 'modern',
|
|
167
167
|
},
|
|
168
168
|
{
|
|
169
|
-
name: 'Supported
|
|
169
|
+
name: 'Supported',
|
|
170
170
|
value: 'supported',
|
|
171
171
|
},
|
|
172
172
|
],
|
|
@@ -361,6 +361,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
361
361
|
'babel-preset-env', // now @babel/preset-env
|
|
362
362
|
'babel-preset-jsdoc',
|
|
363
363
|
'babel-plugin-add-jsdoc-annotations',
|
|
364
|
+
'babel-preset-modern-browsers',
|
|
364
365
|
]);
|
|
365
366
|
|
|
366
367
|
packageUtils.addOrRemoveDevDependencies(
|
|
@@ -371,14 +372,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
371
372
|
['@babel/preset-env'],
|
|
372
373
|
);
|
|
373
374
|
|
|
374
|
-
packageUtils.addOrRemoveDevDependencies(
|
|
375
|
-
pkg,
|
|
376
|
-
this.babelEnvs.find(
|
|
377
|
-
(env) => env.target === 'browser' && env.version === 'modern',
|
|
378
|
-
),
|
|
379
|
-
['babel-preset-modern-browsers'],
|
|
380
|
-
);
|
|
381
|
-
|
|
382
375
|
/* engines */
|
|
383
376
|
|
|
384
377
|
if (hasTargetNode) {
|
|
@@ -424,13 +417,17 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
424
417
|
/* browserslist */
|
|
425
418
|
|
|
426
419
|
if (hasTargetBrowser) {
|
|
427
|
-
pkg.browserslist =
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
420
|
+
pkg.browserslist = {
|
|
421
|
+
...(Array.isArray(pkg.browserslist) ? {} : pkg.browserslist),
|
|
422
|
+
production: [
|
|
423
|
+
'defaults',
|
|
424
|
+
'> 0.2%',
|
|
425
|
+
'not ie < 12',
|
|
426
|
+
'not safari < 10',
|
|
427
|
+
'not ios_saf < 10',
|
|
428
|
+
],
|
|
429
|
+
modern: ['defaults and >1% and supports es6-module'],
|
|
430
|
+
};
|
|
434
431
|
} else if (this.options.isApp && pkg.browserslist) {
|
|
435
432
|
pkg.browserslist = {
|
|
436
433
|
...pkg.browserslist,
|
|
@@ -515,21 +512,10 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
515
512
|
(!env.formats || env.formats.includes('es')),
|
|
516
513
|
);
|
|
517
514
|
|
|
518
|
-
const esModernBrowserEnv = this.babelEnvs.find(
|
|
519
|
-
(env) =>
|
|
520
|
-
env.target === 'browser' &&
|
|
521
|
-
env.version === 'modern' &&
|
|
522
|
-
(!env.formats || env.formats.includes('es')),
|
|
523
|
-
);
|
|
524
|
-
|
|
525
|
-
const esNodeEnv = this.babelEnvs.find(
|
|
526
|
-
(env) =>
|
|
527
|
-
env.target === 'node' && (!env.formats || env.formats.includes('es')),
|
|
528
|
-
);
|
|
529
|
-
|
|
530
515
|
// Legacy "dev" builds
|
|
531
516
|
delete pkg['module:browser'];
|
|
532
517
|
delete pkg['module:browser-dev'];
|
|
518
|
+
delete pkg['module:modern-browsers'];
|
|
533
519
|
delete pkg['module:modern-browsers-dev'];
|
|
534
520
|
delete pkg['module:node'];
|
|
535
521
|
delete pkg['module:node-dev'];
|
|
@@ -543,44 +529,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
543
529
|
delete pkg.browser;
|
|
544
530
|
}
|
|
545
531
|
|
|
546
|
-
if (esModernBrowserEnv) {
|
|
547
|
-
pkg[
|
|
548
|
-
'module:modern-browsers'
|
|
549
|
-
] = `./${this.options.buildDirectory}/index-browsermodern.es.js`;
|
|
550
|
-
} else {
|
|
551
|
-
delete pkg['module:modern-browsers'];
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
const aliases = (this.entries || []).filter((entry) => entry !== 'index');
|
|
555
|
-
|
|
556
|
-
if (useBabel && aliases.length > 0 && (esNodeEnv || esAllBrowserEnv)) {
|
|
557
|
-
[esNodeEnv, esAllBrowserEnv, esModernBrowserEnv]
|
|
558
|
-
.filter(Boolean)
|
|
559
|
-
.forEach((env) => {
|
|
560
|
-
const key = (() => {
|
|
561
|
-
if (env.target === 'node') return 'node';
|
|
562
|
-
if (env.version === 'modern') return 'modern-browsers';
|
|
563
|
-
return 'browser';
|
|
564
|
-
})();
|
|
565
|
-
|
|
566
|
-
const envAliases =
|
|
567
|
-
this.entries.includes('index') && env.target === 'node'
|
|
568
|
-
? aliases.filter((alias) => alias !== 'browser')
|
|
569
|
-
: aliases;
|
|
570
|
-
if (envAliases.length === 0) return;
|
|
571
|
-
pkg[`module:aliases-${key}`] = {};
|
|
572
|
-
|
|
573
|
-
envAliases.forEach((aliasName) => {
|
|
574
|
-
const isBrowserOnly =
|
|
575
|
-
aliasName === 'browser' && env.target !== 'node';
|
|
576
|
-
const aliasDistName = isBrowserOnly ? 'index' : aliasName;
|
|
577
|
-
pkg[`module:aliases-${key}`][`./${aliasName}.js`] = `./${
|
|
578
|
-
this.options.buildDirectory
|
|
579
|
-
}/${aliasDistName}-${env.target}${env.version || ''}.es.js`;
|
|
580
|
-
});
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
|
|
584
532
|
/* webpack 5 and node with ESM support */
|
|
585
533
|
if (useBabel) {
|
|
586
534
|
pkg.exports = {
|
|
@@ -666,7 +614,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
666
614
|
pkg.exports[`./${exportName}`] =
|
|
667
615
|
pkg.type === 'module'
|
|
668
616
|
? // eslint-disable-next-line unicorn/no-nested-ternary
|
|
669
|
-
exportName.endsWith('cjs')
|
|
617
|
+
exportName.endsWith('.cjs') || exportName.endsWith('.d.ts')
|
|
670
618
|
? `./${exportName}`
|
|
671
619
|
: `./${exportName}.js`
|
|
672
620
|
: {
|
|
@@ -690,23 +638,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
690
638
|
|
|
691
639
|
Object.keys(pkg).forEach((key) => {
|
|
692
640
|
if (!key.startsWith('module:') && !key.startsWith('webpack:')) return;
|
|
693
|
-
|
|
694
|
-
// legacy
|
|
695
|
-
if (key.endsWith('-dev')) {
|
|
696
|
-
delete pkg[key];
|
|
697
|
-
return;
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
if (key.startsWith('module:aliases') && aliases.length > 0) {
|
|
701
|
-
if (key.startsWith('module:aliases-node') && esNodeEnv) return;
|
|
702
|
-
if (key.startsWith('module:aliases-browser') && esAllBrowserEnv) return;
|
|
703
|
-
if (
|
|
704
|
-
key.startsWith('module:aliases-modern-browsers') &&
|
|
705
|
-
esModernBrowserEnv
|
|
706
|
-
) {
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
641
|
delete pkg[key];
|
|
711
642
|
});
|
|
712
643
|
|
|
@@ -739,12 +670,17 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
739
670
|
this.destinationPath('rollup.config.mjs'),
|
|
740
671
|
{
|
|
741
672
|
config: this.options.useAppConfig,
|
|
673
|
+
outDirectory: this.options.buildDirectory,
|
|
742
674
|
},
|
|
743
675
|
);
|
|
744
676
|
} else {
|
|
745
|
-
|
|
746
|
-
this.
|
|
677
|
+
copyAndFormatTpl(
|
|
678
|
+
this.fs,
|
|
679
|
+
this.templatePath('lib.rollup.config.mjs.ejs'),
|
|
747
680
|
this.destinationPath('rollup.config.mjs'),
|
|
681
|
+
{
|
|
682
|
+
outDirectory: this.options.buildDirectory,
|
|
683
|
+
},
|
|
748
684
|
);
|
|
749
685
|
}
|
|
750
686
|
} else {
|
|
@@ -207,7 +207,8 @@ export default class CommonLintGenerator extends Generator {
|
|
|
207
207
|
|
|
208
208
|
const yoConfigPobMonorepo = inLerna && inLerna.pobMonorepoConfig;
|
|
209
209
|
const globalEslint =
|
|
210
|
-
|
|
210
|
+
this.options.monorepo ||
|
|
211
|
+
(yoConfigPobMonorepo && yoConfigPobMonorepo.eslint !== false);
|
|
211
212
|
const globalTesting = yoConfigPobMonorepo && yoConfigPobMonorepo.testing;
|
|
212
213
|
const composite = yoConfigPobMonorepo && yoConfigPobMonorepo.typescript;
|
|
213
214
|
const { rootPackageManager, rootYarnNodeLinker } = inLerna || {};
|
|
@@ -239,7 +240,9 @@ export default class CommonLintGenerator extends Generator {
|
|
|
239
240
|
true,
|
|
240
241
|
);
|
|
241
242
|
} else {
|
|
242
|
-
|
|
243
|
+
if (pkg.name !== 'pob-monorepo') {
|
|
244
|
+
packageUtils.removeDevDependencies(pkg, ['prettier']);
|
|
245
|
+
}
|
|
243
246
|
packageUtils.addOrRemoveDevDependencies(
|
|
244
247
|
pkg,
|
|
245
248
|
!globalEslint ||
|
|
@@ -61,6 +61,18 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
61
61
|
required: true,
|
|
62
62
|
desc: 'is app',
|
|
63
63
|
});
|
|
64
|
+
|
|
65
|
+
this.option('splitCIJobs', {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
required: true,
|
|
68
|
+
desc: 'split CI jobs for faster result',
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
this.option('onlyLatestLTS', {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: true,
|
|
74
|
+
desc: 'only latest lts',
|
|
75
|
+
});
|
|
64
76
|
}
|
|
65
77
|
|
|
66
78
|
default() {
|
|
@@ -75,6 +87,8 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
75
87
|
codecov: this.options.codecov,
|
|
76
88
|
packageManager: this.options.packageManager,
|
|
77
89
|
isApp: this.options.isApp,
|
|
90
|
+
splitJobs: this.options.splitCIJobs,
|
|
91
|
+
onlyLatestLTS: this.options.onlyLatestLTS,
|
|
78
92
|
});
|
|
79
93
|
} else {
|
|
80
94
|
this.composeWith('pob:core:ci', {
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
<% } -%>
|
|
11
11
|
"compilerOptions": {
|
|
12
12
|
"rootDir": "<%= rootDir %>",
|
|
13
|
+
<% if (baseUrl !== 'none') { -%>
|
|
14
|
+
"baseUrl": "<%= baseUrl %>", /* Base directory to resolve non-absolute module names. */
|
|
15
|
+
<% } -%>
|
|
13
16
|
"newLine": "lf",
|
|
14
17
|
<% if (emit) { -%>
|
|
15
18
|
"outDir": "dist/definitions",
|
|
@@ -56,13 +59,13 @@
|
|
|
56
59
|
"forceConsistentCasingInFileNames": true,
|
|
57
60
|
|
|
58
61
|
/* Module Resolution Options */
|
|
59
|
-
"moduleResolution": "node"
|
|
60
|
-
|
|
61
|
-
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
62
|
-
<% if (resolveJsonModule) { -%>
|
|
62
|
+
"moduleResolution": "node" /* Specify module resolution strategy. */,
|
|
63
|
+
<% if (resolveJsonModule) { -%>
|
|
63
64
|
"resolveJsonModule": <%= resolveJsonModule %>,
|
|
64
|
-
|
|
65
|
-
"
|
|
65
|
+
<% } -%>
|
|
66
|
+
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
67
|
+
"esModuleInterop": true<% if (monorepoPackageSrcPaths) { %>,<% } %> /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
68
|
+
|
|
66
69
|
<% if (monorepoPackageSrcPaths && monorepoPackageSrcPaths.length !== 0) { -%>
|
|
67
70
|
"paths": {
|
|
68
71
|
<% monorepoPackageSrcPaths.forEach(([packageName, packageLocation], index) => { %>
|
|
@@ -4,6 +4,8 @@ import inLerna from '../../../utils/inLerna.js';
|
|
|
4
4
|
import * as packageUtils from '../../../utils/package.js';
|
|
5
5
|
import { copyAndFormatTpl } from '../../../utils/writeAndFormat.js';
|
|
6
6
|
|
|
7
|
+
export const ciContexts = [];
|
|
8
|
+
|
|
7
9
|
export default class CoreCIGenerator extends Generator {
|
|
8
10
|
constructor(args, opts) {
|
|
9
11
|
super(args, opts);
|
|
@@ -69,10 +71,16 @@ export default class CoreCIGenerator extends Generator {
|
|
|
69
71
|
});
|
|
70
72
|
|
|
71
73
|
this.option('onlyLatestLTS', {
|
|
72
|
-
type:
|
|
74
|
+
type: Boolean,
|
|
73
75
|
required: true,
|
|
74
76
|
desc: 'only latest lts',
|
|
75
77
|
});
|
|
78
|
+
|
|
79
|
+
this.option('splitJobs', {
|
|
80
|
+
type: Boolean,
|
|
81
|
+
required: true,
|
|
82
|
+
desc: 'split CI jobs for faster result',
|
|
83
|
+
});
|
|
76
84
|
}
|
|
77
85
|
|
|
78
86
|
async prompting() {
|
|
@@ -105,16 +113,25 @@ export default class CoreCIGenerator extends Generator {
|
|
|
105
113
|
if (this.options.enable) {
|
|
106
114
|
const pkg = this.fs.readJSON(this.destinationPath('package.json'));
|
|
107
115
|
|
|
116
|
+
const checks = !!pkg.scripts && !!pkg.scripts.checks;
|
|
117
|
+
const testing =
|
|
118
|
+
this.options.testing && !!pkg.scripts && !!pkg.scripts.test;
|
|
119
|
+
const build = this.options.build;
|
|
120
|
+
|
|
108
121
|
copyAndFormatTpl(
|
|
109
122
|
this.fs,
|
|
110
|
-
this.templatePath(
|
|
123
|
+
this.templatePath(
|
|
124
|
+
this.options.splitJobs
|
|
125
|
+
? 'github-action-push-workflow-split.yml.ejs'
|
|
126
|
+
: 'github-action-push-workflow.yml.ejs',
|
|
127
|
+
),
|
|
111
128
|
this.destinationPath('.github/workflows/push.yml'),
|
|
112
129
|
{
|
|
113
130
|
packageManager: this.options.packageManager,
|
|
114
|
-
testing
|
|
115
|
-
checks
|
|
131
|
+
testing,
|
|
132
|
+
checks,
|
|
116
133
|
documentation: this.options.documentation,
|
|
117
|
-
build
|
|
134
|
+
build,
|
|
118
135
|
typescript: this.options.typescript,
|
|
119
136
|
codecov: this.options.codecov,
|
|
120
137
|
onlyLatestLTS: this.options.onlyLatestLTS,
|
|
@@ -127,6 +144,22 @@ export default class CoreCIGenerator extends Generator {
|
|
|
127
144
|
inLerna.pobConfig?.project?.type === 'lib',
|
|
128
145
|
},
|
|
129
146
|
);
|
|
147
|
+
|
|
148
|
+
ciContexts.push(
|
|
149
|
+
'reviewflow',
|
|
150
|
+
...(this.options.splitJobs
|
|
151
|
+
? [
|
|
152
|
+
checks && 'checks',
|
|
153
|
+
build && 'build',
|
|
154
|
+
'lint',
|
|
155
|
+
testing && !this.options.onlyLatestLTS && 'test (16)',
|
|
156
|
+
testing && 'test (18)',
|
|
157
|
+
].filter(Boolean)
|
|
158
|
+
: [
|
|
159
|
+
!this.options.onlyLatestLTS && 'build (16.x)',
|
|
160
|
+
'build (18.x)',
|
|
161
|
+
].filter(Boolean)),
|
|
162
|
+
);
|
|
130
163
|
} else {
|
|
131
164
|
this.fs.delete(this.destinationPath('.github/workflows/push.yml'));
|
|
132
165
|
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
name: Push CI
|
|
2
|
+
|
|
3
|
+
on: [push]
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
<% if (checks) { -%>
|
|
7
|
+
checks:
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
|
|
10
|
+
steps:
|
|
11
|
+
- uses: actions/checkout@v3
|
|
12
|
+
|
|
13
|
+
- uses: actions/setup-node@v3
|
|
14
|
+
with:
|
|
15
|
+
node-version: 18
|
|
16
|
+
|
|
17
|
+
- name: Install Dependencies
|
|
18
|
+
run: yarn install --immutable --immutable-cache
|
|
19
|
+
|
|
20
|
+
- name: Checks
|
|
21
|
+
run: yarn run checks
|
|
22
|
+
|
|
23
|
+
<% } -%>
|
|
24
|
+
<% if (build) { -%>
|
|
25
|
+
build:
|
|
26
|
+
runs-on: ubuntu-latest
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- uses: actions/checkout@v3
|
|
30
|
+
|
|
31
|
+
- uses: actions/setup-node@v3
|
|
32
|
+
with:
|
|
33
|
+
node-version: 18
|
|
34
|
+
|
|
35
|
+
- name: Install Dependencies
|
|
36
|
+
run: yarn install --immutable --immutable-cache
|
|
37
|
+
|
|
38
|
+
- name: Build
|
|
39
|
+
run: yarn run build
|
|
40
|
+
|
|
41
|
+
- name: Check nothing was forgotten before commit
|
|
42
|
+
run: yarn run repository-check-dirty
|
|
43
|
+
|
|
44
|
+
<% } -%>
|
|
45
|
+
lint:
|
|
46
|
+
runs-on: ubuntu-latest
|
|
47
|
+
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/checkout@v3
|
|
50
|
+
|
|
51
|
+
- uses: actions/setup-node@v3
|
|
52
|
+
with:
|
|
53
|
+
node-version: 18
|
|
54
|
+
|
|
55
|
+
- name: Install Dependencies
|
|
56
|
+
run: yarn install --immutable --immutable-cache
|
|
57
|
+
|
|
58
|
+
- name: Prettier
|
|
59
|
+
run: yarn run lint:prettier
|
|
60
|
+
<% if (typescript) { -%>
|
|
61
|
+
|
|
62
|
+
- name: Typescript
|
|
63
|
+
run: yarn run tsc
|
|
64
|
+
<% } -%>
|
|
65
|
+
|
|
66
|
+
- name: Eslint
|
|
67
|
+
run: yarn run lint:eslint
|
|
68
|
+
<% if (testing) { -%>
|
|
69
|
+
|
|
70
|
+
test:
|
|
71
|
+
runs-on: ubuntu-latest
|
|
72
|
+
|
|
73
|
+
strategy:
|
|
74
|
+
matrix:
|
|
75
|
+
node-version: [16, 18]
|
|
76
|
+
|
|
77
|
+
steps:
|
|
78
|
+
- uses: actions/checkout@v3
|
|
79
|
+
|
|
80
|
+
- uses: actions/setup-node@v3
|
|
81
|
+
with:
|
|
82
|
+
node-version: ${{ matrix.node-version }}
|
|
83
|
+
|
|
84
|
+
- name: Install Dependencies
|
|
85
|
+
run: yarn install --immutable --immutable-cache
|
|
86
|
+
|
|
87
|
+
<% if (codecov) { -%>
|
|
88
|
+
- name: Test
|
|
89
|
+
run: <%= packageManager %> run test
|
|
90
|
+
if: matrix.node-version != 18
|
|
91
|
+
|
|
92
|
+
- name: Generate Test Coverage
|
|
93
|
+
run: <%= packageManager %> run test --coverage --coverageReporters=json --coverageReporters=text
|
|
94
|
+
if: matrix.node-version == 18
|
|
95
|
+
|
|
96
|
+
- name: Send results to codecov
|
|
97
|
+
uses: codecov/codecov-action@v3
|
|
98
|
+
if: matrix.node-version == 18
|
|
99
|
+
with:
|
|
100
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
101
|
+
<% } else { -%>
|
|
102
|
+
|
|
103
|
+
- name: Test
|
|
104
|
+
run: <%= packageManager %> run test
|
|
105
|
+
<% } -%>
|
|
106
|
+
<% } -%>
|
|
107
|
+
<% if (isReleasePleaseEnabled) { -%>
|
|
108
|
+
release:
|
|
109
|
+
runs-on: ubuntu-latest
|
|
110
|
+
|
|
111
|
+
needs: [<%= checks ? '"checks", ' : '' -%><%= build ? '"build", ' : '' -%>"lint"<%= testing ? ', "test"' : '' -%>]
|
|
112
|
+
|
|
113
|
+
steps:
|
|
114
|
+
- uses: actions/checkout@v3
|
|
115
|
+
|
|
116
|
+
- uses: actions/setup-node@v3
|
|
117
|
+
with:
|
|
118
|
+
node-version: 18
|
|
119
|
+
|
|
120
|
+
- uses: GoogleCloudPlatform/release-please-action@v3
|
|
121
|
+
if: ${{ github.ref == 'refs/heads/main' }}
|
|
122
|
+
id: release
|
|
123
|
+
with:
|
|
124
|
+
token: ${{ secrets.GH_TOKEN }}
|
|
125
|
+
release-type: node
|
|
126
|
+
|
|
127
|
+
<% if (publishSinglePackage) { -%>
|
|
128
|
+
|
|
129
|
+
# publish:
|
|
130
|
+
- run: npm publish
|
|
131
|
+
if: ${{ github.ref == 'refs/heads/main' && steps.release.outputs.release_created }}
|
|
132
|
+
env:
|
|
133
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
134
|
+
<% } -%>
|
|
135
|
+
<% } -%>
|
|
@@ -15,10 +15,16 @@ export default class CoreGitGenerator extends Generator {
|
|
|
15
15
|
});
|
|
16
16
|
|
|
17
17
|
this.option('onlyLatestLTS', {
|
|
18
|
-
type:
|
|
18
|
+
type: Boolean,
|
|
19
19
|
required: true,
|
|
20
20
|
desc: 'only latest lts',
|
|
21
21
|
});
|
|
22
|
+
|
|
23
|
+
this.option('splitCIJobs', {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
required: true,
|
|
26
|
+
desc: 'split CI jobs for faster result',
|
|
27
|
+
});
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
async initializing() {
|
|
@@ -101,6 +107,7 @@ export default class CoreGitGenerator extends Generator {
|
|
|
101
107
|
gitHostAccount: this.gitHostAccount,
|
|
102
108
|
repoName: this.repoName,
|
|
103
109
|
onlyLatestLTS: this.options.onlyLatestLTS,
|
|
110
|
+
splitCIJobs: this.options.splitCIJobs,
|
|
104
111
|
});
|
|
105
112
|
}
|
|
106
113
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import fetch from 'node-fetch';
|
|
4
4
|
import Generator from 'yeoman-generator';
|
|
5
|
+
import { ciContexts } from '../../../ci/CoreCIGenerator.js';
|
|
5
6
|
// const packageUtils = require('../../../../../utils/package');
|
|
6
7
|
|
|
7
8
|
const GITHUB_TOKEN = process.env.POB_GITHUB_TOKEN;
|
|
@@ -30,11 +31,7 @@ const configureProtectionRule = async (owner, repo, onlyLatestLTS) => {
|
|
|
30
31
|
await putJson(`repos/${owner}/${repo}/branches/${branch}/protection`, {
|
|
31
32
|
required_status_checks: {
|
|
32
33
|
strict: false,
|
|
33
|
-
contexts:
|
|
34
|
-
!onlyLatestLTS && 'build (16.x)',
|
|
35
|
-
'build (18.x)',
|
|
36
|
-
'reviewflow',
|
|
37
|
-
].filter(Boolean),
|
|
34
|
+
contexts: ciContexts,
|
|
38
35
|
},
|
|
39
36
|
enforce_admins: false, // true,
|
|
40
37
|
required_pull_request_reviews: null,
|
|
@@ -79,11 +76,17 @@ export default class CoreGitGithubGenerator extends Generator {
|
|
|
79
76
|
});
|
|
80
77
|
|
|
81
78
|
this.option('onlyLatestLTS', {
|
|
82
|
-
type:
|
|
79
|
+
type: Boolean,
|
|
83
80
|
required: true,
|
|
84
81
|
desc: 'only latest lts',
|
|
85
82
|
});
|
|
86
83
|
|
|
84
|
+
this.option('splitCIJobs', {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
required: true,
|
|
87
|
+
desc: 'split CI jobs for faster result',
|
|
88
|
+
});
|
|
89
|
+
|
|
87
90
|
if (!GITHUB_TOKEN && process.env.CI !== 'true') {
|
|
88
91
|
throw new Error(
|
|
89
92
|
'Missing POB_GITHUB_TOKEN. Create one with https://github.com/settings/tokens/new?scopes=repo&description=POB%20Generator and add it in your env variables.',
|
|
@@ -148,6 +148,8 @@ export default class CoreVSCodeGenerator extends Generator {
|
|
|
148
148
|
: {}),
|
|
149
149
|
...(this.options.testing
|
|
150
150
|
? {
|
|
151
|
+
'jest.jestCommandLine':
|
|
152
|
+
'NODE_OPTIONS=--experimental-vm-modules node_modules/.bin/jest',
|
|
151
153
|
// disable all folders to enable only root.
|
|
152
154
|
'jest.disabledWorkspaceFolders': folders.map(
|
|
153
155
|
(folder) => folder.name,
|
|
@@ -34,6 +34,12 @@
|
|
|
34
34
|
"source.organizeImports": false
|
|
35
35
|
},
|
|
36
36
|
|
|
37
|
+
|
|
38
|
+
<% if (testing && module) { -%>
|
|
39
|
+
// jest
|
|
40
|
+
"jest.jestCommandLine": "NODE_OPTIONS=--experimental-vm-modules node_modules/.bin/jest",
|
|
41
|
+
<% } -%>
|
|
42
|
+
|
|
37
43
|
// eslint config
|
|
38
44
|
"eslint.workingDirectories": ["."],
|
|
39
45
|
"eslint.options": {
|
|
@@ -228,7 +228,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
228
228
|
dom: browser,
|
|
229
229
|
jsx,
|
|
230
230
|
updateOnly: this.options.updateOnly,
|
|
231
|
-
baseUrl: '
|
|
231
|
+
baseUrl: 'none', // causes issues on dist definition files
|
|
232
232
|
builddefs: true,
|
|
233
233
|
});
|
|
234
234
|
|
|
@@ -254,6 +254,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
254
254
|
ci: this.pobjson.testing && this.pobjson.testing.ci,
|
|
255
255
|
packageManager: this.options.packageManager,
|
|
256
256
|
isApp: false,
|
|
257
|
+
splitCIJobs: false,
|
|
257
258
|
});
|
|
258
259
|
|
|
259
260
|
// must be after testing
|
|
@@ -73,6 +73,12 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
73
73
|
defaults: 'pnp',
|
|
74
74
|
desc: 'Defines what linker should be used for installing Node packages (useful to enable the node-modules plugin), one of: pnp, node-modules.',
|
|
75
75
|
});
|
|
76
|
+
|
|
77
|
+
this.option('onlyLatestLTS', {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
required: true,
|
|
80
|
+
desc: 'only latest lts',
|
|
81
|
+
});
|
|
76
82
|
}
|
|
77
83
|
|
|
78
84
|
async initializing() {
|
|
@@ -206,6 +212,8 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
206
212
|
this.pobLernaConfig.ci &&
|
|
207
213
|
!pkg.devDependencies?.['@pob/lerna-light'];
|
|
208
214
|
|
|
215
|
+
const splitCIJobs = this.packageNames.length > 8;
|
|
216
|
+
|
|
209
217
|
this.composeWith('pob:common:testing', {
|
|
210
218
|
monorepo: true,
|
|
211
219
|
enable: this.pobLernaConfig.testing,
|
|
@@ -217,6 +225,8 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
217
225
|
ci: this.pobLernaConfig.ci,
|
|
218
226
|
packageManager: this.options.packageManager,
|
|
219
227
|
isApp: this.options.isAppProject,
|
|
228
|
+
onlyLatestLTS: this.options.onlyLatestLTS,
|
|
229
|
+
splitCIJobs,
|
|
220
230
|
});
|
|
221
231
|
|
|
222
232
|
this.composeWith('pob:common:format-lint', {
|
|
@@ -27,7 +27,7 @@ jobs:
|
|
|
27
27
|
if: |
|
|
28
28
|
github.ref == 'refs/heads/main'
|
|
29
29
|
&& contains(github.event.inputs.dry-run, 'y')
|
|
30
|
-
run: yarn lerna version --yes --no-push --exact --conventional-commits --conventional-graduate --no-git-tag-version --loglevel=verbose
|
|
30
|
+
run: yarn lerna version --yes --no-push --exact --conventional-commits --conventional-graduate --changelog-preset conventional-changelog-conventionalcommits --no-git-tag-version --loglevel=verbose
|
|
31
31
|
|
|
32
32
|
- name: Configure Git user
|
|
33
33
|
if: |
|
|
@@ -42,7 +42,7 @@ jobs:
|
|
|
42
42
|
github.ref == 'refs/heads/main'
|
|
43
43
|
&& contains(github.event.inputs.dry-run, 'y') == false
|
|
44
44
|
run: |
|
|
45
|
-
yarn lerna version --yes --push --exact --conventional-commits --conventional-graduate --create-release=github -m 'chore: release [skip ci]'
|
|
45
|
+
yarn lerna version --yes --push --exact --conventional-commits --conventional-graduate --changelog-preset conventional-changelog-conventionalcommits --create-release=github -m 'chore: release [skip ci]'
|
|
46
46
|
env:
|
|
47
47
|
HUSKY: 0
|
|
48
48
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
1
2
|
import Generator from 'yeoman-generator';
|
|
2
3
|
import ensureJsonFileFormatted from '../../utils/ensureJsonFileFormatted.js';
|
|
3
4
|
import inLerna from '../../utils/inLerna.js';
|
|
@@ -162,8 +163,11 @@ export default class PobBaseGenerator extends Generator {
|
|
|
162
163
|
inLerna.pobConfig?.project?.onlyLatestLTS === true));
|
|
163
164
|
|
|
164
165
|
if (!this.inLerna) {
|
|
166
|
+
const splitCIJobs =
|
|
167
|
+
inLerna && inLerna.pobMonorepoConfig?.packageNames.length > 8;
|
|
165
168
|
this.composeWith('pob:core:git', {
|
|
166
169
|
onlyLatestLTS,
|
|
170
|
+
splitCIJobs,
|
|
167
171
|
});
|
|
168
172
|
} else {
|
|
169
173
|
if (this.fs.exists('.git-hooks')) this.fs.delete('.git-hooks');
|
|
@@ -186,12 +190,19 @@ export default class PobBaseGenerator extends Generator {
|
|
|
186
190
|
}
|
|
187
191
|
|
|
188
192
|
if (this.useLerna) {
|
|
189
|
-
this.composeWith(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
this.composeWith(
|
|
194
|
+
// pob:monorepo <= for searching PobMonorepoGenerator.js
|
|
195
|
+
fileURLToPath(
|
|
196
|
+
new URL('../monorepo/PobMonorepoGenerator.js', import.meta.url),
|
|
197
|
+
),
|
|
198
|
+
{
|
|
199
|
+
updateOnly: this.options.updateOnly,
|
|
200
|
+
isAppProject: this.projectConfig.type === 'app',
|
|
201
|
+
packageManager: this.projectConfig.packageManager,
|
|
202
|
+
yarnNodeLinker: this.projectConfig.yarnNodeLinker,
|
|
203
|
+
onlyLatestLTS,
|
|
204
|
+
},
|
|
205
|
+
);
|
|
195
206
|
} else {
|
|
196
207
|
switch (this.projectConfig.type) {
|
|
197
208
|
case 'lib':
|
package/lib/pob.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { spawnSync } from 'child_process';
|
|
4
|
-
import fs, {
|
|
3
|
+
import { execSync, spawnSync } from 'child_process';
|
|
4
|
+
import fs, {
|
|
5
|
+
existsSync,
|
|
6
|
+
writeFileSync,
|
|
7
|
+
readFileSync,
|
|
8
|
+
mkdirSync,
|
|
9
|
+
readdirSync,
|
|
10
|
+
} from 'fs';
|
|
5
11
|
import path from 'path';
|
|
6
12
|
import minimist from 'minimist';
|
|
7
13
|
import yeoman from 'yeoman-environment';
|
|
@@ -30,7 +36,6 @@ import CoreYarnGenerator from './generators/core/yarn/CoreYarnGenerator.js';
|
|
|
30
36
|
import PobLibGenerator from './generators/lib/PobLibGenerator.js';
|
|
31
37
|
import LibDocGenerator from './generators/lib/doc/LibDocGenerator.js';
|
|
32
38
|
import LibReadmeGenerator from './generators/lib/readme/LibReadmeGenerator.js';
|
|
33
|
-
import PobMonorepoGenerator from './generators/monorepo/PobMonorepoGenerator.js';
|
|
34
39
|
import MonorepoLernaGenerator from './generators/monorepo/lerna/MonorepoLernaGenerator.js';
|
|
35
40
|
import MonorepoTypescriptGenerator from './generators/monorepo/typescript/MonorepoTypescriptGenerator.js';
|
|
36
41
|
import PobBaseGenerator from './generators/pob/PobBaseGenerator.js';
|
|
@@ -202,11 +207,6 @@ env.registerStub(
|
|
|
202
207
|
'pob:lib:readme',
|
|
203
208
|
`${__dirname}/generators/lib/readme/LibReadmeGenerator.js`,
|
|
204
209
|
);
|
|
205
|
-
env.registerStub(
|
|
206
|
-
PobMonorepoGenerator,
|
|
207
|
-
'pob:monorepo',
|
|
208
|
-
`${__dirname}/generators/monorepo/PobMonorepoGenerator.js`,
|
|
209
|
-
);
|
|
210
210
|
env.registerStub(
|
|
211
211
|
MonorepoLernaGenerator,
|
|
212
212
|
'pob:monorepo:lerna',
|
|
@@ -230,7 +230,7 @@ if (action === 'add') {
|
|
|
230
230
|
);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
const packageName =
|
|
233
|
+
const packageName = monorepoArg ? argv._[2] : argv._[1];
|
|
234
234
|
|
|
235
235
|
if (!packageName) {
|
|
236
236
|
console.error('Missing argument: packageName');
|
|
@@ -260,6 +260,48 @@ if (action === 'add') {
|
|
|
260
260
|
process.exit(0);
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
if (action === 'migrate-to-monorepo') {
|
|
264
|
+
if (projectPkg.workspaces) {
|
|
265
|
+
throw new Error('workspaces field already exists in package.json');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
mkdirSync('packages');
|
|
269
|
+
mkdirSync(`packages/${projectPkg.name}`);
|
|
270
|
+
|
|
271
|
+
readdirSync('.').forEach((filename) => {
|
|
272
|
+
if (
|
|
273
|
+
![
|
|
274
|
+
'.git',
|
|
275
|
+
'.vscode',
|
|
276
|
+
'.github',
|
|
277
|
+
'.husky',
|
|
278
|
+
'.yarn',
|
|
279
|
+
'.yarnrc.yml',
|
|
280
|
+
'packages',
|
|
281
|
+
'lint-staged.config.js',
|
|
282
|
+
'yarn.lock',
|
|
283
|
+
].includes(filename)
|
|
284
|
+
) {
|
|
285
|
+
execSync(`mv "${filename}" "packages/${projectPkg.name}/"`);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
const monorepoName = `${path.basename(process.cwd())}-monorepo`;
|
|
290
|
+
const monorepoPkg = {
|
|
291
|
+
name: monorepoName,
|
|
292
|
+
version: projectPkg.version,
|
|
293
|
+
author: projectPkg.author,
|
|
294
|
+
license: projectPkg.license,
|
|
295
|
+
repository: projectPkg.repository,
|
|
296
|
+
engines: projectPkg.engines,
|
|
297
|
+
packageManager: projectPkg.packageManager,
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
writeFileSync('package.json', JSON.stringify(monorepoPkg, null, 2));
|
|
301
|
+
|
|
302
|
+
monorepo = true;
|
|
303
|
+
}
|
|
304
|
+
|
|
263
305
|
const updateOnly = action === 'update';
|
|
264
306
|
const init = action === 'init';
|
|
265
307
|
const type = updateOnly || init ? null : action;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.8.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"bin": "./lib/pob.js",
|
|
30
30
|
"scripts": {
|
|
31
|
+
"clean:build": "true",
|
|
31
32
|
"format": "prettier --write",
|
|
32
33
|
"lint": "yarn run lint:eslint",
|
|
33
34
|
"lint:eslint": "yarn ../.. run eslint --report-unused-disable-directives --resolve-plugins-relative-to . --quiet packages/pob"
|
|
@@ -40,10 +41,10 @@
|
|
|
40
41
|
"@pob/eslint-config": "50.0.0",
|
|
41
42
|
"@pob/eslint-config-typescript": "50.0.0",
|
|
42
43
|
"@pob/eslint-config-typescript-react": "50.0.0",
|
|
43
|
-
"@pob/sort-eslint-config": "4.1.
|
|
44
|
-
"@pob/sort-object": "5.1.
|
|
45
|
-
"@pob/sort-pkg": "5.
|
|
46
|
-
"eslint": "8.
|
|
44
|
+
"@pob/sort-eslint-config": "4.1.1",
|
|
45
|
+
"@pob/sort-object": "5.1.1",
|
|
46
|
+
"@pob/sort-pkg": "5.2.0",
|
|
47
|
+
"eslint": "8.36.0",
|
|
47
48
|
"findup-sync": "^5.0.0",
|
|
48
49
|
"git-remote-url": "^1.0.1",
|
|
49
50
|
"github-username": "^6.0.0",
|
|
@@ -52,19 +53,19 @@
|
|
|
52
53
|
"json5": "^2.2.2",
|
|
53
54
|
"lodash.camelcase": "^4.3.0",
|
|
54
55
|
"lodash.kebabcase": "^4.1.1",
|
|
55
|
-
"mem-fs": "2.
|
|
56
|
-
"mem-fs-editor": "9.
|
|
57
|
-
"minimist": "1.2.
|
|
58
|
-
"node-fetch": "3.3.
|
|
56
|
+
"mem-fs": "2.3.0",
|
|
57
|
+
"mem-fs-editor": "9.7.0",
|
|
58
|
+
"minimist": "1.2.8",
|
|
59
|
+
"node-fetch": "3.3.1",
|
|
59
60
|
"parse-author": "2.0.0",
|
|
60
|
-
"pob-dependencies": "7.
|
|
61
|
-
"prettier": "2.8.
|
|
61
|
+
"pob-dependencies": "7.6.0",
|
|
62
|
+
"prettier": "2.8.4",
|
|
62
63
|
"semver": "7.3.8",
|
|
63
|
-
"yeoman-environment": "3.
|
|
64
|
-
"yeoman-generator": "5.
|
|
64
|
+
"yeoman-environment": "3.15.1",
|
|
65
|
+
"yeoman-generator": "5.8.0"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
|
-
"@pob/root": "7.
|
|
68
|
+
"@pob/root": "7.6.0"
|
|
68
69
|
},
|
|
69
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "e5930068baa1efff95c4918b66a1c8c9da3a35a8"
|
|
70
71
|
}
|