pob 22.2.0 → 22.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/lib/generators/common/babel/CommonBabelGenerator.js +0 -69
- package/lib/generators/common/husky/templates/lint-staged.config.cjs.txt +2 -2
- package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +58 -7
- package/lib/generators/core/package/CorePackageGenerator.js +12 -0
- package/lib/generators/monorepo/PobMonorepoGenerator.js +13 -4
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
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
|
+
## [22.3.0](https://github.com/christophehurpeau/pob/compare/pob@22.2.0...pob@22.3.0) (2024-07-30)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **deps:** update @pob/eslint-config to v56.1.0 ([#2149](https://github.com/christophehurpeau/pob/issues/2149)) ([061b9d7](https://github.com/christophehurpeau/pob/commit/061b9d7d43bc1826e1d7fdbebd0c812f37d2c91b))
|
|
11
|
+
* **pob:** move more stuff from commonbabel to commontranspiler ([fad5d29](https://github.com/christophehurpeau/pob/commit/fad5d2902ea91370af3a4218b0624c34e691bad3))
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **pob:** fix template ([035eff7](https://github.com/christophehurpeau/pob/commit/035eff78368cca1e3c60be4ddf44b16eae8b28c2))
|
|
16
|
+
|
|
17
|
+
Version bump for dependency: yarn-workspace-utils
|
|
18
|
+
Version bump for dependency: @pob/root
|
|
19
|
+
|
|
20
|
+
|
|
6
21
|
## [22.2.0](https://github.com/christophehurpeau/pob/compare/pob@22.1.1...pob@22.2.0) (2024-07-27)
|
|
7
22
|
|
|
8
23
|
### Features
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import semver from "semver";
|
|
2
1
|
import Generator from "yeoman-generator";
|
|
3
2
|
import * as packageUtils from "../../../utils/package.js";
|
|
4
3
|
import { copyAndFormatTpl } from "../../../utils/writeAndFormat.js";
|
|
@@ -220,18 +219,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
220
219
|
babelConfig.browserVersions = ["supported"];
|
|
221
220
|
}
|
|
222
221
|
|
|
223
|
-
if (hasInitialPkgPob && pkg.main && !pkg.exports) {
|
|
224
|
-
const result = await this.prompt({
|
|
225
|
-
type: "confirm",
|
|
226
|
-
name: "setupExports",
|
|
227
|
-
message: 'Setup package.json "exports" field based on "main" ?',
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
if (result.setupExports) {
|
|
231
|
-
pkg.exports = pkg.main;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
|
|
235
222
|
const newBabelEnvs = [
|
|
236
223
|
...(babelConfig.nodeVersions || []).map((version) => ({
|
|
237
224
|
target: "node",
|
|
@@ -260,7 +247,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
260
247
|
})),
|
|
261
248
|
];
|
|
262
249
|
|
|
263
|
-
delete pkg.pob.withReact;
|
|
264
250
|
if (newBabelEnvs.length === 0) {
|
|
265
251
|
if (!pkg.pob.bundler || pkg.pob.bundler === "rollup-babel") {
|
|
266
252
|
delete pkg.pob.envs;
|
|
@@ -319,10 +305,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
319
305
|
default() {
|
|
320
306
|
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
321
307
|
const useBabel = this.babelEnvs && this.babelEnvs.length > 0;
|
|
322
|
-
const useTypescript = useBabel || pkg.pob?.typescript;
|
|
323
|
-
const hasTargetNode = useBabel
|
|
324
|
-
? this.babelEnvs.find((env) => env.target === "node")
|
|
325
|
-
: useTypescript; // todo pkg.pob.typescriptTargets
|
|
326
308
|
const hasTargetBrowser = this.babelEnvs.find(
|
|
327
309
|
(env) => env.target === "browser",
|
|
328
310
|
);
|
|
@@ -370,57 +352,6 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
370
352
|
["@babel/preset-env"],
|
|
371
353
|
);
|
|
372
354
|
|
|
373
|
-
/* engines */
|
|
374
|
-
|
|
375
|
-
if (hasTargetNode) {
|
|
376
|
-
if (!pkg.engines) pkg.engines = {};
|
|
377
|
-
const minNodeVersion = useBabel
|
|
378
|
-
? Math.min(
|
|
379
|
-
...this.babelEnvs
|
|
380
|
-
.filter((env) => env.target === "node")
|
|
381
|
-
.map((env) => env.version),
|
|
382
|
-
)
|
|
383
|
-
: // eslint-disable-next-line unicorn/no-unreadable-iife
|
|
384
|
-
(() => (this.options.onlyLatestLTS ? "20" : "18"))();
|
|
385
|
-
switch (String(minNodeVersion)) {
|
|
386
|
-
case "10":
|
|
387
|
-
case "12":
|
|
388
|
-
case "14":
|
|
389
|
-
case "16":
|
|
390
|
-
case "18":
|
|
391
|
-
pkg.engines.node = ">=18.12.0";
|
|
392
|
-
break;
|
|
393
|
-
case "20":
|
|
394
|
-
pkg.engines.node = ">=20.9.0";
|
|
395
|
-
break;
|
|
396
|
-
default:
|
|
397
|
-
throw new Error(`Invalid min node version: ${minNodeVersion}`);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
if (pkg.dependencies && pkg.dependencies["@types/node"]) {
|
|
401
|
-
pkg.dependencies["@types/node"] = `>=${minNodeVersion}.0.0`;
|
|
402
|
-
}
|
|
403
|
-
if (
|
|
404
|
-
pkg.devDependencies &&
|
|
405
|
-
pkg.devDependencies["@types/node"] &&
|
|
406
|
-
!semver.satisfies(
|
|
407
|
-
pkg.devDependencies["@types/node"],
|
|
408
|
-
`>=${minNodeVersion}.0.0`,
|
|
409
|
-
)
|
|
410
|
-
) {
|
|
411
|
-
pkg.devDependencies["@types/node"] = `>=${minNodeVersion}.0.0`;
|
|
412
|
-
}
|
|
413
|
-
} else {
|
|
414
|
-
packageUtils.removeDependencies(pkg, ["@types/node"]);
|
|
415
|
-
packageUtils.removeDevDependencies(pkg, ["@types/node"]);
|
|
416
|
-
// Supports oldest current or active LTS version of node
|
|
417
|
-
if (this.options.onlyLatestLTS) {
|
|
418
|
-
pkg.engines.node = ">=20.9.0";
|
|
419
|
-
} else {
|
|
420
|
-
pkg.engines.node = ">=18.12.0";
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
355
|
/* browserslist */
|
|
425
356
|
|
|
426
357
|
if (hasTargetBrowser) {
|
|
@@ -302,13 +302,6 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
302
302
|
pkg.types = "./lib/index.d.ts";
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
-
if (!pkg.engines) pkg.engines = {};
|
|
306
|
-
if (
|
|
307
|
-
!pkg.engines.node ||
|
|
308
|
-
semver.lt(semver.minVersion(pkg.engines.node), "18.0.0")
|
|
309
|
-
) {
|
|
310
|
-
pkg.engines.node = ">=18.0.0";
|
|
311
|
-
}
|
|
312
305
|
}
|
|
313
306
|
|
|
314
307
|
delete pkg["browser-dev"];
|
|
@@ -518,6 +511,64 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
518
511
|
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
519
512
|
const entries = pkg.pob.entries || ["index"];
|
|
520
513
|
const envs = pkg.pob.envs || pkg.pob.babelEnvs;
|
|
514
|
+
delete pkg.pob.withReact;
|
|
515
|
+
|
|
516
|
+
const hasTargetNode = envs && envs.some((env) => env.target === "node");
|
|
517
|
+
|
|
518
|
+
if (!pkg.engines) pkg.engines = {};
|
|
519
|
+
|
|
520
|
+
if (hasTargetNode || !envs) {
|
|
521
|
+
const minNodeVersion = envs
|
|
522
|
+
? Math.min(
|
|
523
|
+
...envs
|
|
524
|
+
.filter((env) => env.target === "node")
|
|
525
|
+
.map((env) => env.version),
|
|
526
|
+
)
|
|
527
|
+
: // eslint-disable-next-line unicorn/no-unreadable-iife
|
|
528
|
+
(() => (this.options.onlyLatestLTS ? "20" : "18"))();
|
|
529
|
+
|
|
530
|
+
switch (String(minNodeVersion)) {
|
|
531
|
+
case "10":
|
|
532
|
+
case "12":
|
|
533
|
+
case "14":
|
|
534
|
+
case "16":
|
|
535
|
+
case "18":
|
|
536
|
+
pkg.engines.node = ">=18.12.0";
|
|
537
|
+
break;
|
|
538
|
+
case "20":
|
|
539
|
+
pkg.engines.node = ">=20.9.0";
|
|
540
|
+
break;
|
|
541
|
+
default:
|
|
542
|
+
throw new Error(`Invalid min node version: ${minNodeVersion}`);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (pkg.dependencies && pkg.dependencies["@types/node"]) {
|
|
546
|
+
pkg.dependencies["@types/node"] = `>=${minNodeVersion}.0.0`;
|
|
547
|
+
}
|
|
548
|
+
if (
|
|
549
|
+
pkg.devDependencies &&
|
|
550
|
+
pkg.devDependencies["@types/node"] &&
|
|
551
|
+
!semver.satisfies(
|
|
552
|
+
pkg.devDependencies["@types/node"],
|
|
553
|
+
`>=${minNodeVersion}.0.0`,
|
|
554
|
+
)
|
|
555
|
+
) {
|
|
556
|
+
pkg.devDependencies["@types/node"] = `>=${minNodeVersion}.0.0`;
|
|
557
|
+
}
|
|
558
|
+
} else {
|
|
559
|
+
packageUtils.removeDependencies(pkg, ["@types/node"]);
|
|
560
|
+
packageUtils.removeDevDependencies(pkg, ["@types/node"]);
|
|
561
|
+
|
|
562
|
+
// Supports oldest current or active LTS version of node
|
|
563
|
+
const minVersion = this.options.onlyLatestLTS ? "20.9.0" : "18.12.0";
|
|
564
|
+
|
|
565
|
+
if (
|
|
566
|
+
!pkg.engines.node ||
|
|
567
|
+
semver.lt(semver.minVersion(pkg.engines.node), minVersion)
|
|
568
|
+
) {
|
|
569
|
+
pkg.engines.node = `>=${minVersion}`;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
521
572
|
|
|
522
573
|
this.fs.delete("rollup.config.js");
|
|
523
574
|
if (
|
|
@@ -66,6 +66,18 @@ export default class CorePackageGenerator extends Generator {
|
|
|
66
66
|
delete pkg.packageManager;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
if (pkg.pob && pkg.main && !pkg.exports) {
|
|
70
|
+
const result = await this.prompt({
|
|
71
|
+
type: "confirm",
|
|
72
|
+
name: "setupExports",
|
|
73
|
+
message: 'Setup package.json "exports" field based on "main" ?',
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (result.setupExports) {
|
|
77
|
+
pkg.exports = pkg.main;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
69
81
|
if (!this.options.updateOnly) {
|
|
70
82
|
if (this.options.isMonorepo && this.options.isRoot) {
|
|
71
83
|
pkg.private = true;
|
|
@@ -322,6 +322,13 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
322
322
|
writing() {
|
|
323
323
|
if (!this.options.isAppProject) {
|
|
324
324
|
const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
|
|
325
|
+
const rollupKinds = new Set();
|
|
326
|
+
|
|
327
|
+
this.packages.forEach((pkg) => {
|
|
328
|
+
if (pkg.pob?.bundler && pkg.pob.bundler.startsWith("rollup-")) {
|
|
329
|
+
rollupKinds.add(pkg.pob.bundler.slice("rollup-".length));
|
|
330
|
+
}
|
|
331
|
+
});
|
|
325
332
|
|
|
326
333
|
const rollupConfigs = [];
|
|
327
334
|
this.packageLocations.forEach((location) => {
|
|
@@ -351,10 +358,12 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
351
358
|
build: "yarn clean:build && rollup --config rollup.config.mjs",
|
|
352
359
|
watch: "yarn clean:build && rollup --config rollup.config.mjs --watch",
|
|
353
360
|
});
|
|
354
|
-
packageUtils.addOrRemoveDevDependencies(
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
361
|
+
packageUtils.addOrRemoveDevDependencies(
|
|
362
|
+
pkg,
|
|
363
|
+
rollupConfigs.length > 0 &&
|
|
364
|
+
(rollupKinds.size === 0 || rollupKinds.has("babel")),
|
|
365
|
+
["@babel/core", "pob-babel"],
|
|
366
|
+
);
|
|
358
367
|
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
359
368
|
}
|
|
360
369
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.3.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"pob": {},
|
|
41
41
|
"prettier": "@pob/root/prettier-config",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@pob/eslint-config": "56.
|
|
44
|
-
"@pob/eslint-config-typescript": "56.
|
|
45
|
-
"@pob/eslint-config-typescript-react": "56.
|
|
43
|
+
"@pob/eslint-config": "56.1.0",
|
|
44
|
+
"@pob/eslint-config-typescript": "56.1.0",
|
|
45
|
+
"@pob/eslint-config-typescript-react": "56.1.0",
|
|
46
46
|
"@pob/sort-eslint-config": "5.3.1",
|
|
47
47
|
"@pob/sort-object": "6.3.1",
|
|
48
48
|
"@pob/sort-pkg": "7.3.0",
|
|
@@ -64,17 +64,17 @@
|
|
|
64
64
|
"mem-fs-editor": "11.0.1",
|
|
65
65
|
"minimist": "1.2.8",
|
|
66
66
|
"parse-author": "2.0.0",
|
|
67
|
-
"pob-dependencies": "13.
|
|
67
|
+
"pob-dependencies": "13.3.0",
|
|
68
68
|
"prettier": "3.3.3",
|
|
69
69
|
"semver": "7.6.3",
|
|
70
70
|
"validate-npm-package-name": "^5.0.0",
|
|
71
|
-
"yarn-workspace-utils": "5.1.
|
|
71
|
+
"yarn-workspace-utils": "5.1.1",
|
|
72
72
|
"yeoman-environment": "4.4.1",
|
|
73
73
|
"yeoman-generator": "7.3.2"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@pob/root": "12.2.
|
|
77
|
-
"@types/node": "20.14.
|
|
78
|
-
"typescript": "5.4
|
|
76
|
+
"@pob/root": "12.2.1",
|
|
77
|
+
"@types/node": "20.14.13",
|
|
78
|
+
"typescript": "5.5.4"
|
|
79
79
|
}
|
|
80
80
|
}
|