pob 35.5.0 → 35.7.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/README.md +2 -21
- package/lib/generators/common/babel/CommonBabelGenerator.js +8 -14
- package/lib/generators/common/release/CommonReleaseGenerator.js +2 -1
- package/lib/generators/common/testing/CommonTestingGenerator.js +24 -21
- package/lib/generators/common/testing/templates/vite.config.js.ejs +1 -1
- package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +5 -2
- package/lib/generators/core/ci/templates/github-action-documentation-workflow.yml.ejs +2 -2
- package/lib/generators/core/ci/templates/github-action-push-workflow-split.yml.ejs +1 -1
- package/lib/generators/core/ci/templates/github-action-push-workflow.yml.ejs +1 -1
- package/lib/generators/core/claude/CoreClaudeGenerator.js +81 -0
- package/lib/generators/core/vscode/CoreVSCodeGenerator.js +1 -1
- package/lib/generators/core/vscode/templates/settings.json.ejs +0 -6
- package/lib/generators/monorepo/PobMonorepoGenerator.js +0 -6
- package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +4 -1
- package/lib/generators/monorepo/workspaces/templates/README.md.ejs +1 -1
- package/lib/generators/pob/PobBaseGenerator.js +4 -0
- package/lib/pob.js +6 -0
- package/lib/utils/package.js +0 -26
- package/package.json +11 -11
- package/lib/generators/common/testing/templates/babel.config.cjs.ejs +0 -26
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
</h1>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
6
|
-
Pile of bones, library generator with git/babel/typescript/typedoc/readme/
|
|
6
|
+
Pile of bones, library generator with git/babel/typescript/typedoc/readme/vitest
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
@@ -28,30 +28,11 @@ You can now use `yarn run watch` !
|
|
|
28
28
|
|
|
29
29
|
### How this works
|
|
30
30
|
|
|
31
|
-
#### Babel
|
|
32
|
-
|
|
33
|
-
Write code in the `src` directory, it's then transpiled with babel and rollup to `dist`.
|
|
34
|
-
Use the task `yarn run build` or `yarn run watch` to transpile the code.
|
|
35
|
-
|
|
36
|
-
There are several environments: `node`, `browser`.
|
|
37
|
-
For each of these environments, there is also a `dev` version that add flow runtime checks.
|
|
38
|
-
|
|
39
31
|
#### Coding Rules
|
|
40
32
|
|
|
41
33
|
Eslint is used to ensure a common coding style. I mostly follow the [Airbnb coding style](https://github.com/airbnb/javascript/blob/master/README.md).
|
|
42
34
|
You can check the code by running the task `yarn run lint`. With an editor, install the plugins to validate the code as you type !
|
|
43
35
|
|
|
44
|
-
#### Documentation
|
|
45
|
-
|
|
46
|
-
[typedoc](https://typedoc.org/) allows to document the code and generate the api.
|
|
47
|
-
[jest](https://www.npmjs.com/package/jest) is used to generate the coverage.
|
|
48
|
-
|
|
49
|
-
Documentation can be generated by github actions and pushed to github-pages.
|
|
50
|
-
|
|
51
|
-
#### Tests
|
|
52
|
-
|
|
53
|
-
Tests are in the directory `src` with jest. Use the task `yarn test` to run the tests with jest.
|
|
54
|
-
|
|
55
36
|
### Available tasks with `yarn run`
|
|
56
37
|
|
|
57
38
|
#### Code, Transpile, Lint
|
|
@@ -59,7 +40,7 @@ Tests are in the directory `src` with jest. Use the task `yarn test` to run the
|
|
|
59
40
|
- `build`: `clean` the directory, build `src` to `dist` with rollup
|
|
60
41
|
- `watch`: `clean` then build and watch with rollup
|
|
61
42
|
- `lint`: execute `eslint`
|
|
62
|
-
- `test`: run tests
|
|
43
|
+
- `test`: run tests
|
|
63
44
|
|
|
64
45
|
### Generate documentation
|
|
65
46
|
|
|
@@ -304,6 +304,12 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
304
304
|
(env) => env.target === "browser",
|
|
305
305
|
);
|
|
306
306
|
|
|
307
|
+
if (useBabel) {
|
|
308
|
+
throw new Error(
|
|
309
|
+
"pob-babel is deprecated. Use @pob/rollup-esbuild or @pob/rollup-typescript instead.",
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
|
|
307
313
|
/* dependencies */
|
|
308
314
|
|
|
309
315
|
if (
|
|
@@ -322,14 +328,8 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
322
328
|
}
|
|
323
329
|
|
|
324
330
|
if (pkg.dependencies && pkg.dependencies["pob-babel"]) {
|
|
325
|
-
|
|
326
|
-
packageUtils.addDependencies(pkg, ["pob-babel"], "^");
|
|
327
|
-
}
|
|
328
|
-
if (pkg.dependencies && pkg.dependencies["@babel/runtime"]) {
|
|
329
|
-
// update pob-babel in alp-dev
|
|
330
|
-
packageUtils.addDependencies(pkg, ["@babel/runtime"], "^");
|
|
331
|
+
throw new Error("pob-babel is deprecated.");
|
|
331
332
|
}
|
|
332
|
-
|
|
333
333
|
const isLibraryRollupPlugin = pkg.name.includes("rollup-plugin");
|
|
334
334
|
|
|
335
335
|
packageUtils.addOrRemoveDevDependencies(
|
|
@@ -441,13 +441,7 @@ export default class CommonBabelGenerator extends Generator {
|
|
|
441
441
|
this.fs.delete(".babelrc");
|
|
442
442
|
this.fs.delete("babel.config.json");
|
|
443
443
|
this.fs.delete("babel.config.mjs");
|
|
444
|
-
|
|
445
|
-
this.fs.move(
|
|
446
|
-
this.destinationPath("babel.config.js"),
|
|
447
|
-
this.destinationPath("babel.config.cjs"),
|
|
448
|
-
);
|
|
449
|
-
}
|
|
450
|
-
|
|
444
|
+
this.fs.delete("babel.config.js");
|
|
451
445
|
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
452
446
|
}
|
|
453
447
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Generator from "yeoman-generator";
|
|
2
2
|
// import { latestLTS } from "../../../utils/nodeVersions.js";
|
|
3
|
+
import { latestLTS } from "../../../utils/nodeVersions.js";
|
|
3
4
|
import * as packageUtils from "../../../utils/package.js";
|
|
4
5
|
import {
|
|
5
6
|
packageManagerExec,
|
|
@@ -86,7 +87,7 @@ export default class CommonReleaseGenerator extends Generator {
|
|
|
86
87
|
isMonorepoIndependent:
|
|
87
88
|
this.options.isMonorepo &&
|
|
88
89
|
(!pkg.version || pkg.version === "0.0.0"),
|
|
89
|
-
nodeLatestMajorVersion:
|
|
90
|
+
nodeLatestMajorVersion: latestLTS,
|
|
90
91
|
packageManagerExec,
|
|
91
92
|
},
|
|
92
93
|
);
|
|
@@ -30,7 +30,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
30
30
|
this.option("runner", {
|
|
31
31
|
type: String,
|
|
32
32
|
default: "node",
|
|
33
|
-
description: "test runner (
|
|
33
|
+
description: "test runner (vitest or node)",
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
this.option("ci", {
|
|
@@ -157,14 +157,14 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
157
157
|
(inMonorepo && inMonorepo.pobMonorepoConfig) || {};
|
|
158
158
|
const globalTesting = yoConfigPobMonorepo && yoConfigPobMonorepo.testing;
|
|
159
159
|
const enableForMonorepo = this.options.monorepo && globalTesting;
|
|
160
|
-
const transpileWithEsbuild =
|
|
160
|
+
const transpileWithEsbuild = false;
|
|
161
161
|
const transpileWithBabel = transpileWithEsbuild
|
|
162
162
|
? false
|
|
163
163
|
: // eslint-disable-next-line unicorn/no-nested-ternary
|
|
164
164
|
this.options.monorepo
|
|
165
165
|
? yoConfigPobMonorepo.typescript &&
|
|
166
166
|
yoConfigPobMonorepo.typescript !== "check-only"
|
|
167
|
-
:
|
|
167
|
+
: false;
|
|
168
168
|
const withTypescript =
|
|
169
169
|
transpileWithBabel ||
|
|
170
170
|
pkg.pob?.bundler === "tsc" ||
|
|
@@ -243,9 +243,7 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
243
243
|
|
|
244
244
|
const createTestCommand = ({
|
|
245
245
|
coverage,
|
|
246
|
-
coverageJson,
|
|
247
246
|
watch,
|
|
248
|
-
|
|
249
247
|
workspacesPattern,
|
|
250
248
|
hasReact,
|
|
251
249
|
}) => {
|
|
@@ -259,12 +257,13 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
259
257
|
if (!workspacesPattern && this.options.monorepo) {
|
|
260
258
|
throw new Error("Invalid workspacesPattern");
|
|
261
259
|
}
|
|
262
|
-
const experimentalTestCoverage =
|
|
260
|
+
const experimentalTestCoverage =
|
|
261
|
+
pkg.name === "check-package-dependencies";
|
|
263
262
|
return `TZ=UTC ${
|
|
264
|
-
coverage
|
|
263
|
+
coverage && !experimentalTestCoverage
|
|
265
264
|
? `npx c8${
|
|
266
|
-
|
|
267
|
-
? ` --reporter=${
|
|
265
|
+
coverage === "generate"
|
|
266
|
+
? ` --reporter=${coverage === "generate" ? "json" : "lcov"}`
|
|
268
267
|
: ""
|
|
269
268
|
} --all --src ./${this.options.srcDirectory} `
|
|
270
269
|
: ""
|
|
@@ -272,9 +271,9 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
272
271
|
this.options.typescript
|
|
273
272
|
? `${tsTestLoaderOption ? `${tsTestLoaderOption} ` : ""}`
|
|
274
273
|
: ""
|
|
275
|
-
}${this.fs.exists("src/test-setup.ts") ? "--import ./src/test-setup.ts " : ""}--test${experimentalTestCoverage &&
|
|
274
|
+
}${this.fs.exists("src/test-setup.ts") ? "--import ./src/test-setup.ts " : ""}--test${experimentalTestCoverage && coverage ? ` --experimental-test-coverage${coverage === "generate" ? " --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=docs/coverage.lcov" : ""} --test-coverage-include="${this.options.srcDirectory}/**/*.ts"` : ""} '${this.options.monorepo ? `${workspacesPattern}/*/` : ""}${`${
|
|
276
275
|
hasTestFolder ? "test/*" : `${this.options.srcDirectory}/**/*.test`
|
|
277
|
-
}.${this.options.typescript ? "ts" : "js"}`}`;
|
|
276
|
+
}.${this.options.typescript ? "ts" : "js"}`}'`;
|
|
278
277
|
}
|
|
279
278
|
case "bun": {
|
|
280
279
|
if (this.options.packageManager !== "bun") {
|
|
@@ -284,17 +283,17 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
284
283
|
}
|
|
285
284
|
|
|
286
285
|
return `TZ=UTC bun test${watch ? " --watch" : ""}${
|
|
287
|
-
coverage
|
|
288
|
-
? ` --coverage ${
|
|
286
|
+
coverage
|
|
287
|
+
? ` --coverage ${coverage === "generate" ? "--coverage-report=json" : ""}`
|
|
289
288
|
: ""
|
|
290
289
|
}`;
|
|
291
290
|
}
|
|
292
291
|
case "vitest": {
|
|
293
292
|
return `TZ=UTC ${
|
|
294
|
-
coverage
|
|
295
|
-
? `POB_VITEST_COVERAGE=${`json${
|
|
293
|
+
coverage
|
|
294
|
+
? `POB_VITEST_COVERAGE=${`json${coverage === "generate" ? "" : ",text"} `}`
|
|
296
295
|
: ""
|
|
297
|
-
}vitest${watch ? " --watch" : ""}${coverage
|
|
296
|
+
}vitest${watch ? " --watch" : ""}${coverage ? " run --coverage" : ""}`;
|
|
298
297
|
}
|
|
299
298
|
default: {
|
|
300
299
|
throw new Error(`Invalid runner: "${testRunner}"`);
|
|
@@ -370,8 +369,12 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
370
369
|
);
|
|
371
370
|
}
|
|
372
371
|
|
|
372
|
+
packageUtils.removeScripts(pkg, [
|
|
373
|
+
"test:coverage:lcov",
|
|
374
|
+
"test:coverage:json",
|
|
375
|
+
]);
|
|
376
|
+
|
|
373
377
|
if (this.options.monorepo) {
|
|
374
|
-
packageUtils.removeScripts(pkg, ["test:coverage:lcov"]);
|
|
375
378
|
packageUtils.addScripts(pkg, {
|
|
376
379
|
test: createTestCommand({
|
|
377
380
|
workspacesPattern,
|
|
@@ -384,9 +387,9 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
384
387
|
workspacesPattern,
|
|
385
388
|
coverage: true,
|
|
386
389
|
}),
|
|
387
|
-
"test:coverage:
|
|
390
|
+
"test:coverage:generate": createTestCommand({
|
|
388
391
|
workspacesPattern,
|
|
389
|
-
|
|
392
|
+
coverage: "generate",
|
|
390
393
|
}),
|
|
391
394
|
});
|
|
392
395
|
} else {
|
|
@@ -420,8 +423,8 @@ export default class CommonTestingGenerator extends Generator {
|
|
|
420
423
|
"test:coverage": createTestCommand({
|
|
421
424
|
coverage: true,
|
|
422
425
|
}),
|
|
423
|
-
"test:coverage:
|
|
424
|
-
|
|
426
|
+
"test:coverage:generate": createTestCommand({
|
|
427
|
+
coverage: "generate",
|
|
425
428
|
}),
|
|
426
429
|
});
|
|
427
430
|
|
|
@@ -6,7 +6,7 @@ export default defineConfig({
|
|
|
6
6
|
include: ["<%= srcDirectory %>/**/__tests__/**/*.ts?(x)", "<%= srcDirectory %>/**/*.test.ts?(x)"],
|
|
7
7
|
coverage: {
|
|
8
8
|
include: ["<%= srcDirectory %>/**/*.ts?(x)"],
|
|
9
|
-
reportsDirectory: "
|
|
9
|
+
reportsDirectory: "coverage",
|
|
10
10
|
reporter: (process.env.POB_VITEST_COVERAGE || "json,text").split(","),
|
|
11
11
|
},
|
|
12
12
|
},
|
|
@@ -160,7 +160,6 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
160
160
|
const cleanCommand = (() => {
|
|
161
161
|
if (bundler === "rollup-typescript") return "pob-typescript-clean-out";
|
|
162
162
|
if (bundler === "rollup-esbuild") return "pob-esbuild-clean-out";
|
|
163
|
-
if (bundler === "rollup-babel") return "pob-babel-clean-out";
|
|
164
163
|
if (bundler === "esbuild") return "pob-esbuild-clean-out";
|
|
165
164
|
if (bundler === "tsc") return "rm -Rf";
|
|
166
165
|
if (bundler) throw new Error(`Invalid bundler: ${bundler}`);
|
|
@@ -524,6 +523,7 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
524
523
|
if (extraEntryConfig.name.endsWith(".css")) {
|
|
525
524
|
return {
|
|
526
525
|
style: `./${extraEntryConfig.name}`,
|
|
526
|
+
import: `./${extraEntryConfig.name}`,
|
|
527
527
|
default: `./${extraEntryConfig.name}`,
|
|
528
528
|
};
|
|
529
529
|
}
|
|
@@ -610,7 +610,7 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
610
610
|
envs.some(
|
|
611
611
|
(env) =>
|
|
612
612
|
env.target === "node" &&
|
|
613
|
-
(["
|
|
613
|
+
(["4", "6", "8", "10", "12", "14", "16", "18", "20"].includes(
|
|
614
614
|
String(env.version),
|
|
615
615
|
) ||
|
|
616
616
|
(this.options.onlyLatestLTS &&
|
|
@@ -667,6 +667,9 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
667
667
|
: `${maintenanceLTS}`)();
|
|
668
668
|
|
|
669
669
|
switch (String(minNodeVersion)) {
|
|
670
|
+
case "4":
|
|
671
|
+
case "6":
|
|
672
|
+
case "8":
|
|
670
673
|
case "10":
|
|
671
674
|
case "12":
|
|
672
675
|
case "14":
|
|
@@ -58,11 +58,11 @@ jobs:
|
|
|
58
58
|
<% if (testRunner === 'node') { -%>
|
|
59
59
|
|
|
60
60
|
- name: Generate Coverage
|
|
61
|
-
run: NODE_V8_COVERAGE=./docs/coverage <%= packageManager %> run test:coverage
|
|
61
|
+
run: NODE_V8_COVERAGE=./docs/coverage <%= packageManager %> run test:coverage:generate
|
|
62
62
|
<% } else {-%>
|
|
63
63
|
|
|
64
64
|
- name: Generate Coverage
|
|
65
|
-
run: <%= packageManager %> run test:coverage:
|
|
65
|
+
run: <%= packageManager %> run test:coverage:generate
|
|
66
66
|
<% } -%>
|
|
67
67
|
<% } -%>
|
|
68
68
|
|
|
@@ -203,7 +203,7 @@ jobs:
|
|
|
203
203
|
if: matrix.node-version != <%= nodeLatestMajorVersion %>
|
|
204
204
|
|
|
205
205
|
- name: Generate Test Coverage
|
|
206
|
-
run: <%= packageManager %> run test:coverage:
|
|
206
|
+
run: <%= packageManager %> run test:coverage:generate
|
|
207
207
|
if: matrix.node-version == <%= nodeLatestMajorVersion %>
|
|
208
208
|
env:
|
|
209
209
|
CI: true
|
|
@@ -89,7 +89,7 @@ jobs:
|
|
|
89
89
|
<% if (codecov) { -%>
|
|
90
90
|
|
|
91
91
|
- name: Generate Test Coverage
|
|
92
|
-
run: <%= packageManager %> run test:coverage:
|
|
92
|
+
run: <%= packageManager %> run test:coverage:generate
|
|
93
93
|
if: startsWith(matrix.node-version, '<%= nodeLatestMajorVersion %>.')
|
|
94
94
|
env:
|
|
95
95
|
CI: true
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import Generator from "yeoman-generator";
|
|
2
|
+
import { writeAndFormatJson } from "../../../utils/writeAndFormat.js";
|
|
3
|
+
|
|
4
|
+
const claudePostToolUseHook = {
|
|
5
|
+
matcher: "Edit|Write|MultiEdit",
|
|
6
|
+
hooks: [{ type: "command", command: "pob-claude-run-lint-staged" }],
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default class CoreClaudeGenerator extends Generator {
|
|
10
|
+
constructor(args, opts) {
|
|
11
|
+
super(args, opts);
|
|
12
|
+
|
|
13
|
+
this.option("root", {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
required: false,
|
|
16
|
+
default: true,
|
|
17
|
+
description: "Root package.",
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async writing() {
|
|
22
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"), {});
|
|
23
|
+
const claudeGitignorePath = this.destinationPath(".claude/.gitignore");
|
|
24
|
+
const claudeSettingsPath = this.destinationPath(".claude/settings.json");
|
|
25
|
+
|
|
26
|
+
if (!this.options.root) {
|
|
27
|
+
this.fs.delete(claudeGitignorePath);
|
|
28
|
+
this.fs.delete(claudeSettingsPath);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
this.fs.write(
|
|
33
|
+
claudeGitignorePath,
|
|
34
|
+
"/settings.local.json\n/skills/local.*\n",
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const existing = this.fs.readJSON(claudeSettingsPath, {
|
|
38
|
+
hooks: {
|
|
39
|
+
PostToolUse: [
|
|
40
|
+
{
|
|
41
|
+
matcher: "Edit|Write|MultiEdit",
|
|
42
|
+
hooks: [
|
|
43
|
+
{
|
|
44
|
+
type: "command",
|
|
45
|
+
command:
|
|
46
|
+
pkg.name === "pob-monorepo"
|
|
47
|
+
? "node ./@pob/root/bin/pob-claude-run-lint-staged.js"
|
|
48
|
+
: "./node_modules/.bin/pob-claude-run-lint-staged",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Find or create the PostToolUse hook entry for our matcher
|
|
57
|
+
const postToolUse = existing.hooks?.PostToolUse ?? [];
|
|
58
|
+
|
|
59
|
+
const existingEntry = postToolUse.find(
|
|
60
|
+
(entry) => entry.matcher === claudePostToolUseHook.matcher,
|
|
61
|
+
);
|
|
62
|
+
if (existingEntry) {
|
|
63
|
+
// Add any of our hooks not already present
|
|
64
|
+
for (const hook of claudePostToolUseHook.hooks) {
|
|
65
|
+
if (!existingEntry.hooks?.some((h) => h.command === hook.command)) {
|
|
66
|
+
(existingEntry.hooks ??= []).push(hook);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
postToolUse.push(claudePostToolUseHook);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
await writeAndFormatJson(this.fs, claudeSettingsPath, {
|
|
74
|
+
...existing,
|
|
75
|
+
hooks: {
|
|
76
|
+
...existing.hooks,
|
|
77
|
+
PostToolUse: postToolUse,
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -37,7 +37,7 @@ export default class CoreVSCodeGenerator extends Generator {
|
|
|
37
37
|
this.option("testRunner", {
|
|
38
38
|
type: String,
|
|
39
39
|
required: false,
|
|
40
|
-
description: "Test runner (
|
|
40
|
+
description: "Test runner (node, vitest, ...)",
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
this.option("yarnNodeLinker", {
|
|
@@ -40,12 +40,6 @@
|
|
|
40
40
|
"source.organizeImports": "never"
|
|
41
41
|
},
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
<% if (testing && module && (!testRunner || testRunner === 'jest')) { -%>
|
|
45
|
-
// jest
|
|
46
|
-
"jest.jestCommandLine": "NODE_OPTIONS=--experimental-vm-modules node_modules/.bin/jest",
|
|
47
|
-
<% } -%>
|
|
48
|
-
|
|
49
43
|
// extension eslint config
|
|
50
44
|
"eslint.workingDirectories": ["."],
|
|
51
45
|
"eslint.useFlatConfig": true,
|
|
@@ -406,12 +406,6 @@ export default class PobMonorepoGenerator extends Generator {
|
|
|
406
406
|
build: `${packageManagerRun(this.options.packageManager, "clean:build")} && rollup --config rollup.config.mjs`,
|
|
407
407
|
watch: `${packageManagerRun(this.options.packageManager, "clean:build")} && rollup --config rollup.config.mjs --watch`,
|
|
408
408
|
});
|
|
409
|
-
packageUtils.addOrRemoveDevDependencies(
|
|
410
|
-
pkg,
|
|
411
|
-
rollupConfigs.length > 0 &&
|
|
412
|
-
(rollupKinds.size === 0 || rollupKinds.has("babel")),
|
|
413
|
-
["@babel/core", "pob-babel"],
|
|
414
|
-
);
|
|
415
409
|
|
|
416
410
|
packageUtils.addOrRemoveDevDependencies(pkg, rollupKinds.has("esbuild"), [
|
|
417
411
|
"@pob/rollup-esbuild",
|
|
@@ -63,12 +63,15 @@ export default class MonorepoWorkspacesGenerator extends Generator {
|
|
|
63
63
|
writing() {
|
|
64
64
|
const getPackagePobConfig = (config) => ({
|
|
65
65
|
babelEnvs: [],
|
|
66
|
+
envs: [],
|
|
66
67
|
...(config && config.pob),
|
|
67
68
|
});
|
|
68
69
|
const withBundler = this.packages.some((config) => {
|
|
69
70
|
const pobConfig = getPackagePobConfig(config);
|
|
70
71
|
return (
|
|
71
|
-
pobConfig.
|
|
72
|
+
pobConfig.envs.length > 0 ||
|
|
73
|
+
pobConfig.babelEnvs.length > 0 ||
|
|
74
|
+
pobConfig.bundler === "rollup-babel"
|
|
72
75
|
);
|
|
73
76
|
});
|
|
74
77
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<h3>📦 Packages</h3>
|
|
12
12
|
|
|
13
|
-
This repository is a monorepo
|
|
13
|
+
This repository is a monorepo using workspaces.
|
|
14
14
|
|
|
15
15
|
| Package | Version | Description |
|
|
16
16
|
|---------|---------|-------------|
|
|
@@ -199,6 +199,10 @@ export default class PobBaseGenerator extends Generator {
|
|
|
199
199
|
|
|
200
200
|
this.composeWith("pob:core:editorconfig");
|
|
201
201
|
|
|
202
|
+
this.composeWith("pob:core:claude", {
|
|
203
|
+
root: this.isRoot,
|
|
204
|
+
});
|
|
205
|
+
|
|
202
206
|
this.composeWith("pob:core:clean", {
|
|
203
207
|
root: this.isRoot,
|
|
204
208
|
});
|
package/lib/pob.js
CHANGED
|
@@ -24,6 +24,7 @@ import CommonTranspilerGenerator from "./generators/common/transpiler/CommonTran
|
|
|
24
24
|
import CommonTypescriptGenerator from "./generators/common/typescript/CommonTypescriptGenerator.js";
|
|
25
25
|
import CoreBunGenerator from "./generators/core/bun/CoreBunGenerator.js";
|
|
26
26
|
import CoreCIGenerator from "./generators/core/ci/CoreCIGenerator.js";
|
|
27
|
+
import CoreClaudeGenerator from "./generators/core/claude/CoreClaudeGenerator.js";
|
|
27
28
|
import CoreCleanGenerator from "./generators/core/clean/CoreCleanGenerator.js";
|
|
28
29
|
import CoreEditorConfigGenerator from "./generators/core/editorconfig/CoreEditorConfigGenerator.js";
|
|
29
30
|
import CoreGitGenerator from "./generators/core/git/CoreGitGenerator.js";
|
|
@@ -156,6 +157,11 @@ env.registerStub(
|
|
|
156
157
|
"pob:core:editorconfig",
|
|
157
158
|
`${__dirname}/generators/core/editorconfig/CoreEditorConfigGenerator.js`,
|
|
158
159
|
);
|
|
160
|
+
env.registerStub(
|
|
161
|
+
CoreClaudeGenerator,
|
|
162
|
+
"pob:core:claude",
|
|
163
|
+
`${__dirname}/generators/core/claude/CoreClaudeGenerator.js`,
|
|
164
|
+
);
|
|
159
165
|
env.registerStub(
|
|
160
166
|
CoreGitGenerator,
|
|
161
167
|
"pob:core:git",
|
package/lib/utils/package.js
CHANGED
|
@@ -16,32 +16,6 @@ export { default as parseAuthor } from "parse-author";
|
|
|
16
16
|
export const parsePkgAuthor = (pkg) =>
|
|
17
17
|
typeof pkg.author === "string" ? parseAuthor(pkg.author) : pkg.author;
|
|
18
18
|
|
|
19
|
-
export const hasLerna = (pkg) =>
|
|
20
|
-
!!(pkg.devDependencies && pkg.devDependencies.lerna);
|
|
21
|
-
|
|
22
|
-
export const hasBabel = (pkg) =>
|
|
23
|
-
!!(
|
|
24
|
-
pkg.devDependencies &&
|
|
25
|
-
(pkg.devDependencies["pob-babel"] || pkg.devDependencies["@babel/core"])
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
export const transpileWithEsbuild = (pkg) =>
|
|
29
|
-
!!(pkg.devDependencies && pkg.devDependencies["jest-esbuild"]);
|
|
30
|
-
|
|
31
|
-
export const transpileWithBabel = (pkg) =>
|
|
32
|
-
!!(
|
|
33
|
-
(pkg.devDependencies &&
|
|
34
|
-
(pkg.devDependencies["pob-babel"] ||
|
|
35
|
-
pkg.devDependencies.next ||
|
|
36
|
-
pkg.devDependencies["@yarnpkg/builder"] ||
|
|
37
|
-
pkg.devDependencies["alp-dev"])) ||
|
|
38
|
-
// alp-dev has pob-babel in dependencies
|
|
39
|
-
(pkg.dependencies &&
|
|
40
|
-
(pkg.dependencies["pob-babel"] ||
|
|
41
|
-
pkg.dependencies.next ||
|
|
42
|
-
pkg.dependencies["alp-dev"]))
|
|
43
|
-
);
|
|
44
|
-
|
|
45
19
|
export const hasReact = (pkg) =>
|
|
46
20
|
!!(
|
|
47
21
|
(pkg.dependencies && pkg.dependencies.react) ||
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "35.
|
|
4
|
-
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/
|
|
3
|
+
"version": "35.7.0",
|
|
4
|
+
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/vitest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
7
7
|
],
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"./package.json": "./package.json"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@pob/eslint-config": "65.
|
|
32
|
-
"@pob/eslint-config-typescript-react": "65.
|
|
33
|
-
"@types/inquirer": "9.0.
|
|
31
|
+
"@pob/eslint-config": "65.6.0",
|
|
32
|
+
"@pob/eslint-config-typescript-react": "65.6.0",
|
|
33
|
+
"@types/inquirer": "9.0.10",
|
|
34
34
|
"@yeoman/adapter": "4.0.2",
|
|
35
35
|
"@yeoman/types": "1.11.1",
|
|
36
|
-
"eslint": "10.
|
|
36
|
+
"eslint": "10.7.0",
|
|
37
37
|
"findup-sync": "^5.0.0",
|
|
38
38
|
"git-remote-url": "^1.0.1",
|
|
39
39
|
"github-username": "^9.0.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"json5": "^2.2.3",
|
|
42
42
|
"lodash.camelcase": "^4.3.0",
|
|
43
43
|
"lodash.kebabcase": "^4.1.1",
|
|
44
|
-
"mem-fs": "4.1.
|
|
44
|
+
"mem-fs": "4.1.5",
|
|
45
45
|
"mem-fs-editor": "12.0.4",
|
|
46
46
|
"minimist": "1.2.8",
|
|
47
47
|
"oxfmt": "0.54.0",
|
|
@@ -52,12 +52,12 @@
|
|
|
52
52
|
"yeoman-environment": "6.1.0",
|
|
53
53
|
"yeoman-generator": "8.2.2",
|
|
54
54
|
"@pob/sort-object": "11.1.1",
|
|
55
|
-
"pob-dependencies": "24.
|
|
56
|
-
"@pob/sort-pkg": "13.1.
|
|
55
|
+
"pob-dependencies": "24.4.0",
|
|
56
|
+
"@pob/sort-pkg": "13.1.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@types/node": "24.
|
|
60
|
-
"@pob/root": "24.
|
|
59
|
+
"@types/node": "24.13.3",
|
|
60
|
+
"@pob/root": "24.7.0"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=22.18.0"
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
module.exports = function babelConfig(api) {
|
|
4
|
-
const isTest = api.env('test');
|
|
5
|
-
|
|
6
|
-
if (!isTest) return {};
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
only: [<%- only %>],
|
|
10
|
-
presets: [
|
|
11
|
-
['pob-babel/preset.js', { modules: <%- jestExperimentalESM ? 'false' : "'commonjs'" %> }]
|
|
12
|
-
<% if (hasReact) { %>, [
|
|
13
|
-
'@babel/preset-react',
|
|
14
|
-
{
|
|
15
|
-
runtime: 'automatic',
|
|
16
|
-
development: false,
|
|
17
|
-
useBuiltIns: true,
|
|
18
|
-
useSpread: true,
|
|
19
|
-
},
|
|
20
|
-
]<% } %>
|
|
21
|
-
<% if (hasLinaria) { %>, [
|
|
22
|
-
'@linaria/babel-preset'
|
|
23
|
-
]<% } %>
|
|
24
|
-
],
|
|
25
|
-
};
|
|
26
|
-
};
|