pob 22.1.1 → 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 CHANGED
@@ -3,6 +3,42 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [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
+
21
+ ## [22.2.0](https://github.com/christophehurpeau/pob/compare/pob@22.1.1...pob@22.2.0) (2024-07-27)
22
+
23
+ ### Features
24
+
25
+ * **deps:** update dependency yeoman-generator to v7.3.0 ([#2098](https://github.com/christophehurpeau/pob/issues/2098)) ([5e2295b](https://github.com/christophehurpeau/pob/commit/5e2295b2e983752f7eaf42c22d30cced22c5fce6))
26
+ * **deps:** update yarn monorepo ([#2087](https://github.com/christophehurpeau/pob/issues/2087)) ([fa9d77b](https://github.com/christophehurpeau/pob/commit/fa9d77bf2cfe11d736d288362ad5df9255533e65))
27
+
28
+ ### Bug Fixes
29
+
30
+ * **deps:** update dependency prettier to v3.3.2 ([#2089](https://github.com/christophehurpeau/pob/issues/2089)) ([cc20ddd](https://github.com/christophehurpeau/pob/commit/cc20ddd10f743f57b0f13e3630b2945cdb1104a9))
31
+ * **deps:** update dependency prettier to v3.3.3 ([#2140](https://github.com/christophehurpeau/pob/issues/2140)) ([c44959e](https://github.com/christophehurpeau/pob/commit/c44959ed852e087419bf5b61f9460e6a3e02b789))
32
+ * **deps:** update dependency semver to v7.6.3 ([#2141](https://github.com/christophehurpeau/pob/issues/2141)) ([047d95c](https://github.com/christophehurpeau/pob/commit/047d95c38ce1e5b267be78579400620b99c7de64))
33
+ * **deps:** update dependency yeoman-generator to v7.3.1 ([#2099](https://github.com/christophehurpeau/pob/issues/2099)) ([a632c39](https://github.com/christophehurpeau/pob/commit/a632c39899b44a4222e9e48fe1f5c1b038b60824))
34
+ * **deps:** update dependency yeoman-generator to v7.3.2 ([#2118](https://github.com/christophehurpeau/pob/issues/2118)) ([f385316](https://github.com/christophehurpeau/pob/commit/f3853160b128a36843e14ef63a3d8d58d53dd08a))
35
+ * **deps:** update yarn monorepo ([#2111](https://github.com/christophehurpeau/pob/issues/2111)) ([7abc59d](https://github.com/christophehurpeau/pob/commit/7abc59d18cf9f3ea2ca9b763be4d4c9477253bcb))
36
+
37
+ Version bump for dependency: @pob/sort-pkg
38
+ Version bump for dependency: yarn-workspace-utils
39
+ Version bump for dependency: @pob/root
40
+
41
+
6
42
  ## [22.1.1](https://github.com/christophehurpeau/pob/compare/pob@22.1.0...pob@22.1.1) (2024-06-08)
7
43
 
8
44
  Version bump for dependency: @pob/root
@@ -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) {
@@ -1,5 +1,5 @@
1
- 'use strict';
1
+ "use strict";
2
2
 
3
- const createLintStagedConfig = require('@pob/root/createLintStagedConfig.cjs');
3
+ const createLintStagedConfig = require("@pob/root/createLintStagedConfig.cjs");
4
4
 
5
5
  module.exports = createLintStagedConfig();
@@ -178,7 +178,7 @@ export default class CommonTestingGenerator extends Generator {
178
178
  let hasReact =
179
179
  withTypescript &&
180
180
  (this.options.monorepo
181
- ? yoConfigPobMonorepo.react ?? packageUtils.hasReact(pkg)
181
+ ? (yoConfigPobMonorepo.react ?? packageUtils.hasReact(pkg))
182
182
  : packageUtils.hasReact(pkg));
183
183
  const testRunner = globalTesting
184
184
  ? inMonorepo.pobConfig.monorepo.testRunner || "jest"
@@ -136,8 +136,8 @@ export default class CommonTranspilerGenerator extends Generator {
136
136
  withTypescript &&
137
137
  (pkg.pob.rollup === false
138
138
  ? "tsc"
139
- : pkg.pob.bundler ??
140
- (pkg.pob.typescript ? "rollup-typescript" : "rollup-babel"));
139
+ : (pkg.pob.bundler ??
140
+ (pkg.pob.typescript ? "rollup-typescript" : "rollup-babel")));
141
141
  this.bundler = bundler;
142
142
 
143
143
  const cleanCommand = (() => {
@@ -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(pkg, rollupConfigs.length, [
355
- "@babel/core",
356
- "pob-babel",
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.1.1",
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,16 +40,16 @@
40
40
  "pob": {},
41
41
  "prettier": "@pob/root/prettier-config",
42
42
  "dependencies": {
43
- "@pob/eslint-config": "56.0.0",
44
- "@pob/eslint-config-typescript": "56.0.0",
45
- "@pob/eslint-config-typescript-react": "56.0.0",
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
- "@pob/sort-pkg": "7.2.0",
48
+ "@pob/sort-pkg": "7.3.0",
49
49
  "@prettier/sync": "0.5.2",
50
50
  "@types/inquirer": "9.0.7",
51
- "@yarnpkg/cli": "4.2.2",
52
- "@yarnpkg/core": "4.0.5",
51
+ "@yarnpkg/cli": "4.3.1",
52
+ "@yarnpkg/core": "4.1.1",
53
53
  "@yarnpkg/fslib": "3.1.0",
54
54
  "@yeoman/types": "1.2.0",
55
55
  "eslint": "8.57.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.1.0",
68
- "prettier": "3.3.1",
69
- "semver": "7.6.2",
67
+ "pob-dependencies": "13.3.0",
68
+ "prettier": "3.3.3",
69
+ "semver": "7.6.3",
70
70
  "validate-npm-package-name": "^5.0.0",
71
- "yarn-workspace-utils": "5.0.0",
71
+ "yarn-workspace-utils": "5.1.1",
72
72
  "yeoman-environment": "4.4.1",
73
- "yeoman-generator": "7.2.0"
73
+ "yeoman-generator": "7.3.2"
74
74
  },
75
75
  "devDependencies": {
76
- "@pob/root": "12.1.1",
77
- "@types/node": "20.14.2",
78
- "typescript": "5.4.5"
76
+ "@pob/root": "12.2.1",
77
+ "@types/node": "20.14.13",
78
+ "typescript": "5.5.4"
79
79
  }
80
80
  }