pob 34.2.0 → 35.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/lib/generators/app/PobAppGenerator.js +90 -87
  3. package/lib/generators/app/e2e-testing/AppE2ETestingGenerator.js +5 -1
  4. package/lib/generators/app/ignorePaths.js +1 -2
  5. package/lib/generators/common/babel/CommonBabelGenerator.js +3 -3
  6. package/lib/generators/common/format-lint/CommonLintGenerator.js +17 -17
  7. package/lib/generators/common/format-lint/templates/{prettierignore.ejs → oxfmtrc.jsonc.ejs} +15 -8
  8. package/lib/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js +6 -1
  9. package/lib/generators/common/testing/CommonTestingGenerator.js +30 -162
  10. package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +3 -3
  11. package/lib/generators/common/typescript/CommonTypescriptGenerator.js +24 -10
  12. package/lib/generators/common/typescript/templates/tsconfig.json.ejs +6 -5
  13. package/lib/generators/core/bun/templates/bunfig.toml.ejs +1 -1
  14. package/lib/generators/core/ci/CoreCIGenerator.js +4 -12
  15. package/lib/generators/core/ci/templates/github-action-push-workflow-split.yml.ejs +2 -2
  16. package/lib/generators/core/ci/templates/github-action-push-workflow.yml.ejs +2 -2
  17. package/lib/generators/core/package/CorePackageGenerator.js +2 -6
  18. package/lib/generators/core/renovate/CoreRenovateGenerator.js +1 -1
  19. package/lib/generators/core/sort-package/CoreSortPackageGenerator.js +1 -1
  20. package/lib/generators/core/vscode/CoreVSCodeGenerator.js +4 -4
  21. package/lib/generators/core/vscode/templates/settings.json.ejs +1 -1
  22. package/lib/generators/core/yarn/CoreYarnGenerator.js +6 -6
  23. package/lib/generators/lib/PobLibGenerator.js +2 -7
  24. package/lib/generators/lib/doc/LibDocGenerator.js +6 -4
  25. package/lib/generators/lib/readme/LibReadmeGenerator.js +2 -2
  26. package/lib/generators/monorepo/PobMonorepoGenerator.js +2 -2
  27. package/lib/generators/monorepo/lerna/MonorepoLernaGenerator.js +1 -1
  28. package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +4 -5
  29. package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +15 -10
  30. package/lib/generators/pob/PobBaseGenerator.js +4 -4
  31. package/lib/utils/ensureJsonFileFormatted.js +7 -11
  32. package/lib/utils/writeAndFormat.js +16 -31
  33. package/package.json +28 -30
  34. package/lib/generators/common/testing/templates/.eslintrc.json +0 -8
@@ -4,7 +4,7 @@ import sortObject from "@pob/sort-object";
4
4
  import yml from "js-yaml";
5
5
  import { lt } from "semver";
6
6
  import Generator from "yeoman-generator";
7
- import ensureJsonFileFormatted from "../../../utils/ensureJsonFileFormatted.js";
7
+ import { ensureJsonFileFormatted } from "../../../utils/ensureJsonFileFormatted.js";
8
8
  import inMonorepo from "../../../utils/inMonorepo.js";
9
9
  import * as packageUtils from "../../../utils/package.js";
10
10
  import { writeAndFormat } from "../../../utils/writeAndFormat.js";
@@ -43,14 +43,14 @@ export default class CoreYarnGenerator extends Generator {
43
43
  });
44
44
  }
45
45
 
46
- initializing() {
46
+ async initializing() {
47
47
  if (this.options.enable) {
48
48
  // dont use this.fs here, as it will cache the result
49
49
  if (!fs.existsSync(".yarnrc.yml")) {
50
50
  // yarn 2 not yet installed
51
51
  // https://yarnpkg.com/getting-started/install
52
52
  this.spawnSync("yarn", ["set", "version", "stable"]);
53
- ensureJsonFileFormatted(this.destinationPath("package.json"));
53
+ await ensureJsonFileFormatted(this.destinationPath("package.json"));
54
54
  } else {
55
55
  // disabled now that corepack is supposed to set the version used
56
56
  // this.spawnSync('yarn', ['set', 'version', 'stable']);)
@@ -58,7 +58,7 @@ export default class CoreYarnGenerator extends Generator {
58
58
  }
59
59
  }
60
60
 
61
- writing() {
61
+ async writing() {
62
62
  const pkg = this.fs.readJSON(this.destinationPath("package.json"));
63
63
 
64
64
  if (this.options.enable && !inMonorepo && !pkg.private) {
@@ -193,7 +193,7 @@ export default class CoreYarnGenerator extends Generator {
193
193
  }
194
194
 
195
195
  if (!isDeepStrictEqual(config, previousConfig)) {
196
- writeAndFormat(
196
+ await writeAndFormat(
197
197
  this.fs,
198
198
  ".yarnrc.yml",
199
199
  yml.dump(sortObject(config), {
@@ -235,7 +235,7 @@ export default class CoreYarnGenerator extends Generator {
235
235
  this.fs.delete("package-lock.json");
236
236
  this.spawnSync("yarn", ["dedupe"]);
237
237
 
238
- this.spawnSync("yarn", ["prettier", "--write", ".vscode", ".yarnrc.yml"]);
238
+ this.spawnSync("yarn", ["oxfmt", ".vscode", ".yarnrc.yml"]);
239
239
 
240
240
  const pkg = this.fs.readJSON(this.destinationPath("package.json"));
241
241
 
@@ -220,16 +220,12 @@ export default class PobLibGenerator extends Generator {
220
220
  name: "runner",
221
221
  message: "Testing runner ?",
222
222
  when: !this.updateOnly || this.pobjson.testing?.runner === undefined,
223
- default: this.pobjson.testing?.runner || "jest",
223
+ default: this.pobjson.testing?.runner,
224
224
  choices: [
225
225
  {
226
226
  name: "Vitest",
227
227
  value: "vitest",
228
228
  },
229
- {
230
- name: "Jest",
231
- value: "jest",
232
- },
233
229
  {
234
230
  name: "node:test",
235
231
  value: "node",
@@ -299,7 +295,6 @@ export default class PobLibGenerator extends Generator {
299
295
  dom: browser,
300
296
  jsx,
301
297
  updateOnly: this.options.updateOnly,
302
- baseUrl: "none", // causes issues on dist definition files
303
298
  builddefs: true,
304
299
  onlyLatestLTS: this.onlyLatestLTS,
305
300
  srcDirectory: withTypescript ? "src" : "lib",
@@ -317,7 +312,7 @@ export default class PobLibGenerator extends Generator {
317
312
  runner: this.pobjson.testing
318
313
  ? (inMonorepo
319
314
  ? inMonorepo.pobMonorepoConfig.testRunner
320
- : this.pobjson.testing.runner) || "jest"
315
+ : this.pobjson.testing.runner) || ""
321
316
  : undefined,
322
317
  build: withBabel || withTypescript,
323
318
  typescript: withTypescript,
@@ -34,7 +34,7 @@ export default class LibDocGenerator extends Generator {
34
34
  });
35
35
  }
36
36
 
37
- writing() {
37
+ async writing() {
38
38
  if (this.fs.exists(this.destinationPath("jsdoc.conf.json"))) {
39
39
  this.fs.delete(this.destinationPath("jsdoc.conf.json"));
40
40
  }
@@ -53,7 +53,9 @@ export default class LibDocGenerator extends Generator {
53
53
  if (inMonorepo && inMonorepo.root) {
54
54
  const existingConfig = this.fs.readJSON(
55
55
  this.destinationPath("tsconfig.doc.json"),
56
- { typedocOptions: {} },
56
+ {
57
+ typedocOptions: {},
58
+ },
57
59
  );
58
60
  // "external-modulemap": ".*packages/([^/]+)/.*",
59
61
  const packagePaths = JSON.parse(this.options.packagePaths);
@@ -83,7 +85,7 @@ export default class LibDocGenerator extends Generator {
83
85
  );
84
86
  }
85
87
  }
86
- copyAndFormatTpl(
88
+ await copyAndFormatTpl(
87
89
  this.fs,
88
90
  this.templatePath("tsconfig.doc.json.lerna.ejs"),
89
91
  this.destinationPath("tsconfig.doc.json"),
@@ -101,7 +103,7 @@ export default class LibDocGenerator extends Generator {
101
103
  const entryPoints = ((pkg.pob && pkg.pob.entries) || []).map(
102
104
  (entryName) => `src/${entryName}.ts`,
103
105
  );
104
- copyAndFormatTpl(
106
+ await copyAndFormatTpl(
105
107
  this.fs,
106
108
  this.templatePath("tsconfig.doc.json.ejs"),
107
109
  this.destinationPath("tsconfig.doc.json"),
@@ -41,7 +41,7 @@ export default class LibReadmeGenerator extends Generator {
41
41
  });
42
42
  }
43
43
 
44
- writing() {
44
+ async writing() {
45
45
  const pkg = this.fs.readJSON(this.destinationPath("package.json"));
46
46
 
47
47
  const readmePath = this.destinationPath("README.md");
@@ -94,7 +94,7 @@ export default class LibReadmeGenerator extends Generator {
94
94
  );
95
95
  const [, gitHost, gitAccount, gitName] = match || [];
96
96
  try {
97
- copyAndFormatTpl(
97
+ await copyAndFormatTpl(
98
98
  this.fs,
99
99
  this.templatePath("README.md.ejs"),
100
100
  readmePath,
@@ -362,7 +362,7 @@ export default class PobMonorepoGenerator extends Generator {
362
362
  }
363
363
  }
364
364
 
365
- writing() {
365
+ async writing() {
366
366
  if (!this.options.isAppProject) {
367
367
  const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
368
368
  const rollupKinds = new Set();
@@ -385,7 +385,7 @@ export default class PobMonorepoGenerator extends Generator {
385
385
  });
386
386
 
387
387
  if (rollupConfigs.length > 0) {
388
- copyAndFormatTpl(
388
+ await copyAndFormatTpl(
389
389
  this.fs,
390
390
  this.templatePath("monorepo.rollup.config.mjs.ejs"),
391
391
  this.destinationPath("rollup.config.mjs"),
@@ -86,7 +86,7 @@ export default class MonorepoLernaGenerator extends Generator {
86
86
  lernaCurrentConfig.command.publish.ignoreChanges) ||
87
87
  [];
88
88
 
89
- writeAndFormatJson(
89
+ return writeAndFormatJson(
90
90
  this.fs,
91
91
  this.destinationPath("lerna.json"),
92
92
  lernaConfig,
@@ -32,7 +32,6 @@ export default class MonorepoTypescriptGenerator extends Generator {
32
32
  this.option("testRunner", {
33
33
  type: String,
34
34
  required: false,
35
- default: "jest",
36
35
  });
37
36
 
38
37
  this.option("checkOnly", {
@@ -117,7 +116,7 @@ export default class MonorepoTypescriptGenerator extends Generator {
117
116
  }
118
117
 
119
118
  // after pob ran in workspaces
120
- end() {
119
+ async end() {
121
120
  const tsconfigPath = this.destinationPath("tsconfig.json");
122
121
  const tsconfigCheckPath = this.destinationPath("tsconfig.check.json");
123
122
  const tsconfigBuildPath = this.destinationPath("tsconfig.build.json");
@@ -131,7 +130,7 @@ export default class MonorepoTypescriptGenerator extends Generator {
131
130
  } else {
132
131
  const packagePaths = JSON.parse(this.options.packagePaths);
133
132
 
134
- copyAndFormatTpl(
133
+ await copyAndFormatTpl(
135
134
  this.fs,
136
135
  this.templatePath("tsconfig.json.ejs"),
137
136
  tsconfigPath,
@@ -145,7 +144,7 @@ export default class MonorepoTypescriptGenerator extends Generator {
145
144
  this.fs.delete(tsconfigBuildPath);
146
145
  // if (this.options.isAppProject) {
147
146
  // } else {
148
- // copyAndFormatTpl(
147
+ // await copyAndFormatTpl(
149
148
  // this.fs,
150
149
  // this.templatePath('tsconfig.check.json.ejs'),
151
150
  // tsconfigCheckPath,
@@ -156,7 +155,7 @@ export default class MonorepoTypescriptGenerator extends Generator {
156
155
  // },
157
156
  // );
158
157
 
159
- // copyAndFormatTpl(
158
+ // await copyAndFormatTpl(
160
159
  // this.fs,
161
160
  // this.templatePath('tsconfig.build.json.ejs'),
162
161
  // tsconfigBuildPath,
@@ -85,9 +85,9 @@ export default class MonorepoWorkspacesGenerator extends Generator {
85
85
  const packageManager = this.options.packageManager;
86
86
 
87
87
  packageUtils.addScripts(pkg, {
88
- lint: `${packageManager} run lint:prettier && ${packageManager} run lint:eslint`,
89
- "lint:prettier": "pob-root-prettier --check .",
90
- "lint:prettier:fix": "pob-root-prettier --write .",
88
+ lint: `${packageManager} run format && ${packageManager} run lint:eslint`,
89
+ format: "oxfmt",
90
+ "format:check": "oxfmt --check .",
91
91
  "lint:eslint":
92
92
  monorepoConfig &&
93
93
  monorepoConfig.eslint &&
@@ -166,13 +166,18 @@ export default class MonorepoWorkspacesGenerator extends Generator {
166
166
  content = content ? content[1].trim() : readmeFullContent;
167
167
  }
168
168
 
169
- copyAndFormatTpl(this.fs, this.templatePath("README.md.ejs"), readmePath, {
170
- title: pkg.description,
171
- description: "",
172
- packages: this.packages,
173
- ci: this.fs.exists(this.destinationPath(".github/workflows/push.yml")),
174
- content,
175
- });
169
+ return copyAndFormatTpl(
170
+ this.fs,
171
+ this.templatePath("README.md.ejs"),
172
+ readmePath,
173
+ {
174
+ title: pkg.description,
175
+ description: "",
176
+ packages: this.packages,
177
+ ci: this.fs.exists(this.destinationPath(".github/workflows/push.yml")),
178
+ content,
179
+ },
180
+ );
176
181
  }
177
182
 
178
183
  end() {
@@ -1,6 +1,6 @@
1
1
  import { fileURLToPath } from "node:url";
2
2
  import Generator from "yeoman-generator";
3
- import ensureJsonFileFormatted from "../../utils/ensureJsonFileFormatted.js";
3
+ import { ensureJsonFileFormatted } from "../../utils/ensureJsonFileFormatted.js";
4
4
  import inMonorepo from "../../utils/inMonorepo.js";
5
5
  import * as packageUtils from "../../utils/package.js";
6
6
 
@@ -43,9 +43,9 @@ export default class PobBaseGenerator extends Generator {
43
43
  return "pob";
44
44
  }
45
45
 
46
- initializing() {
47
- // prettier package.json to ensure diff is correct
48
- ensureJsonFileFormatted(this.destinationPath("package.json"));
46
+ async initializing() {
47
+ // format package.json to ensure diff is correct
48
+ await ensureJsonFileFormatted(this.destinationPath("package.json"));
49
49
 
50
50
  if (this.options.monorepo) {
51
51
  this.isMonorepo = true;
@@ -1,19 +1,15 @@
1
- import fs from "node:fs";
2
- import sortPkg from "@pob/sort-pkg";
3
- import prettier from "@prettier/sync";
1
+ import fs from "node:fs/promises";
2
+ import { format } from "oxfmt";
4
3
 
5
- export default function ensureJsonFileFormatted(path) {
4
+ export async function ensureJsonFileFormatted(path) {
6
5
  try {
7
- let contentJson = fs.readFileSync(path, "utf8");
8
- if (path === "package.json" || path.endsWith("/package.json")) {
9
- contentJson = JSON.stringify(sortPkg(JSON.parse(contentJson)), null, 2);
10
- }
11
- const formattedPkg = prettier.format(contentJson, {
12
- filepath: path,
6
+ const contentJson = await fs.readFile(path, "utf8");
7
+ const { code: formattedPkg } = await format(path, contentJson, {
8
+ printWidth: 80,
13
9
  });
14
10
  if (contentJson !== formattedPkg) {
15
11
  console.warn(`formatted json file ${path}`);
16
- fs.writeFileSync(path, formattedPkg);
12
+ await fs.writeFile(path, formattedPkg);
17
13
  }
18
14
  } catch {}
19
15
  }
@@ -1,36 +1,21 @@
1
- import prettier from "@prettier/sync";
1
+ import { format } from "oxfmt";
2
2
 
3
- export function writeAndFormat(fs, destinationPath, content, { parser } = {}) {
4
- fs.write(
5
- destinationPath,
6
- prettier.format(content, {
7
- parser,
8
- filepath: destinationPath,
9
- trailingComma: "all",
10
- arrowParens: "always",
11
- printWidth: destinationPath === ".yarnrc.yml" ? 9999 : undefined,
12
- }),
13
- );
14
- }
15
-
16
- function getParserFromDestinationPath(destinationPath) {
17
- if (destinationPath.endsWith("/lerna.json")) {
18
- return "json-stringify";
19
- }
20
- if (destinationPath.endsWith("json")) {
21
- return undefined;
22
- }
23
-
24
- return "json";
3
+ export async function writeAndFormat(fs, destinationPath, content) {
4
+ const { code: formatted } = await format(destinationPath, content, {
5
+ printWidth: 80,
6
+ });
7
+ return fs.write(destinationPath, formatted);
25
8
  }
26
9
 
27
- export function writeAndFormatJson(fs, destinationPath, value) {
28
- writeAndFormat(fs, destinationPath, JSON.stringify(value, null, 2), {
29
- // project.code-workspace is json
30
- parser: getParserFromDestinationPath(destinationPath),
31
- });
10
+ export async function writeAndFormatJson(fs, destinationPath, value) {
11
+ await writeAndFormat(fs, destinationPath, JSON.stringify(value, null, 2));
32
12
  }
33
- export function copyAndFormatTpl(fs, templatePath, destinationPath, options) {
34
- fs.copyTpl(templatePath, destinationPath, options);
35
- writeAndFormat(fs, destinationPath, fs.read(destinationPath));
13
+ export async function copyAndFormatTpl(
14
+ fs,
15
+ templatePath,
16
+ destinationPath,
17
+ options,
18
+ ) {
19
+ await fs.copyTpl(templatePath, destinationPath, options);
20
+ await writeAndFormat(fs, destinationPath, fs.read(destinationPath));
36
21
  }
package/package.json CHANGED
@@ -1,36 +1,33 @@
1
1
  {
2
2
  "name": "pob",
3
- "version": "34.2.0",
3
+ "version": "35.0.0",
4
4
  "description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
5
5
  "keywords": [
6
6
  "skeleton"
7
7
  ],
8
- "author": "Christophe Hurpeau <christophe@hurpeau.com> (http://christophe.hurpeau.com/)",
8
+ "homepage": "https://github.com/christophehurpeau/pob",
9
+ "bugs": {
10
+ "url": "https://github.com/christophehurpeau/pob/issues"
11
+ },
9
12
  "license": "ISC",
13
+ "author": "Christophe Hurpeau <christophe@hurpeau.com> (http://christophe.hurpeau.com/)",
10
14
  "repository": {
11
15
  "type": "git",
12
16
  "url": "https://github.com/christophehurpeau/pob.git",
13
17
  "directory": "packages/pob"
14
18
  },
15
- "homepage": "https://github.com/christophehurpeau/pob",
16
- "bugs": {
17
- "url": "https://github.com/christophehurpeau/pob/issues"
18
- },
19
+ "bin": "./lib/pob.js",
20
+ "files": [
21
+ "lib",
22
+ "bin"
23
+ ],
19
24
  "type": "module",
20
- "engines": {
21
- "node": ">=22.18.0"
22
- },
23
25
  "sideEffects": false,
24
- "bin": "./lib/pob.js",
25
26
  "main": "./lib/index.js",
26
27
  "exports": {
27
28
  ".": "./lib/index.js",
28
29
  "./package.json": "./package.json"
29
30
  },
30
- "files": [
31
- "lib",
32
- "bin"
33
- ],
34
31
  "scripts": {
35
32
  "build": "yarn run build:definitions",
36
33
  "build:definitions": "tsc -p tsconfig.json",
@@ -38,20 +35,15 @@
38
35
  "lint": "yarn run lint:eslint",
39
36
  "lint:eslint": "yarn '../..' run eslint --quiet 'packages/pob'"
40
37
  },
41
- "pob": {
42
- "typescript": "check-only"
43
- },
44
- "prettier": "@pob/root/prettier-config",
45
38
  "dependencies": {
46
- "@pob/eslint-config": "65.4.1",
47
- "@pob/eslint-config-typescript-react": "65.4.1",
48
- "@pob/sort-object": "10.1.2",
49
- "@pob/sort-pkg": "12.1.2",
50
- "@prettier/sync": "0.6.1",
39
+ "@pob/eslint-config": "65.4.3",
40
+ "@pob/eslint-config-typescript-react": "65.4.3",
41
+ "@pob/sort-object": "11.0.0",
42
+ "@pob/sort-pkg": "13.0.0",
51
43
  "@types/inquirer": "9.0.9",
52
44
  "@yeoman/adapter": "3.1.0",
53
45
  "@yeoman/types": "1.8.0",
54
- "eslint": "10.2.1",
46
+ "eslint": "10.4.0",
55
47
  "findup-sync": "^5.0.0",
56
48
  "git-remote-url": "^1.0.1",
57
49
  "github-username": "^9.0.0",
@@ -62,17 +54,23 @@
62
54
  "mem-fs": "4.1.4",
63
55
  "mem-fs-editor": "11.1.4",
64
56
  "minimist": "1.2.8",
57
+ "oxfmt": "0.50.0",
65
58
  "parse-author": "2.0.0",
66
- "pob-dependencies": "23.2.0",
67
- "prettier": "3.8.3",
68
- "semver": "7.7.4",
69
- "typescript": "5.9.3",
59
+ "pob-dependencies": "24.0.0",
60
+ "semver": "7.8.0",
61
+ "typescript": "6.0.3",
70
62
  "validate-npm-package-name": "^7.0.0",
71
63
  "yeoman-environment": "5.0.0",
72
64
  "yeoman-generator": "7.5.1"
73
65
  },
74
66
  "devDependencies": {
75
- "@pob/root": "23.2.0",
76
- "@types/node": "24.12.2"
67
+ "@pob/root": "24.0.0",
68
+ "@types/node": "24.12.4"
69
+ },
70
+ "engines": {
71
+ "node": ">=22.18.0"
72
+ },
73
+ "pob": {
74
+ "typescript": "check-only"
77
75
  }
78
76
  }
@@ -1,8 +0,0 @@
1
- {
2
- "env": {
3
- "jest": true
4
- },
5
- "rules": {
6
- "strict": "off"
7
- }
8
- }