pob 31.4.2 → 33.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 +43 -0
- package/lib/generators/app/PobAppGenerator.js +8 -4
- package/lib/generators/common/format-lint/CommonLintGenerator.js +16 -25
- package/lib/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js +1 -0
- package/lib/generators/common/release/templates/workflow-release.yml.ejs +5 -1
- package/lib/generators/common/testing/CommonTestingGenerator.js +45 -2
- package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +6 -0
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +2 -1
- package/lib/generators/core/ci/CoreCIGenerator.js +7 -1
- package/lib/generators/core/ci/templates/github-action-documentation-workflow.yml.ejs +4 -4
- package/lib/generators/core/ci/templates/github-action-push-workflow-split.yml.ejs +6 -6
- package/lib/generators/core/ci/templates/github-action-push-workflow.yml.ejs +3 -3
- package/lib/generators/core/package/templates/check-packages.js.ejs +2 -2
- package/lib/generators/lib/PobLibGenerator.js +12 -7
- package/lib/generators/monorepo/PobMonorepoGenerator.js +2 -1
- package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +15 -1
- package/lib/pob.js +3 -0
- package/lib/utils/dependenciesPackages.cjs +0 -2
- package/lib/utils/package.js +1 -2
- package/lib/utils/packageManagerUtils.js +29 -0
- package/lib/utils/workspaceUtils.js +0 -1
- package/package.json +8 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,49 @@
|
|
|
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
|
+
## [33.0.0](https://github.com/christophehurpeau/pob/compare/pob@32.0.0...pob@33.0.0) (2026-03-01)
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* deprecate pob-babel and babel-preset-pob-env
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* deprecate pob-babel and babel-preset-pob-env
|
|
15
|
+
|
|
16
|
+
Version bump for dependency: pob-dependencies
|
|
17
|
+
Version bump for dependency: @pob/root
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## [32.0.0](https://github.com/christophehurpeau/pob/compare/pob@31.4.2...pob@32.0.0) (2026-03-01)
|
|
21
|
+
|
|
22
|
+
### ⚠ BREAKING CHANGES
|
|
23
|
+
|
|
24
|
+
* replace husky by small fast custom scripts
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* add packageManager option to CoreCIGenerator for flexible CI job configuration
|
|
29
|
+
* **deps:** update dependency prettier to v3.7.4 ([#2665](https://github.com/christophehurpeau/pob/issues/2665))
|
|
30
|
+
* **deps:** update dependency validate-npm-package-name to v7 ([#2613](https://github.com/christophehurpeau/pob/issues/2613))
|
|
31
|
+
* improve bun support
|
|
32
|
+
* prepare for jest deprecation
|
|
33
|
+
* replace husky by small fast custom scripts
|
|
34
|
+
* update prettier
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
* **deps:** update dependency eslint to v9.39.3 ([#2677](https://github.com/christophehurpeau/pob/issues/2677))
|
|
39
|
+
* handle undefined packageManager in CoreCIGenerator and packageManagerUtils for improved CI compatibility
|
|
40
|
+
* replace hardcoded yarn commands with packageManager variable in CI templates
|
|
41
|
+
* use packageManager variable for commands in documentation workflow
|
|
42
|
+
* use packageManager variable for running TypeScript and repository check commands
|
|
43
|
+
* workflow release for bun
|
|
44
|
+
|
|
45
|
+
Version bump for dependency: pob-dependencies
|
|
46
|
+
Version bump for dependency: @pob/root
|
|
47
|
+
|
|
48
|
+
|
|
6
49
|
## [31.4.2](https://github.com/christophehurpeau/pob/compare/pob@31.4.1...pob@31.4.2) (2025-12-06)
|
|
7
50
|
|
|
8
51
|
Version bump for dependency: @pob/root
|
|
@@ -144,6 +144,10 @@ export default class PobAppGenerator extends Generator {
|
|
|
144
144
|
default() {
|
|
145
145
|
const srcDirectory =
|
|
146
146
|
this.appConfig.type === "yarn-plugin" ? "sources" : "src";
|
|
147
|
+
const packageManager =
|
|
148
|
+
inMonorepo && !inMonorepo.root
|
|
149
|
+
? inMonorepo.pobMonorepoConfig.packageManager
|
|
150
|
+
: this.options.packageManager;
|
|
147
151
|
|
|
148
152
|
if (this.appConfig.type === "pobpack") {
|
|
149
153
|
throw new Error("pobpack is no longer supported.");
|
|
@@ -284,7 +288,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
284
288
|
documentation: false,
|
|
285
289
|
codecov: this.appConfig.codecov,
|
|
286
290
|
ci: this.options.ci,
|
|
287
|
-
packageManager
|
|
291
|
+
packageManager,
|
|
288
292
|
isApp: true,
|
|
289
293
|
splitCIJobs: false,
|
|
290
294
|
onlyLatestLTS: true,
|
|
@@ -308,7 +312,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
308
312
|
browser,
|
|
309
313
|
// nextjs now supports src rootAsSrc: this.appConfig.type === 'next.js',
|
|
310
314
|
enableSrcResolver: true,
|
|
311
|
-
packageManager
|
|
315
|
+
packageManager,
|
|
312
316
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
313
317
|
rootIgnorePaths: ignorePaths.join("\n"),
|
|
314
318
|
srcDirectory,
|
|
@@ -326,14 +330,14 @@ export default class PobAppGenerator extends Generator {
|
|
|
326
330
|
ci: this.options.ci,
|
|
327
331
|
disableYarnGitCache: this.options.disableYarnGitCache,
|
|
328
332
|
updateOnly: this.options.updateOnly,
|
|
329
|
-
packageManager
|
|
333
|
+
packageManager,
|
|
330
334
|
});
|
|
331
335
|
}
|
|
332
336
|
|
|
333
337
|
this.composeWith("pob:core:vscode", {
|
|
334
338
|
root: !inMonorepo,
|
|
335
339
|
monorepo: false,
|
|
336
|
-
packageManager
|
|
340
|
+
packageManager,
|
|
337
341
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
338
342
|
typescript,
|
|
339
343
|
testing: this.appConfig.testing,
|
|
@@ -3,6 +3,10 @@ import Generator from "yeoman-generator";
|
|
|
3
3
|
import { quoteArg } from "../../../utils/execUtils.js";
|
|
4
4
|
import inMonorepo from "../../../utils/inMonorepo.js";
|
|
5
5
|
import * as packageUtils from "../../../utils/package.js";
|
|
6
|
+
import {
|
|
7
|
+
packageManagerRun,
|
|
8
|
+
packageManagerRunWithCwd,
|
|
9
|
+
} from "../../../utils/packageManagerUtils.js";
|
|
6
10
|
import { copyAndFormatTpl } from "../../../utils/writeAndFormat.js";
|
|
7
11
|
import { appIgnorePaths } from "../../app/ignorePaths.js";
|
|
8
12
|
|
|
@@ -107,7 +111,7 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
107
111
|
this.option("packageManager", {
|
|
108
112
|
type: String,
|
|
109
113
|
default: "yarn",
|
|
110
|
-
description: "yarn or npm",
|
|
114
|
+
description: "yarn, bun or npm",
|
|
111
115
|
});
|
|
112
116
|
|
|
113
117
|
this.option("yarnNodeLinker", {
|
|
@@ -217,16 +221,11 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
217
221
|
this.fs.delete(this.destinationPath(".prettierignore"));
|
|
218
222
|
}
|
|
219
223
|
|
|
220
|
-
if (pkg.devDependencies) {
|
|
221
|
-
if (pkg.devDependencies["@pob/eslint-config-babel"]) {
|
|
222
|
-
packageUtils.addDevDependencies(pkg, ["@pob/eslint-config-typescript"]);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
224
|
packageUtils.removeDevDependencies(pkg, [
|
|
227
225
|
"@pob/eslint-config-babel",
|
|
228
226
|
"@pob/eslint-config-babel-node",
|
|
229
227
|
"@pob/eslint-config-node",
|
|
228
|
+
"@pob/eslint-config-typescript",
|
|
230
229
|
"@pob/eslint-config-typescript-node",
|
|
231
230
|
"babel-eslint",
|
|
232
231
|
"eslint-config-pob",
|
|
@@ -330,12 +329,10 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
330
329
|
if ((inMonorepo && inMonorepo.root) || this.options.monorepo) {
|
|
331
330
|
if (this.options.typescript) {
|
|
332
331
|
packageUtils.updateDevDependenciesIfPresent(pkg, [
|
|
333
|
-
"@pob/eslint-config-typescript",
|
|
334
332
|
"@pob/eslint-config-typescript-react",
|
|
335
333
|
]);
|
|
336
334
|
} else if (pkg.name !== "@pob/eslint-config-monorepo") {
|
|
337
335
|
packageUtils.removeDevDependencies(pkg, [
|
|
338
|
-
"@pob/eslint-config-typescript",
|
|
339
336
|
"@pob/eslint-config-typescript-react",
|
|
340
337
|
]);
|
|
341
338
|
}
|
|
@@ -345,9 +342,6 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
345
342
|
["@typescript-eslint/eslint-plugin", "@typescript-eslint/parser"],
|
|
346
343
|
);
|
|
347
344
|
} else {
|
|
348
|
-
packageUtils.addOrRemoveDevDependencies(pkg, useTypescript, [
|
|
349
|
-
"@pob/eslint-config-typescript",
|
|
350
|
-
]);
|
|
351
345
|
packageUtils.addOrRemoveDevDependencies(
|
|
352
346
|
pkg,
|
|
353
347
|
useTypescript && shouldHavePluginsDependencies,
|
|
@@ -365,7 +359,7 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
365
359
|
if (pkg.name === "@pob/eslint-config-monorepo") {
|
|
366
360
|
return {
|
|
367
361
|
imports: [
|
|
368
|
-
'import
|
|
362
|
+
'import pobConfig from "@pob/eslint-config"',
|
|
369
363
|
'import pobTypescriptConfigReact from "@pob/eslint-config-typescript-react"',
|
|
370
364
|
],
|
|
371
365
|
flatCascade: [
|
|
@@ -376,9 +370,7 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
376
370
|
|
|
377
371
|
return {
|
|
378
372
|
imports: [
|
|
379
|
-
|
|
380
|
-
? 'import pobTypescriptConfig from "@pob/eslint-config-typescript"'
|
|
381
|
-
: 'import pobConfig from "@pob/eslint-config"',
|
|
373
|
+
'import pobConfig from "@pob/eslint-config"',
|
|
382
374
|
useTypescript &&
|
|
383
375
|
hasReact &&
|
|
384
376
|
'import pobTypescriptConfigReact from "@pob/eslint-config-typescript-react"',
|
|
@@ -397,17 +389,16 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
397
389
|
if (!hasReact) {
|
|
398
390
|
return [
|
|
399
391
|
useNode
|
|
400
|
-
? "...
|
|
401
|
-
: "...
|
|
392
|
+
? "...pobConfig(import.meta.url).configs.node"
|
|
393
|
+
: "...pobConfig(import.meta.url).configs.base",
|
|
402
394
|
];
|
|
403
395
|
}
|
|
404
396
|
|
|
405
397
|
return [
|
|
406
398
|
useNode
|
|
407
|
-
? "...
|
|
408
|
-
: "...
|
|
409
|
-
this.options.isApp &&
|
|
410
|
-
"...pobTypescriptConfig(import.meta.url).configs.app",
|
|
399
|
+
? "...pobConfig(import.meta.url).configs.node"
|
|
400
|
+
: "...pobConfig(import.meta.url).configs.base",
|
|
401
|
+
this.options.isApp && "...pobConfig(import.meta.url).configs.app",
|
|
411
402
|
pkg.dependencies?.["react-native-web"] &&
|
|
412
403
|
'...pobTypescriptConfigReact(import.meta.url).configs["react-native-web"]',
|
|
413
404
|
];
|
|
@@ -522,15 +513,15 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
522
513
|
|
|
523
514
|
packageUtils.addScripts(pkg, {
|
|
524
515
|
"lint:eslint": globalEslint
|
|
525
|
-
?
|
|
516
|
+
? `${packageManagerRunWithCwd(this.options.packageManager, "../..", "eslint")} ${args} ${quoteArg(path.relative("../..", "."))}`
|
|
526
517
|
: `eslint ${args} .`,
|
|
527
518
|
lint: `${
|
|
528
519
|
useTypescript && !composite ? "tsc && " : ""
|
|
529
|
-
}
|
|
520
|
+
}${packageManagerRun(this.options.packageManager, "lint:eslint")}`,
|
|
530
521
|
});
|
|
531
522
|
|
|
532
523
|
if (!inMonorepo) {
|
|
533
|
-
pkg.scripts.lint =
|
|
524
|
+
pkg.scripts.lint = `${this.options.packageManager} run lint:prettier && ${pkg.scripts.lint}`;
|
|
534
525
|
packageUtils.addScripts(pkg, {
|
|
535
526
|
"lint:prettier": "pob-root-prettier --check .",
|
|
536
527
|
"lint:prettier:fix": "pob-root-prettier --write .",
|
|
@@ -8,6 +8,7 @@ export default class CommonRemoveOldDependenciesGenerator extends Generator {
|
|
|
8
8
|
// old pob dependencies
|
|
9
9
|
packageUtils.removeDependencies(pkg, ["flow-runtime"]);
|
|
10
10
|
packageUtils.removeDevDependencies(pkg, [
|
|
11
|
+
"@pob/eslint-config-typescript", // integrated in @pob/eslint-config now that node supports ts by default.
|
|
11
12
|
"ts-node",
|
|
12
13
|
"tcomb",
|
|
13
14
|
"tcomb-forked",
|
|
@@ -53,6 +53,7 @@ jobs:
|
|
|
53
53
|
with:
|
|
54
54
|
node-version: <%= nodeLatestMajorVersion %>
|
|
55
55
|
check-latest: true
|
|
56
|
+
registry-url: "https://registry.npmjs.org"
|
|
56
57
|
|
|
57
58
|
- name: Check git tags
|
|
58
59
|
if: github.ref == 'refs/heads/main' && !inputs.allow-no-tags
|
|
@@ -88,9 +89,12 @@ jobs:
|
|
|
88
89
|
- name: New version
|
|
89
90
|
if: github.ref == 'refs/heads/main' && !inputs.dry-run
|
|
90
91
|
run: |
|
|
92
|
+
<% if (packageManager === "bun") { -%>
|
|
93
|
+
npm install -g npm@latest
|
|
94
|
+
<% } -%>
|
|
91
95
|
<%= packageManager %> run pob-version <% if (enablePublish && packageManager === "bun") { %>--publish <% } %>--create-release=github <% if (isMonorepo && isMonorepoIndependent) { %> --bump-dependents-highest-as=${{ inputs.bump-dependents-highest-as }}<% } %> -m 'chore: release <%- isMonorepoIndependent ? '' : '%v ' %>[skip ci]<%- isMonorepoIndependent ? '\\n\\n%t' : '' %>'
|
|
92
96
|
env:
|
|
93
|
-
|
|
97
|
+
POB_GIT_HOOKS: 0
|
|
94
98
|
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
|
95
99
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
96
100
|
<% if (enablePublish && packageManager === "yarn") { -%>
|
|
@@ -4,6 +4,7 @@ import Generator from "yeoman-generator";
|
|
|
4
4
|
import { quoteArg } from "../../../utils/execUtils.js";
|
|
5
5
|
import inMonorepo from "../../../utils/inMonorepo.js";
|
|
6
6
|
import * as packageUtils from "../../../utils/package.js";
|
|
7
|
+
import { packageManagerRunWithCwd } from "../../../utils/packageManagerUtils.js";
|
|
7
8
|
import {
|
|
8
9
|
copyAndFormatTpl,
|
|
9
10
|
writeAndFormatJson,
|
|
@@ -64,7 +65,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
64
65
|
this.option("packageManager", {
|
|
65
66
|
type: String,
|
|
66
67
|
default: "yarn",
|
|
67
|
-
description: "yarn or npm",
|
|
68
|
+
description: "yarn, bun or npm",
|
|
68
69
|
});
|
|
69
70
|
|
|
70
71
|
this.option("isApp", {
|
|
@@ -106,6 +107,26 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
106
107
|
});
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
async prompting() {
|
|
111
|
+
if (this.options.runner === "jest") {
|
|
112
|
+
const { confirm } = await this.prompt([
|
|
113
|
+
{
|
|
114
|
+
type: "confirm",
|
|
115
|
+
name: "confirm",
|
|
116
|
+
message:
|
|
117
|
+
"jest will soon be deprecated. Are you sure you want to continue using jest?",
|
|
118
|
+
default: false,
|
|
119
|
+
},
|
|
120
|
+
]);
|
|
121
|
+
|
|
122
|
+
if (!confirm) {
|
|
123
|
+
throw new Error(
|
|
124
|
+
"Jest is deprecated. Please consider using an alternative test runner.",
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
109
130
|
default() {
|
|
110
131
|
if (!inMonorepo || inMonorepo.root) {
|
|
111
132
|
this.composeWith("pob:core:ci", {
|
|
@@ -277,6 +298,11 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
277
298
|
}`;
|
|
278
299
|
}
|
|
279
300
|
case "node": {
|
|
301
|
+
if (this.options.packageManager === "bun") {
|
|
302
|
+
throw new Error(
|
|
303
|
+
"'node' test runner is configured with the 'bun' package manager. Please set to 'bun' instead.",
|
|
304
|
+
);
|
|
305
|
+
}
|
|
280
306
|
if (!workspacesPattern && this.options.monorepo) {
|
|
281
307
|
throw new Error("Invalid workspacesPattern");
|
|
282
308
|
}
|
|
@@ -295,6 +321,19 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
295
321
|
hasTestFolder ? "test/*" : `${this.options.srcDirectory}/**/*.test`
|
|
296
322
|
}.${this.options.typescript ? "ts" : "js"}`}`;
|
|
297
323
|
}
|
|
324
|
+
case "bun": {
|
|
325
|
+
if (this.options.packageManager !== "bun") {
|
|
326
|
+
throw new Error(
|
|
327
|
+
"'bun' test runner cannot be set without bun as packageManager.",
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return `TZ=UTC bun test${watch ? " --watch" : ""}${
|
|
332
|
+
coverage || coverageJson
|
|
333
|
+
? ` --coverage ${coverageJson ? "--coverage-report=json" : ""}`
|
|
334
|
+
: ""
|
|
335
|
+
}`;
|
|
336
|
+
}
|
|
298
337
|
case "vitest": {
|
|
299
338
|
return `TZ=UTC ${
|
|
300
339
|
coverage || coverageJson
|
|
@@ -447,7 +486,11 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
447
486
|
delete pkg.scripts["test:coverage"];
|
|
448
487
|
}
|
|
449
488
|
packageUtils.addScripts(pkg, {
|
|
450
|
-
test:
|
|
489
|
+
test: `${packageManagerRunWithCwd(
|
|
490
|
+
this.options.packageManager,
|
|
491
|
+
"../..",
|
|
492
|
+
"test",
|
|
493
|
+
)} -- ${quoteArg(path.relative("../..", "."))}`,
|
|
451
494
|
});
|
|
452
495
|
} else {
|
|
453
496
|
const withTypescript =
|
|
@@ -131,7 +131,8 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
131
131
|
(pkg.pob?.bundler === "rollup-babel" && pkg.pob.envs) ||
|
|
132
132
|
[];
|
|
133
133
|
const withBabel = babelEnvs.length > 0;
|
|
134
|
-
const withTypescript =
|
|
134
|
+
const withTypescript =
|
|
135
|
+
withBabel || pkg.pob?.typescript === true || pkg.pob?.bundler === "tsc";
|
|
135
136
|
const jsx = (withBabel || withTypescript) && pkg.pob.jsx === true;
|
|
136
137
|
|
|
137
138
|
if (withBabel) {
|
|
@@ -83,6 +83,12 @@ export default class CoreCIGenerator extends Generator {
|
|
|
83
83
|
description: "split CI jobs for faster result",
|
|
84
84
|
});
|
|
85
85
|
|
|
86
|
+
this.option("packageManager", {
|
|
87
|
+
type: String,
|
|
88
|
+
default: "yarn",
|
|
89
|
+
description: "yarn, npm or bun",
|
|
90
|
+
});
|
|
91
|
+
|
|
86
92
|
this.option("disableYarnGitCache", {
|
|
87
93
|
type: Boolean,
|
|
88
94
|
required: false,
|
|
@@ -114,7 +120,7 @@ export default class CoreCIGenerator extends Generator {
|
|
|
114
120
|
),
|
|
115
121
|
this.destinationPath(".github/workflows/push.yml"),
|
|
116
122
|
{
|
|
117
|
-
packageManager: this.options.packageManager,
|
|
123
|
+
packageManager: this.options.packageManager || "yarn",
|
|
118
124
|
disableYarnGitCache: this.options.disableYarnGitCache,
|
|
119
125
|
testing,
|
|
120
126
|
e2eTesting:
|
|
@@ -40,21 +40,21 @@ jobs:
|
|
|
40
40
|
|
|
41
41
|
<% if (typedoc) { -%>
|
|
42
42
|
- name: Run tsc for tsc cache
|
|
43
|
-
run:
|
|
43
|
+
run: <%= packageManager %> tsc
|
|
44
44
|
|
|
45
45
|
- name: Generate Typedoc
|
|
46
|
-
run:
|
|
46
|
+
run: <%= packageManager %> typedoc --tsconfig tsconfig.doc.json
|
|
47
47
|
<% } -%>
|
|
48
48
|
|
|
49
49
|
<% if (testing) { -%>
|
|
50
50
|
<% if (testRunner === 'node') { -%>
|
|
51
51
|
|
|
52
52
|
- name: Generate Coverage
|
|
53
|
-
run: NODE_V8_COVERAGE=./docs/coverage
|
|
53
|
+
run: NODE_V8_COVERAGE=./docs/coverage <%= packageManager %> run test:coverage
|
|
54
54
|
<% } else {-%>
|
|
55
55
|
|
|
56
56
|
- name: Generate Coverage
|
|
57
|
-
run:
|
|
57
|
+
run: <%= packageManager %> run test:coverage:json<%- testRunner === 'jest' ? " --coverageDirectory=docs/coverage/" : "" %>
|
|
58
58
|
<% } -%>
|
|
59
59
|
<% } -%>
|
|
60
60
|
|
|
@@ -31,7 +31,7 @@ jobs:
|
|
|
31
31
|
<% } -%>
|
|
32
32
|
|
|
33
33
|
- name: Checks
|
|
34
|
-
run:
|
|
34
|
+
run: <%= packageManager %> run checks
|
|
35
35
|
|
|
36
36
|
<% } -%>
|
|
37
37
|
<% if (build) { -%>
|
|
@@ -61,10 +61,10 @@ jobs:
|
|
|
61
61
|
<% } -%>
|
|
62
62
|
|
|
63
63
|
- name: Build
|
|
64
|
-
run:
|
|
64
|
+
run: <%= packageManager %> run build
|
|
65
65
|
|
|
66
66
|
- name: Check nothing was forgotten before commit
|
|
67
|
-
run:
|
|
67
|
+
run: <%= packageManager %> run repository-check-dirty
|
|
68
68
|
|
|
69
69
|
<% } -%>
|
|
70
70
|
lint:
|
|
@@ -89,15 +89,15 @@ jobs:
|
|
|
89
89
|
<% } -%>
|
|
90
90
|
|
|
91
91
|
- name: Prettier
|
|
92
|
-
run:
|
|
92
|
+
run: <%= packageManager %> run lint:prettier
|
|
93
93
|
<% if (typescript) { -%>
|
|
94
94
|
|
|
95
95
|
- name: Typescript
|
|
96
|
-
run:
|
|
96
|
+
run: <%= packageManager %> run tsc
|
|
97
97
|
<% } -%>
|
|
98
98
|
|
|
99
99
|
- name: Eslint
|
|
100
|
-
run:
|
|
100
|
+
run: <%= packageManager %> run lint:eslint
|
|
101
101
|
<% if (testing) { -%>
|
|
102
102
|
|
|
103
103
|
test:
|
|
@@ -55,7 +55,7 @@ jobs:
|
|
|
55
55
|
<% } -%>
|
|
56
56
|
<% if (build) { -%>
|
|
57
57
|
- name: Build
|
|
58
|
-
run:
|
|
58
|
+
run: <%= packageManager %> run build
|
|
59
59
|
if: startsWith(matrix.node-version, '<%= nodeLatestMajorVersion %>.')
|
|
60
60
|
|
|
61
61
|
<% } -%>
|
|
@@ -65,7 +65,7 @@ jobs:
|
|
|
65
65
|
<% if (typescript) { -%>
|
|
66
66
|
|
|
67
67
|
- name: Typescript
|
|
68
|
-
run:
|
|
68
|
+
run: <%= packageManager %> run tsc
|
|
69
69
|
if: startsWith(matrix.node-version, '<%= nodeLatestMajorVersion %>.')
|
|
70
70
|
<% } -%>
|
|
71
71
|
|
|
@@ -76,7 +76,7 @@ jobs:
|
|
|
76
76
|
|
|
77
77
|
- name: Check nothing was forgotten before commit
|
|
78
78
|
if: startsWith(matrix.node-version, '<%= nodeLatestMajorVersion %>.')
|
|
79
|
-
run: <%= packageManager === 'npm' ? 'npx' : '
|
|
79
|
+
run: <%= packageManager === 'npm' ? 'npx' : packageManager + ' run' %> repository-check-dirty
|
|
80
80
|
<% } -%>
|
|
81
81
|
<% if (codecov) { -%>
|
|
82
82
|
|
|
@@ -24,7 +24,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
24
24
|
this.option("packageManager", {
|
|
25
25
|
type: String,
|
|
26
26
|
default: "yarn",
|
|
27
|
-
description: "yarn or npm",
|
|
27
|
+
description: "yarn, bun or npm",
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
this.option("yarnNodeLinker", {
|
|
@@ -274,6 +274,11 @@ export default class PobLibGenerator extends Generator {
|
|
|
274
274
|
pkg.pob.envs) ||
|
|
275
275
|
[];
|
|
276
276
|
|
|
277
|
+
const packageManager =
|
|
278
|
+
inMonorepo && !inMonorepo.root
|
|
279
|
+
? inMonorepo.rootPackageManager
|
|
280
|
+
: this.options.packageManager;
|
|
281
|
+
|
|
277
282
|
const withBabel = babelEnvs.length > 0;
|
|
278
283
|
const withTypescript =
|
|
279
284
|
withBabel || pkg.pob.typescript === true || pkg.pob.bundler === "tsc";
|
|
@@ -319,7 +324,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
319
324
|
documentation: !!this.pobjson.documentation,
|
|
320
325
|
codecov: this.pobjson.testing && this.pobjson.testing.codecov,
|
|
321
326
|
ci: this.options.ci,
|
|
322
|
-
packageManager
|
|
327
|
+
packageManager,
|
|
323
328
|
isApp: false,
|
|
324
329
|
splitCIJobs: false,
|
|
325
330
|
srcDirectory: withBabel || withTypescript ? "src" : "lib",
|
|
@@ -338,7 +343,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
338
343
|
testRunner: inMonorepo
|
|
339
344
|
? inMonorepo.pobMonorepoConfig.testRunner
|
|
340
345
|
: this.pobjson.testing?.runner,
|
|
341
|
-
packageManager
|
|
346
|
+
packageManager,
|
|
342
347
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
343
348
|
ignorePaths: withBabel || withTypescript ? "/dist" : "",
|
|
344
349
|
});
|
|
@@ -358,7 +363,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
358
363
|
|
|
359
364
|
this.composeWith("pob:common:release", {
|
|
360
365
|
enable: !inMonorepo && this.pobjson.testing,
|
|
361
|
-
packageManager
|
|
366
|
+
packageManager,
|
|
362
367
|
enablePublish: true,
|
|
363
368
|
withBabel,
|
|
364
369
|
withTypescript,
|
|
@@ -371,7 +376,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
371
376
|
this.composeWith("pob:core:vscode", {
|
|
372
377
|
root: !inMonorepo,
|
|
373
378
|
monorepo: false,
|
|
374
|
-
packageManager
|
|
379
|
+
packageManager,
|
|
375
380
|
yarnNodeLinker: this.options.yarnNodeLinker,
|
|
376
381
|
typescript: withBabel || withTypescript,
|
|
377
382
|
testing: this.pobjson.testing,
|
|
@@ -411,8 +416,8 @@ export default class PobLibGenerator extends Generator {
|
|
|
411
416
|
|
|
412
417
|
const withBabel = Boolean(
|
|
413
418
|
pkg.pob.babelEnvs ||
|
|
414
|
-
|
|
415
|
-
|
|
419
|
+
(!pkg.pob.bundler && pkg.pob.typescript !== true && pkg.pob.envs) ||
|
|
420
|
+
pkg.pob.bundler === "rollup-babel",
|
|
416
421
|
);
|
|
417
422
|
const withTypescript =
|
|
418
423
|
withBabel || pkg.pob.typescript === true || pkg.pob.bundler === "tsc";
|
|
@@ -87,7 +87,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
87
87
|
this.option("packageManager", {
|
|
88
88
|
type: String,
|
|
89
89
|
default: "yarn",
|
|
90
|
-
description: "yarn or npm",
|
|
90
|
+
description: "yarn, bun or npm",
|
|
91
91
|
});
|
|
92
92
|
|
|
93
93
|
this.option("yarnNodeLinker", {
|
|
@@ -342,6 +342,7 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
342
342
|
packagePaths: JSON.stringify(packagePaths),
|
|
343
343
|
testRunner: this.pobLernaConfig.testRunner,
|
|
344
344
|
onlyLatestLTS: this.options.onlyLatestLTS,
|
|
345
|
+
packageManager: this.options.packageManager,
|
|
345
346
|
});
|
|
346
347
|
|
|
347
348
|
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Generator from "yeoman-generator";
|
|
2
2
|
import * as packageUtils from "../../../utils/package.js";
|
|
3
|
+
import { packageManagerRun } from "../../../utils/packageManagerUtils.js";
|
|
3
4
|
import { copyAndFormatTpl } from "../../../utils/writeAndFormat.js";
|
|
4
5
|
|
|
5
6
|
export default class MonorepoTypescriptGenerator extends Generator {
|
|
@@ -45,6 +46,12 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
45
46
|
required: false,
|
|
46
47
|
default: false,
|
|
47
48
|
});
|
|
49
|
+
|
|
50
|
+
this.option("packageManager", {
|
|
51
|
+
type: String,
|
|
52
|
+
required: false,
|
|
53
|
+
default: "yarn",
|
|
54
|
+
});
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
writing() {
|
|
@@ -82,7 +89,14 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
82
89
|
delete pkg.scripts.postbuild;
|
|
83
90
|
|
|
84
91
|
if (!this.options.isAppProject && !this.options.checkOnly) {
|
|
85
|
-
pkg.scripts.build
|
|
92
|
+
if (pkg.scripts.build) {
|
|
93
|
+
pkg.scripts.build += ` && ${packageManagerRun(this.options.packageManager, "build:definitions")}`;
|
|
94
|
+
} else {
|
|
95
|
+
pkg.scripts.build = packageManagerRun(
|
|
96
|
+
this.options.packageManager,
|
|
97
|
+
"build:definitions",
|
|
98
|
+
);
|
|
99
|
+
}
|
|
86
100
|
}
|
|
87
101
|
} else if (pkg.scripts) {
|
|
88
102
|
delete pkg.scripts.tsc;
|
package/lib/pob.js
CHANGED
|
@@ -305,6 +305,8 @@ if (action === "migrate-to-monorepo") {
|
|
|
305
305
|
".vscode",
|
|
306
306
|
".github",
|
|
307
307
|
".husky",
|
|
308
|
+
".git-hooks",
|
|
309
|
+
".cursor",
|
|
308
310
|
".yarn",
|
|
309
311
|
".yarnrc.yml",
|
|
310
312
|
"eslint.config.js",
|
|
@@ -313,6 +315,7 @@ if (action === "migrate-to-monorepo") {
|
|
|
313
315
|
"renovate.json",
|
|
314
316
|
"packages",
|
|
315
317
|
"lint-staged.config.js",
|
|
318
|
+
"lint-staged.config.mjs",
|
|
316
319
|
"yarn.lock",
|
|
317
320
|
].includes(filename)
|
|
318
321
|
) {
|
|
@@ -2,6 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
exports.pobEslintConfig = require("@pob/eslint-config/package.json");
|
|
4
4
|
|
|
5
|
-
exports.pobEslintConfigTypescript = require("@pob/eslint-config-typescript/package.json");
|
|
6
|
-
|
|
7
5
|
exports.pobEslintConfigTypescriptReact = require("@pob/eslint-config-typescript-react/package.json");
|
package/lib/utils/package.js
CHANGED
|
@@ -5,7 +5,6 @@ import pobDependencies from "pob-dependencies";
|
|
|
5
5
|
import semver from "semver";
|
|
6
6
|
import {
|
|
7
7
|
pobEslintConfig,
|
|
8
|
-
pobEslintConfigTypescript,
|
|
9
8
|
pobEslintConfigTypescriptReact,
|
|
10
9
|
} from "./dependenciesPackages.cjs";
|
|
11
10
|
import pobPkg from "./packagejson.js";
|
|
@@ -106,7 +105,7 @@ const getVersionFromDependencyName = (dependency) => {
|
|
|
106
105
|
dependency,
|
|
107
106
|
)
|
|
108
107
|
) {
|
|
109
|
-
return
|
|
108
|
+
return pobEslintConfig.dependencies[dependency];
|
|
110
109
|
}
|
|
111
110
|
|
|
112
111
|
// prevents cycle that lerna doesnt like
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { quoteArg } from "./execUtils.js";
|
|
2
|
+
|
|
3
|
+
export const packageManagerRun = (packageManager, script) => {
|
|
4
|
+
switch (packageManager) {
|
|
5
|
+
case undefined:
|
|
6
|
+
case "yarn":
|
|
7
|
+
return `yarn run ${script}`;
|
|
8
|
+
case "npm":
|
|
9
|
+
return `npm run ${script}`;
|
|
10
|
+
case "bun":
|
|
11
|
+
return `bun run ${script}`;
|
|
12
|
+
default:
|
|
13
|
+
throw new Error(`Unsupported package manager: ${packageManager}`);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const packageManagerRunWithCwd = (packageManager, cwd, script) => {
|
|
18
|
+
switch (packageManager) {
|
|
19
|
+
case undefined:
|
|
20
|
+
case "yarn":
|
|
21
|
+
return `yarn ${quoteArg(cwd)} run ${script}`;
|
|
22
|
+
case "npm":
|
|
23
|
+
return `npm --prefix ${quoteArg(cwd)} run ${script}`;
|
|
24
|
+
case "bun":
|
|
25
|
+
return `bun run --cwd ${quoteArg(cwd)} ${script}`;
|
|
26
|
+
default:
|
|
27
|
+
throw new Error(`Unsupported package manager: ${packageManager}`);
|
|
28
|
+
}
|
|
29
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "33.0.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/jest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -43,16 +43,15 @@
|
|
|
43
43
|
},
|
|
44
44
|
"prettier": "@pob/root/prettier-config",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@pob/eslint-config": "
|
|
47
|
-
"@pob/eslint-config-typescript": "
|
|
48
|
-
"@pob/eslint-config-typescript-react": "62.0.0",
|
|
46
|
+
"@pob/eslint-config": "65.0.2",
|
|
47
|
+
"@pob/eslint-config-typescript-react": "65.0.2",
|
|
49
48
|
"@pob/sort-object": "10.1.1",
|
|
50
49
|
"@pob/sort-pkg": "12.1.1",
|
|
51
50
|
"@prettier/sync": "0.6.1",
|
|
52
51
|
"@types/inquirer": "9.0.9",
|
|
53
52
|
"@yeoman/adapter": "3.1.0",
|
|
54
53
|
"@yeoman/types": "1.8.0",
|
|
55
|
-
"eslint": "9.39.
|
|
54
|
+
"eslint": "9.39.3",
|
|
56
55
|
"findup-sync": "^5.0.0",
|
|
57
56
|
"git-remote-url": "^1.0.1",
|
|
58
57
|
"github-username": "^9.0.0",
|
|
@@ -64,16 +63,16 @@
|
|
|
64
63
|
"mem-fs-editor": "11.1.4",
|
|
65
64
|
"minimist": "1.2.8",
|
|
66
65
|
"parse-author": "2.0.0",
|
|
67
|
-
"pob-dependencies": "
|
|
68
|
-
"prettier": "3.
|
|
66
|
+
"pob-dependencies": "22.0.0",
|
|
67
|
+
"prettier": "3.8.1",
|
|
69
68
|
"semver": "7.7.3",
|
|
70
69
|
"typescript": "5.9.3",
|
|
71
|
-
"validate-npm-package-name": "^
|
|
70
|
+
"validate-npm-package-name": "^7.0.0",
|
|
72
71
|
"yeoman-environment": "5.0.0",
|
|
73
72
|
"yeoman-generator": "7.5.1"
|
|
74
73
|
},
|
|
75
74
|
"devDependencies": {
|
|
76
|
-
"@pob/root": "
|
|
75
|
+
"@pob/root": "22.0.0",
|
|
77
76
|
"@types/node": "22.19.1"
|
|
78
77
|
}
|
|
79
78
|
}
|