pob 11.7.0 → 11.8.1
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 +26 -0
- package/lib/generators/app/PobAppGenerator.js +7 -2
- package/lib/generators/app/ignorePaths.js +1 -0
- package/lib/generators/common/babel/CommonBabelGenerator.js +26 -86
- 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 +2 -1
- package/lib/generators/core/vscode/CoreVSCodeGenerator.js +2 -0
- package/lib/generators/core/vscode/templates/settings.json.ejs +6 -0
- package/lib/generators/pob/PobBaseGenerator.js +1 -1
- package/lib/pob.js +51 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,32 @@
|
|
|
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.1](https://github.com/christophehurpeau/pob/compare/pob@11.8.0...pob@11.8.1) (2023-03-19)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* configure target in preset to make sure it is applied ([ad4071d](https://github.com/christophehurpeau/pob/commit/ad4071da757291f6eaa63ade4cfc7ea783eeff57))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [11.8.0](https://github.com/christophehurpeau/pob/compare/pob@11.7.0...pob@11.8.0) (2023-03-19)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* add command to help migrate to monorepo ([5274068](https://github.com/christophehurpeau/pob/commit/52740680f63a0949a622831f38268d6d10007a07))
|
|
21
|
+
* drop webpack 4 legacy aliases ([e714540](https://github.com/christophehurpeau/pob/commit/e7145401e52dfe3cc6eff40f2f220b4b81bce561))
|
|
22
|
+
* **pob:** app add "node-library" ([bef77f5](https://github.com/christophehurpeau/pob/commit/bef77f5caee0b89aee5540c82146fea962acf6ff))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* fix "pob add" use monorepoArg ([92d4ca5](https://github.com/christophehurpeau/pob/commit/92d4ca5faf27fc1c054fd6c28cb5b8e8256d9f87))
|
|
28
|
+
* fix vscode config jestCommandLine ([434d7ad](https://github.com/christophehurpeau/pob/commit/434d7adfb4e73ba3021d516a149bcd1fb287a479))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
6
32
|
## [11.7.0](https://github.com/christophehurpeau/pob/compare/pob@11.6.0...pob@11.7.0) (2023-03-13)
|
|
7
33
|
|
|
8
34
|
|
|
@@ -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,
|
|
@@ -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,21 @@ 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
|
+
if (pkg.browserslist && pkg.browserslist.modern) {
|
|
421
|
+
delete pkg.browserslist.modern;
|
|
422
|
+
}
|
|
423
|
+
pkg.browserslist = {
|
|
424
|
+
...(Array.isArray(pkg.browserslist) ? {} : pkg.browserslist),
|
|
425
|
+
production: [
|
|
426
|
+
'defaults',
|
|
427
|
+
'> 0.2%',
|
|
428
|
+
'not ie < 12',
|
|
429
|
+
'not safari < 10',
|
|
430
|
+
'not ios_saf < 10',
|
|
431
|
+
],
|
|
432
|
+
// configured in babel preset
|
|
433
|
+
// modern: ['defaults and >1% and supports es6-module'],
|
|
434
|
+
};
|
|
434
435
|
} else if (this.options.isApp && pkg.browserslist) {
|
|
435
436
|
pkg.browserslist = {
|
|
436
437
|
...pkg.browserslist,
|
|
@@ -515,21 +516,10 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
515
516
|
(!env.formats || env.formats.includes('es')),
|
|
516
517
|
);
|
|
517
518
|
|
|
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
519
|
// Legacy "dev" builds
|
|
531
520
|
delete pkg['module:browser'];
|
|
532
521
|
delete pkg['module:browser-dev'];
|
|
522
|
+
delete pkg['module:modern-browsers'];
|
|
533
523
|
delete pkg['module:modern-browsers-dev'];
|
|
534
524
|
delete pkg['module:node'];
|
|
535
525
|
delete pkg['module:node-dev'];
|
|
@@ -543,44 +533,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
543
533
|
delete pkg.browser;
|
|
544
534
|
}
|
|
545
535
|
|
|
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
536
|
/* webpack 5 and node with ESM support */
|
|
585
537
|
if (useBabel) {
|
|
586
538
|
pkg.exports = {
|
|
@@ -690,23 +642,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
690
642
|
|
|
691
643
|
Object.keys(pkg).forEach((key) => {
|
|
692
644
|
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
645
|
delete pkg[key];
|
|
711
646
|
});
|
|
712
647
|
|
|
@@ -739,12 +674,17 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
739
674
|
this.destinationPath('rollup.config.mjs'),
|
|
740
675
|
{
|
|
741
676
|
config: this.options.useAppConfig,
|
|
677
|
+
outDirectory: this.options.buildDirectory,
|
|
742
678
|
},
|
|
743
679
|
);
|
|
744
680
|
} else {
|
|
745
|
-
|
|
746
|
-
this.
|
|
681
|
+
copyAndFormatTpl(
|
|
682
|
+
this.fs,
|
|
683
|
+
this.templatePath('lib.rollup.config.mjs.ejs'),
|
|
747
684
|
this.destinationPath('rollup.config.mjs'),
|
|
685
|
+
{
|
|
686
|
+
outDirectory: this.options.buildDirectory,
|
|
687
|
+
},
|
|
748
688
|
);
|
|
749
689
|
}
|
|
750
690
|
} 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 || {};
|
|
@@ -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": {
|
|
@@ -164,7 +164,7 @@ export default class PobBaseGenerator extends Generator {
|
|
|
164
164
|
|
|
165
165
|
if (!this.inLerna) {
|
|
166
166
|
const splitCIJobs =
|
|
167
|
-
inLerna && inLerna.pobMonorepoConfig
|
|
167
|
+
inLerna && inLerna.pobMonorepoConfig?.packageNames.length > 8;
|
|
168
168
|
this.composeWith('pob:core:git', {
|
|
169
169
|
onlyLatestLTS,
|
|
170
170
|
splitCIJobs,
|
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';
|
|
@@ -224,7 +230,7 @@ if (action === 'add') {
|
|
|
224
230
|
);
|
|
225
231
|
}
|
|
226
232
|
|
|
227
|
-
const packageName =
|
|
233
|
+
const packageName = monorepoArg ? argv._[2] : argv._[1];
|
|
228
234
|
|
|
229
235
|
if (!packageName) {
|
|
230
236
|
console.error('Missing argument: packageName');
|
|
@@ -254,6 +260,48 @@ if (action === 'add') {
|
|
|
254
260
|
process.exit(0);
|
|
255
261
|
}
|
|
256
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
|
+
|
|
257
305
|
const updateOnly = action === 'update';
|
|
258
306
|
const init = action === 'init';
|
|
259
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.1",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@pob/eslint-config-typescript-react": "50.0.0",
|
|
44
44
|
"@pob/sort-eslint-config": "4.1.1",
|
|
45
45
|
"@pob/sort-object": "5.1.1",
|
|
46
|
-
"@pob/sort-pkg": "5.
|
|
46
|
+
"@pob/sort-pkg": "5.2.0",
|
|
47
47
|
"eslint": "8.36.0",
|
|
48
48
|
"findup-sync": "^5.0.0",
|
|
49
49
|
"git-remote-url": "^1.0.1",
|
|
@@ -58,14 +58,14 @@
|
|
|
58
58
|
"minimist": "1.2.8",
|
|
59
59
|
"node-fetch": "3.3.1",
|
|
60
60
|
"parse-author": "2.0.0",
|
|
61
|
-
"pob-dependencies": "7.
|
|
61
|
+
"pob-dependencies": "7.6.1",
|
|
62
62
|
"prettier": "2.8.4",
|
|
63
63
|
"semver": "7.3.8",
|
|
64
64
|
"yeoman-environment": "3.15.1",
|
|
65
65
|
"yeoman-generator": "5.8.0"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
|
-
"@pob/root": "7.
|
|
68
|
+
"@pob/root": "7.6.1"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "831fbb0a3e31c5f4654f8930df6e5de3d07ac90a"
|
|
71
71
|
}
|