pob 24.5.0 → 25.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 CHANGED
@@ -3,6 +3,36 @@
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
+ ## [25.0.0](https://github.com/christophehurpeau/pob/compare/pob@24.5.0...pob@25.0.0) (2024-12-10)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * drop legacy module/browser/react-native replaced by exports
11
+
12
+ ### Features
13
+
14
+ * add src/test-setup.ts support ([d469e23](https://github.com/christophehurpeau/pob/commit/d469e23a31b2ebd0477daf06a01e1c95b1809c9d))
15
+ * **deps:** update @pob/eslint-config to v59 (major) ([#2329](https://github.com/christophehurpeau/pob/issues/2329)) ([5019b13](https://github.com/christophehurpeau/pob/commit/5019b13dba092342eee72f0d6d766cf2de864555))
16
+ * **deps:** update dependency eslint to v9.16.0 ([#2308](https://github.com/christophehurpeau/pob/issues/2308)) ([78afd96](https://github.com/christophehurpeau/pob/commit/78afd962ab7d5ed1d735d6a90097f8b010c1621d))
17
+ * drop legacy module/browser/react-native replaced by exports ([b1363ca](https://github.com/christophehurpeau/pob/commit/b1363ca254fb08179a019d2b2f329936cb7dae2d))
18
+ * start preparing cursorignore ([6cec7ef](https://github.com/christophehurpeau/pob/commit/6cec7ef24ef29074b447eb33d3a27951f0a14237))
19
+ * support files lib/index.js rollup-plugin-svgr ([e7c3348](https://github.com/christophehurpeau/pob/commit/e7c3348daf1585ea467e29a6b460c97c280904c2))
20
+
21
+ ### Bug Fixes
22
+
23
+ * fix entryDistName ([1e3d4e4](https://github.com/christophehurpeau/pob/commit/1e3d4e46ceb7afa7bc4b3683b788cbbf5d0816ae))
24
+ * fix github ci required check for node 22.x ([4852f1b](https://github.com/christophehurpeau/pob/commit/4852f1b6ea097e156e27606b09e7bf17c6da44a8))
25
+ * only run checks on latest lts version ([1b5ff47](https://github.com/christophehurpeau/pob/commit/1b5ff47050eed0f6e200120a321167c647f70e03))
26
+
27
+ ### Reverts
28
+
29
+ * Revert "feat!: drop legacy module/browser/react-native replaced by exports" ([5971c66](https://github.com/christophehurpeau/pob/commit/5971c669ffd534843a3ea9979a70a0cb1d3d51f8))
30
+
31
+ Version bump for dependency: @pob/sort-pkg
32
+ Version bump for dependency: yarn-workspace-utils
33
+ Version bump for dependency: @pob/root
34
+
35
+
6
36
  ## [24.5.0](https://github.com/christophehurpeau/pob/compare/pob@24.4.0...pob@24.5.0) (2024-12-05)
7
37
 
8
38
  ### Bug Fixes
@@ -338,6 +338,7 @@ export default class PobAppGenerator extends Generator {
338
338
  withBabel: babel,
339
339
  paths: ignorePaths.join("\n"),
340
340
  buildInGit: false,
341
+ buildDirectory,
341
342
  });
342
343
 
343
344
  this.composeWith("pob:core:npm", { enable: false });
@@ -327,7 +327,7 @@ export default class CommonTestingGenerator extends Generator {
327
327
  : ""
328
328
  }node ${
329
329
  this.options.typescript ? `${tsTestLoaderOption} ` : ""
330
- }--test${experimentalTestCoverage && (coverage || coverageJson) ? " --experimental-test-coverage" : ""} ${this.options.monorepo ? `${workspacesPattern}/` : ""}${`${
330
+ }${this.fs.exists("src/test-setup.ts") ? "--import ./src/test-setup.ts " : ""}--test${experimentalTestCoverage && (coverage || coverageJson) ? " --experimental-test-coverage" : ""} ${this.options.monorepo ? `${workspacesPattern}/` : ""}${`${
331
331
  hasTestFolder ? "test/*" : `${this.options.srcDirectory}/**/*.test`
332
332
  }.${this.options.typescript ? "ts" : "js"}`}`;
333
333
  }
@@ -433,7 +433,7 @@ export default class CommonTranspilerGenerator extends Generator {
433
433
  if (formats && formats.includes("cjs")) {
434
434
  exportTarget.require = `./${
435
435
  this.options.buildDirectory
436
- }/index-${target}${version || ""}.cjs.js`;
436
+ }/${entryDistName}-${target}${version || ""}.cjs.js`;
437
437
  }
438
438
  }
439
439
 
@@ -184,7 +184,7 @@ export default class CoreCIGenerator extends Generator {
184
184
  testing && `test (${maintenanceLTS})`,
185
185
  ].filter(Boolean)
186
186
  : [
187
- !this.options.onlyLatestLTS && `build (${maintenanceLTS}.x)`,
187
+ !this.options.onlyLatestLTS && `build (${latestLTS}.x)`,
188
188
  `build (${maintenanceLTS}.x)`,
189
189
  ].filter(Boolean)),
190
190
  );
@@ -37,6 +37,7 @@ jobs:
37
37
  <% if (checks) { -%>
38
38
  - name: Checks
39
39
  run: <%= packageManager %> run checks
40
+ if: startsWith(matrix.node-version, '22.')
40
41
 
41
42
  <% } -%>
42
43
  <% if (build) { -%>
@@ -52,10 +52,18 @@ export default class CoreGitignoreGenerator extends Generator {
52
52
  default: true,
53
53
  description: "Build is saved in git.",
54
54
  });
55
+
56
+ this.option("buildDirectory", {
57
+ type: String,
58
+ required: false,
59
+ default: "",
60
+ description: "Build directory.",
61
+ });
55
62
  }
56
63
 
57
64
  writing() {
58
- const dest = this.destinationPath(".gitignore");
65
+ const gitignorePath = this.destinationPath(".gitignore");
66
+ const cursorignorePath = this.destinationPath(".cursorignore");
59
67
  const withBabel = this.options.withBabel;
60
68
 
61
69
  if (
@@ -64,9 +72,9 @@ export default class CoreGitignoreGenerator extends Generator {
64
72
  !this.options.paths &&
65
73
  !withBabel
66
74
  ) {
67
- this.fs.delete(dest);
75
+ this.fs.delete(gitignorePath);
68
76
  } else {
69
- this.fs.copyTpl(this.templatePath("gitignore.ejs"), dest, {
77
+ this.fs.copyTpl(this.templatePath("gitignore.ejs"), gitignorePath, {
70
78
  root: this.options.root,
71
79
  documentation: this.options.documentation,
72
80
  testing: this.options.testing,
@@ -77,5 +85,14 @@ export default class CoreGitignoreGenerator extends Generator {
77
85
  buildInGit: this.options.buildInGit,
78
86
  });
79
87
  }
88
+
89
+ // if (!this.options.root) {
90
+ this.fs.delete(cursorignorePath);
91
+ // } else {
92
+ // this.fs.write(
93
+ // cursorignorePath,
94
+ // `${["/.yarn", this.options.buildDirectory].join("\n")}\n`,
95
+ // );
96
+ // }
80
97
  }
81
98
  }
@@ -39,39 +39,43 @@ export default class CoreNpmGenerator extends Generator {
39
39
  }
40
40
 
41
41
  if (!pkg.private && this.options.enable) {
42
- const files = new Set([
43
- this.options.srcDirectory,
44
- this.options.distDirectory,
45
- ]);
42
+ if (pkg.files.length === 1 && pkg.files[0] === "lib/index.js") {
43
+ // see rollup-plugin-svgr
44
+ } else {
45
+ const files = new Set([
46
+ this.options.srcDirectory,
47
+ this.options.distDirectory,
48
+ ]);
46
49
 
47
- if (pkg.bin) {
48
- files.add("bin");
49
- }
50
+ if (pkg.bin) {
51
+ files.add("bin");
52
+ }
50
53
 
51
- if (pkg.exports) {
52
- Object.values(pkg.exports).forEach((value) => {
53
- if (typeof value === "string" && value.startsWith("./tsconfigs/")) {
54
- files.add("tsconfigs");
55
- }
56
- if (
57
- typeof value === "string" &&
58
- value.startsWith("./") &&
59
- value !== "./package.json" &&
60
- ![...files].some((file) => value.startsWith(`./${file}/`))
61
- ) {
62
- files.add(value.slice("./".length));
63
- }
64
- });
65
- }
66
- if (pkg.pob?.extraEntries) {
67
- pkg.pob?.extraEntries.forEach((extraEntry) => {
68
- if (extraEntry.directory) {
69
- files.add(extraEntry.directory);
70
- }
71
- });
72
- }
54
+ if (pkg.exports) {
55
+ Object.values(pkg.exports).forEach((value) => {
56
+ if (typeof value === "string" && value.startsWith("./tsconfigs/")) {
57
+ files.add("tsconfigs");
58
+ }
59
+ if (
60
+ typeof value === "string" &&
61
+ value.startsWith("./") &&
62
+ value !== "./package.json" &&
63
+ ![...files].some((file) => value.startsWith(`./${file}/`))
64
+ ) {
65
+ files.add(value.slice("./".length));
66
+ }
67
+ });
68
+ }
69
+ if (pkg.pob?.extraEntries) {
70
+ pkg.pob?.extraEntries.forEach((extraEntry) => {
71
+ if (extraEntry.directory) {
72
+ files.add(extraEntry.directory);
73
+ }
74
+ });
75
+ }
73
76
 
74
- pkg.files = [...files].filter(Boolean);
77
+ pkg.files = [...files].filter(Boolean);
78
+ }
75
79
  } else {
76
80
  delete pkg.files;
77
81
  }
@@ -379,6 +379,8 @@ export default class PobLibGenerator extends Generator {
379
379
  testRunner: this.pobjson.testRunner,
380
380
  });
381
381
 
382
+ const buildDirectory = withBabel || withTypescript ? "dist" : "";
383
+
382
384
  // must be after doc, testing
383
385
  this.composeWith("pob:core:gitignore", {
384
386
  root: !inMonorepo,
@@ -386,12 +388,13 @@ export default class PobLibGenerator extends Generator {
386
388
  typescript: withTypescript,
387
389
  documentation: this.pobjson.documentation,
388
390
  testing: !!this.pobjson.testing,
391
+ buildDirectory,
389
392
  });
390
393
 
391
394
  this.composeWith("pob:core:npm", {
392
395
  enable: !pkg.private,
393
396
  srcDirectory: withBabel || withTypescript ? "src" : "lib",
394
- distDirectory: withBabel || withTypescript ? "dist" : "",
397
+ distDirectory: buildDirectory,
395
398
  });
396
399
  }
397
400
 
@@ -1,3 +1,5 @@
1
+ /* eslint-disable regexp/match-any */
2
+ /* eslint-disable regexp/no-super-linear-backtracking */
1
3
  import camelCase from "lodash.camelcase";
2
4
  import Generator from "yeoman-generator";
3
5
  import inMonorepo from "../../../utils/inMonorepo.js";
@@ -47,16 +49,16 @@ export default class LibReadmeGenerator extends Generator {
47
49
 
48
50
  if (this.fs.exists(readmePath)) {
49
51
  const readmeFullContent = this.fs.read(readmePath);
50
- content = readmeFullContent.match(/^<h3[^#*]+([^]+)\[npm-image]:/);
52
+ content = readmeFullContent.match(/^<h3[^#*]+([^]+)\[npm-image\]:/);
51
53
  if (!content) {
52
- content = readmeFullContent.match(/^<h3[^#*]+([^]+)\[daviddm-image]:/);
54
+ content = readmeFullContent.match(/^<h3[^#*]+([^]+)\[daviddm-image\]:/);
53
55
  }
54
56
  if (!content) content = readmeFullContent.match(/^<h3[^#*]+([^]+)$/);
55
57
  if (!content) {
56
- content = readmeFullContent.match(/^#[^#*]+([^]+)\[npm-image]:/);
58
+ content = readmeFullContent.match(/^#[^#*]+([^]+)\[npm-image\]:/);
57
59
  }
58
60
  if (!content) {
59
- content = readmeFullContent.match(/^#[^#*]+([^]+)\[daviddm-image]:/);
61
+ content = readmeFullContent.match(/^#[^#*]+([^]+)\[daviddm-image\]:/);
60
62
  }
61
63
  if (!content) content = readmeFullContent.match(/^#[^#*]+([^]+)$/);
62
64
  content = content ? content[1].trim() : readmeFullContent;
@@ -5,8 +5,8 @@ import { getPluginConfiguration } from "@yarnpkg/cli";
5
5
  import { Configuration, Project } from "@yarnpkg/core";
6
6
  import { ppath } from "@yarnpkg/fslib";
7
7
  import {
8
- buildTopologicalOrderBatches,
9
8
  buildDependenciesMaps,
9
+ buildTopologicalOrderBatches,
10
10
  getWorkspaceName,
11
11
  } from "yarn-workspace-utils";
12
12
  import Generator from "yeoman-generator";
@@ -288,6 +288,8 @@ export default class PobMonorepoGenerator extends Generator {
288
288
  typescript: this.pobLernaConfig.typescript,
289
289
  documentation: this.pobLernaConfig.documentation,
290
290
  testing: this.pobLernaConfig.testing,
291
+ // todo: fix this using workspaces
292
+ // buildDirectory: this.pobLernaConfig.typescript ? `/*/build` : "",
291
293
  });
292
294
 
293
295
  this.composeWith("pob:common:remove-old-dependencies");
@@ -1,4 +1,4 @@
1
- import { readdirSync, existsSync } from "node:fs";
1
+ import { existsSync, readdirSync } from "node:fs";
2
2
  import Generator from "yeoman-generator";
3
3
  import * as packageUtils from "../../../utils/package.js";
4
4
  import { writeAndFormatJson } from "../../../utils/writeAndFormat.js";
@@ -1,5 +1,5 @@
1
1
  import { spawnSync } from "node:child_process";
2
- import { readdirSync, existsSync } from "node:fs";
2
+ import { existsSync, readdirSync } from "node:fs";
3
3
  import Generator from "yeoman-generator";
4
4
  import * as packageUtils from "../../../utils/package.js";
5
5
  import { copyAndFormatTpl } from "../../../utils/writeAndFormat.js";
@@ -159,7 +159,9 @@ export default class MonorepoWorkspacesGenerator extends Generator {
159
159
 
160
160
  if (this.fs.exists(readmePath)) {
161
161
  const readmeFullContent = this.fs.read(readmePath);
162
+ // eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/match-any
162
163
  content = readmeFullContent.match(/^<h3[^#*]+([^]+)$/);
164
+ // eslint-disable-next-line regexp/no-super-linear-backtracking, regexp/match-any
163
165
  if (!content) content = readmeFullContent.match(/^#[^#*]+([^]+)$/);
164
166
  content = content ? content[1].trim() : readmeFullContent;
165
167
  }
package/lib/pob.js CHANGED
@@ -3,10 +3,10 @@
3
3
  import { execSync, spawnSync } from "node:child_process";
4
4
  import fs, {
5
5
  existsSync,
6
- writeFileSync,
7
- readFileSync,
8
6
  mkdirSync,
7
+ readFileSync,
9
8
  readdirSync,
9
+ writeFileSync,
10
10
  } from "node:fs";
11
11
  import path from "node:path";
12
12
  import minimist from "minimist";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "24.5.0",
3
+ "version": "25.0.0",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
@@ -41,19 +41,19 @@
41
41
  },
42
42
  "prettier": "@pob/root/prettier-config",
43
43
  "dependencies": {
44
- "@pob/eslint-config": "58.1.0",
45
- "@pob/eslint-config-typescript": "58.1.0",
46
- "@pob/eslint-config-typescript-react": "58.1.0",
44
+ "@pob/eslint-config": "59.0.0",
45
+ "@pob/eslint-config-typescript": "59.1.2",
46
+ "@pob/eslint-config-typescript-react": "59.1.2",
47
47
  "@pob/sort-eslint-config": "7.0.0",
48
48
  "@pob/sort-object": "8.0.0",
49
- "@pob/sort-pkg": "9.0.0",
49
+ "@pob/sort-pkg": "10.0.0",
50
50
  "@prettier/sync": "0.5.2",
51
51
  "@types/inquirer": "9.0.7",
52
52
  "@yarnpkg/cli": "4.5.3",
53
53
  "@yarnpkg/core": "4.1.6",
54
54
  "@yarnpkg/fslib": "3.1.1",
55
55
  "@yeoman/types": "1.5.0",
56
- "eslint": "9.14.0",
56
+ "eslint": "9.16.0",
57
57
  "findup-sync": "^5.0.0",
58
58
  "git-remote-url": "^1.0.1",
59
59
  "github-username": "^7.0.0",
@@ -65,16 +65,16 @@
65
65
  "mem-fs-editor": "11.1.3",
66
66
  "minimist": "1.2.8",
67
67
  "parse-author": "2.0.0",
68
- "pob-dependencies": "15.4.0",
68
+ "pob-dependencies": "16.0.0",
69
69
  "prettier": "3.4.2",
70
70
  "semver": "7.6.3",
71
71
  "validate-npm-package-name": "^6.0.0",
72
- "yarn-workspace-utils": "7.0.2",
72
+ "yarn-workspace-utils": "7.1.0",
73
73
  "yeoman-environment": "4.4.3",
74
74
  "yeoman-generator": "7.3.3"
75
75
  },
76
76
  "devDependencies": {
77
- "@pob/root": "14.4.0",
77
+ "@pob/root": "15.0.0",
78
78
  "@types/node": "22.10.1",
79
79
  "typescript": "5.7.2"
80
80
  }