pob 38.11.0 → 38.13.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/lib/generators/app/PobAppGenerator.js +25 -5
- package/lib/generators/app/vite/AppViteGenerator.js +50 -3
- package/lib/generators/app/vite/templates/index.html.ejs +11 -0
- package/lib/generators/app/vite/templates/index.ts.ejs +1 -0
- package/lib/generators/app/vite/templates/vite.config.js.ejs +8 -0
- package/lib/generators/common/babel/templates/app.rollup.config.mjs.ejs +1 -0
- package/lib/generators/common/babel/templates/lib.rollup.config.mjs.ejs +1 -0
- package/lib/generators/common/e2e/CommonE2eGenerator.js +6 -1
- package/lib/generators/common/format-lint/CommonLintGenerator.js +141 -85
- package/lib/generators/common/format-lint/templates/oxfmtrc.jsonc.ejs +1 -0
- package/lib/generators/common/husky/templates/lint-staged.config.js.txt +1 -0
- package/lib/generators/common/release/templates/workflow-release.yml.ejs +21 -10
- package/lib/generators/common/testing/templates/vite.config.js.ejs +1 -0
- package/lib/generators/common/transpiler/templates/app.rollup.config.mjs.ejs +1 -0
- package/lib/generators/common/transpiler/templates/lib.rollup.config.mjs.ejs +1 -0
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +13 -1
- package/lib/generators/common/typescript/templates/tsconfig.check-js.json.ejs +1 -0
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +1 -0
- package/lib/generators/common/typescript/templates/tsconfig.tools.json.ejs +1 -0
- package/lib/generators/core/bun/templates/bunfig.toml.ejs +1 -0
- package/lib/generators/core/ci/templates/github-action-documentation-workflow.yml.ejs +2 -1
- package/lib/generators/core/ci/templates/github-action-push-workflow-split.yml.ejs +6 -5
- package/lib/generators/core/ci/templates/github-action-push-workflow.yml.ejs +2 -1
- package/lib/generators/core/claude/CoreClaudeGenerator.js +1 -1
- package/lib/generators/core/editorconfig/templates/editorconfig +1 -0
- package/lib/generators/core/git/CoreGitGenerator.js +72 -57
- package/lib/generators/core/git/generators/github/CoreGitGithubGenerator.js +192 -145
- package/lib/generators/core/gitignore/templates/gitignore.ejs +1 -0
- package/lib/generators/core/npm/templates/npmignore.ejs +1 -0
- package/lib/generators/core/package/CorePackageGenerator.js +21 -8
- package/lib/generators/core/pnpm/CorePnpmGenerator.js +30 -9
- package/lib/generators/core/vscode/templates/extensions.json.ejs +1 -0
- package/lib/generators/core/vscode/templates/settings.json.ejs +1 -0
- package/lib/generators/core/yarn/templates/yarn_gitignore.ejs +1 -0
- package/lib/generators/lib/PobLibGenerator.js +1 -0
- package/lib/generators/lib/doc/LibDocGenerator.js +3 -1
- package/lib/generators/lib/doc/templates/tsconfig.doc.json.ejs +1 -0
- package/lib/generators/lib/doc/templates/tsconfig.doc.json.lerna.ejs +1 -0
- package/lib/generators/monorepo/PobMonorepoGenerator.js +26 -5
- package/lib/generators/monorepo/templates/monorepo.rollup.config.mjs.ejs +1 -0
- package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +21 -10
- package/lib/generators/monorepo/typescript/templates/tsconfig.json.ejs +1 -0
- package/lib/generators/monorepo/typescript/templates/tsconfig.tools.json.ejs +1 -0
- package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +12 -4
- package/lib/generators/pob/PobBaseGenerator.js +1 -1
- package/lib/pob.js +49 -12
- package/lib/utils/git.js +34 -0
- package/lib/utils/git.test.js +71 -0
- package/lib/utils/workspaceUtils.js +10 -0
- package/lib/utils/workspaceUtils.test.js +15 -0
- package/package.json +13 -13
- package/lib/generators/common/format-lint/templates/eslint.config.js.ejs +0 -5
|
@@ -240,12 +240,14 @@ export default class PobAppGenerator extends Generator {
|
|
|
240
240
|
|
|
241
241
|
const enableHashSlash = shouldEnableHashSlash(this.appConfig.type);
|
|
242
242
|
|
|
243
|
+
this.useTypescript = Boolean(
|
|
244
|
+
typescript ||
|
|
245
|
+
pkg.pob?.typescript === "check-only" ||
|
|
246
|
+
(inMonorepo && inMonorepo.pobMonorepoConfig?.typescript === "check-only"),
|
|
247
|
+
);
|
|
248
|
+
|
|
243
249
|
this.composeWith("pob:common:typescript", {
|
|
244
|
-
enable:
|
|
245
|
-
typescript ||
|
|
246
|
-
pkg.pob?.typescript === "check-only" ||
|
|
247
|
-
(inMonorepo &&
|
|
248
|
-
inMonorepo.pobMonorepoConfig?.typescript === "check-only"),
|
|
250
|
+
enable: this.useTypescript,
|
|
249
251
|
onlyCheck:
|
|
250
252
|
pkg.pob?.typescript === "check-only" ||
|
|
251
253
|
(inMonorepo &&
|
|
@@ -265,6 +267,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
265
267
|
updateOnly: this.options.updateOnly,
|
|
266
268
|
resolveJsonModule: true,
|
|
267
269
|
onlyLatestLTS: true,
|
|
270
|
+
packageManager: this.options.packageManager,
|
|
268
271
|
enableHashSlash,
|
|
269
272
|
plugins: (() => {
|
|
270
273
|
if (this.appConfig.type === "next.js") {
|
|
@@ -387,6 +390,7 @@ export default class PobAppGenerator extends Generator {
|
|
|
387
390
|
case "vite-with-server":
|
|
388
391
|
this.composeWith("pob:app:vite", {
|
|
389
392
|
enableServer: this.appConfig.type === "vite-with-server",
|
|
393
|
+
packageManager: this.options.packageManager,
|
|
390
394
|
});
|
|
391
395
|
break;
|
|
392
396
|
case "expo":
|
|
@@ -428,6 +432,22 @@ export default class PobAppGenerator extends Generator {
|
|
|
428
432
|
}
|
|
429
433
|
}
|
|
430
434
|
|
|
435
|
+
// consumers and their tools (bundlers, type-aware lint) resolve the
|
|
436
|
+
// package through package.json, not through the tsconfig paths
|
|
437
|
+
if (this.appConfig.type === "untranspiled-library") {
|
|
438
|
+
const entry =
|
|
439
|
+
["ts", "tsx", "js"]
|
|
440
|
+
.map((extension) => `./${srcDirectory}/index.${extension}`)
|
|
441
|
+
.find((path) => this.fs.exists(this.destinationPath(path))) ||
|
|
442
|
+
`./${srcDirectory}/index.${this.useTypescript ? "ts" : "js"}`;
|
|
443
|
+
if (!pkg.main) pkg.main = entry;
|
|
444
|
+
if (!pkg.exports) {
|
|
445
|
+
pkg.exports = { ".": entry };
|
|
446
|
+
} else if (typeof pkg.exports === "object" && !pkg.exports["."]) {
|
|
447
|
+
pkg.exports = { ".": entry, ...pkg.exports };
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
431
451
|
if (this.appConfig.type === "expo") {
|
|
432
452
|
pkg.expo = { install: { exclude: ["typescript"] } };
|
|
433
453
|
} else if (pkg.expo) {
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import Generator from "yeoman-generator";
|
|
2
2
|
import * as packageUtils from "../../../utils/package.js";
|
|
3
|
+
import { packageManagerRun } from "../../../utils/packageManagerUtils.js";
|
|
4
|
+
import { copyAndFormatTpl } from "../../../utils/writeAndFormat.js";
|
|
5
|
+
|
|
6
|
+
const viteConfigFileNames = [
|
|
7
|
+
"vite.config.js",
|
|
8
|
+
"vite.config.mjs",
|
|
9
|
+
"vite.config.ts",
|
|
10
|
+
"vite.config.mts",
|
|
11
|
+
];
|
|
3
12
|
|
|
4
13
|
export default class AppViteGenerator extends Generator {
|
|
5
14
|
constructor(args, opts) {
|
|
@@ -8,18 +17,27 @@ export default class AppViteGenerator extends Generator {
|
|
|
8
17
|
type: Boolean,
|
|
9
18
|
default: false,
|
|
10
19
|
});
|
|
20
|
+
|
|
21
|
+
this.option("packageManager", {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "yarn",
|
|
24
|
+
});
|
|
11
25
|
}
|
|
12
26
|
|
|
13
|
-
writing() {
|
|
27
|
+
async writing() {
|
|
14
28
|
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
29
|
+
const run = (script) =>
|
|
30
|
+
packageManagerRun(this.options.packageManager, script);
|
|
31
|
+
|
|
32
|
+
packageUtils.addDevDependencies(pkg, ["vite"]);
|
|
15
33
|
|
|
16
34
|
if (this.options.enableServer) {
|
|
17
35
|
packageUtils.addScripts(pkg, {
|
|
18
|
-
build: "
|
|
36
|
+
build: `${run("build:client")} && ${run("build:server")}`,
|
|
19
37
|
"build:client": "vite build --outDir dist/client",
|
|
20
38
|
"build:server":
|
|
21
39
|
"vite build --ssr src/entry-server.tsx --outDir dist/server",
|
|
22
|
-
preview: "
|
|
40
|
+
preview: `${run("build")} && ${run("start:prod")}`,
|
|
23
41
|
start: "node server.js",
|
|
24
42
|
"start:prod": "NODE_ENV=production node server.js",
|
|
25
43
|
});
|
|
@@ -30,6 +48,35 @@ export default class AppViteGenerator extends Generator {
|
|
|
30
48
|
start: "vite",
|
|
31
49
|
serve: "vite preview",
|
|
32
50
|
});
|
|
51
|
+
|
|
52
|
+
// a new app: the files are never overwritten
|
|
53
|
+
const hasViteConfig = viteConfigFileNames.some((fileName) =>
|
|
54
|
+
this.fs.exists(this.destinationPath(fileName)),
|
|
55
|
+
);
|
|
56
|
+
if (!hasViteConfig) {
|
|
57
|
+
await copyAndFormatTpl(
|
|
58
|
+
this.fs,
|
|
59
|
+
this.templatePath("vite.config.js.ejs"),
|
|
60
|
+
this.destinationPath("vite.config.js"),
|
|
61
|
+
{},
|
|
62
|
+
);
|
|
63
|
+
if (!this.fs.exists(this.destinationPath("src/index.html"))) {
|
|
64
|
+
await copyAndFormatTpl(
|
|
65
|
+
this.fs,
|
|
66
|
+
this.templatePath("index.html.ejs"),
|
|
67
|
+
this.destinationPath("src/index.html"),
|
|
68
|
+
{ name: pkg.name },
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
if (!this.fs.exists(this.destinationPath("src/index.ts"))) {
|
|
72
|
+
await copyAndFormatTpl(
|
|
73
|
+
this.fs,
|
|
74
|
+
this.templatePath("index.ts.ejs"),
|
|
75
|
+
this.destinationPath("src/index.ts"),
|
|
76
|
+
{ name: pkg.name },
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
33
80
|
}
|
|
34
81
|
|
|
35
82
|
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title><%= name %></title>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
<script type="module" src="./index.ts"></script>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
document.body.append("<%= name %>");
|
|
@@ -24,7 +24,12 @@ export default class CommonE2eGenerator extends Generator {
|
|
|
24
24
|
]);
|
|
25
25
|
|
|
26
26
|
packageUtils.addOrRemoveScripts(pkg, this.options.enable, {
|
|
27
|
-
|
|
27
|
+
// keeps the browsers added by hand, like webkit for iPhone projects
|
|
28
|
+
"test:e2e:prepare": pkg.scripts?.["test:e2e:prepare"]?.startsWith(
|
|
29
|
+
"playwright install ",
|
|
30
|
+
)
|
|
31
|
+
? pkg.scripts["test:e2e:prepare"]
|
|
32
|
+
: "playwright install chromium",
|
|
28
33
|
"test:e2e": "playwright test -c e2e/playwright.config.ts",
|
|
29
34
|
});
|
|
30
35
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { format } from "oxfmt";
|
|
2
3
|
import Generator from "yeoman-generator";
|
|
3
4
|
import { quoteArg } from "../../../utils/execUtils.js";
|
|
4
5
|
import inMonorepo from "../../../utils/inMonorepo.js";
|
|
@@ -13,6 +14,48 @@ import {
|
|
|
13
14
|
} from "../../../utils/writeAndFormat.js";
|
|
14
15
|
import { appIgnorePaths } from "../../app/ignorePaths.js";
|
|
15
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} eslintConfigPath
|
|
19
|
+
* @param {{ imports: string[], flatCascade: string[] }} eslintConfig
|
|
20
|
+
*/
|
|
21
|
+
const renderEslintConfig = async (
|
|
22
|
+
eslintConfigPath,
|
|
23
|
+
{ imports, flatCascade },
|
|
24
|
+
) => {
|
|
25
|
+
const { code } = await format(
|
|
26
|
+
eslintConfigPath,
|
|
27
|
+
`${imports.map((value) => `${value};\n`).join("")}
|
|
28
|
+
export default [
|
|
29
|
+
${flatCascade.map((value) => ` ${value},\n`).join("")}];
|
|
30
|
+
`,
|
|
31
|
+
{ printWidth: 80 },
|
|
32
|
+
);
|
|
33
|
+
return code;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Whether the content is what pob writes for one of the other configs, so it
|
|
38
|
+
* can be updated without losing changes made by hand.
|
|
39
|
+
*
|
|
40
|
+
* @param {string} eslintConfigPath
|
|
41
|
+
* @param {string} content
|
|
42
|
+
* @param {{ imports: string[], flatCascade: string[] }[]} previousEslintConfigs
|
|
43
|
+
*/
|
|
44
|
+
const isPreviousEslintConfigOutput = async (
|
|
45
|
+
eslintConfigPath,
|
|
46
|
+
content,
|
|
47
|
+
previousEslintConfigs,
|
|
48
|
+
) => {
|
|
49
|
+
for (const eslintConfig of previousEslintConfigs) {
|
|
50
|
+
if (
|
|
51
|
+
(await renderEslintConfig(eslintConfigPath, eslintConfig)) === content
|
|
52
|
+
) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
};
|
|
58
|
+
|
|
16
59
|
// same as the base ignores of @pob/eslint-config: ignorePatterns are not
|
|
17
60
|
// inherited through "extends"
|
|
18
61
|
const oxlintBaseIgnorePatterns = [
|
|
@@ -103,6 +146,13 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
103
146
|
description: "src directory is root",
|
|
104
147
|
});
|
|
105
148
|
|
|
149
|
+
this.option("workspacesHaveReact", {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
required: false,
|
|
152
|
+
default: false,
|
|
153
|
+
description: "Monorepo root: a workspace package uses react",
|
|
154
|
+
});
|
|
155
|
+
|
|
106
156
|
this.option("appTypes", {
|
|
107
157
|
type: String,
|
|
108
158
|
required: false,
|
|
@@ -163,21 +213,16 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
163
213
|
? this.options.babel === "true"
|
|
164
214
|
: babelEnvs.length > 0;
|
|
165
215
|
const useTypescript = this.options.typescript;
|
|
166
|
-
const
|
|
216
|
+
const isMonorepoRoot =
|
|
217
|
+
this.options.monorepo || Boolean(inMonorepo && inMonorepo.root);
|
|
218
|
+
// a monorepo root lints its packages: it needs the react configs when one
|
|
219
|
+
// of them uses react
|
|
220
|
+
const hasReact =
|
|
221
|
+
useTypescript &&
|
|
222
|
+
(packageUtils.hasReact(pkg) ||
|
|
223
|
+
(isMonorepoRoot && this.options.workspacesHaveReact));
|
|
167
224
|
const useAppConfig = hasReact && this.options.isApp;
|
|
168
225
|
const useNode = !useBabel || babelEnvs.some((env) => env.target === "node");
|
|
169
|
-
const useNodeOnly =
|
|
170
|
-
(!useBabel && !useTypescript) ||
|
|
171
|
-
(useTypescript &&
|
|
172
|
-
(!pkg.pob?.envs ||
|
|
173
|
-
pkg.pob?.envs?.every((env) => env.target === "node")) &&
|
|
174
|
-
(!pkg.pob?.entries ||
|
|
175
|
-
pkg.pob?.entries.every(
|
|
176
|
-
(entry) =>
|
|
177
|
-
typeof entry === "string" ||
|
|
178
|
-
(entry.target && entry.target !== "node"),
|
|
179
|
-
))) ||
|
|
180
|
-
(babelEnvs.length > 0 && babelEnvs.every((env) => env.target === "node"));
|
|
181
226
|
|
|
182
227
|
if (this.fs.exists(this.destinationPath(".eslintignore"))) {
|
|
183
228
|
this.fs.delete(this.destinationPath(".eslintignore"));
|
|
@@ -347,7 +392,11 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
347
392
|
);
|
|
348
393
|
|
|
349
394
|
if ((inMonorepo && inMonorepo.root) || this.options.monorepo) {
|
|
350
|
-
if (
|
|
395
|
+
if (hasReact) {
|
|
396
|
+
packageUtils.addDevDependencies(pkg, [
|
|
397
|
+
"@pob/eslint-config-typescript-react",
|
|
398
|
+
]);
|
|
399
|
+
} else if (this.options.typescript) {
|
|
351
400
|
packageUtils.updateDevDependenciesIfPresent(pkg, [
|
|
352
401
|
"@pob/eslint-config-typescript-react",
|
|
353
402
|
]);
|
|
@@ -375,7 +424,10 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
375
424
|
}
|
|
376
425
|
}
|
|
377
426
|
|
|
378
|
-
|
|
427
|
+
/**
|
|
428
|
+
* @param {boolean} withReact
|
|
429
|
+
*/
|
|
430
|
+
const getEslintConfig = (withReact) => {
|
|
379
431
|
if (pkg.name === "@pob/eslint-config-monorepo") {
|
|
380
432
|
return {
|
|
381
433
|
imports: [
|
|
@@ -388,53 +440,50 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
388
440
|
};
|
|
389
441
|
}
|
|
390
442
|
|
|
443
|
+
const flatCascade = (() => {
|
|
444
|
+
if (!useTypescript) {
|
|
445
|
+
return [
|
|
446
|
+
useNode
|
|
447
|
+
? `...pobConfig.configs.node${pkg.type === "commonjs" ? "Commonjs" : "Module"}`
|
|
448
|
+
: `...pobConfig.configs.base${pkg.type === "commonjs" ? "Commonjs" : "Module"}`,
|
|
449
|
+
];
|
|
450
|
+
}
|
|
451
|
+
if (!withReact) {
|
|
452
|
+
return [
|
|
453
|
+
useNode ? "...pobConfig.configs.node" : "...pobConfig.configs.base",
|
|
454
|
+
];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
return [
|
|
458
|
+
useNode
|
|
459
|
+
? "...pobTypescriptConfigReact.configs.node"
|
|
460
|
+
: "...pobTypescriptConfigReact.configs.base",
|
|
461
|
+
withReact && this.options.isApp && "...pobConfig.configs.app",
|
|
462
|
+
pkg.dependencies?.["react-native-web"] &&
|
|
463
|
+
'...pobTypescriptConfigReact.configs["react-native-web"]',
|
|
464
|
+
];
|
|
465
|
+
})().filter(Boolean);
|
|
466
|
+
|
|
467
|
+
// non-published typescript (scripts/**/*.ts, root *.config.ts) is
|
|
468
|
+
// type-checked against tsconfig.tools.json rather than any emitting
|
|
469
|
+
// tsconfig.json; point typed lint at that project. The monorepo root
|
|
470
|
+
// owns the shared tsconfig.tools.json (its **/scripts/** glob covers
|
|
471
|
+
// package scripts too), and single repos own their own; in-monorepo
|
|
472
|
+
// packages inherit the root config.
|
|
473
|
+
if ((isMonorepoRoot || !inMonorepo) && useTypescript) {
|
|
474
|
+
flatCascade.push("...pobConfig.configs.toolsProject");
|
|
475
|
+
}
|
|
476
|
+
|
|
391
477
|
return {
|
|
392
478
|
imports: [
|
|
393
479
|
'import pobConfig from "@pob/eslint-config"',
|
|
394
480
|
useTypescript &&
|
|
395
|
-
|
|
481
|
+
withReact &&
|
|
396
482
|
'import pobTypescriptConfigReact from "@pob/eslint-config-typescript-react"',
|
|
397
483
|
].filter(Boolean),
|
|
398
|
-
flatCascade
|
|
399
|
-
// TODO do something with useNodeOnly ?
|
|
400
|
-
console.log({ useNodeOnly });
|
|
401
|
-
|
|
402
|
-
if (!useTypescript) {
|
|
403
|
-
return [
|
|
404
|
-
useNode
|
|
405
|
-
? `...pobConfig.configs.node${pkg.type === "commonjs" ? "Commonjs" : "Module"}`
|
|
406
|
-
: `...pobConfig.configs.base${pkg.type === "commonjs" ? "Commonjs" : "Module"}`,
|
|
407
|
-
];
|
|
408
|
-
}
|
|
409
|
-
if (!hasReact) {
|
|
410
|
-
return [
|
|
411
|
-
useNode
|
|
412
|
-
? "...pobConfig.configs.node"
|
|
413
|
-
: "...pobConfig.configs.base",
|
|
414
|
-
];
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
return [
|
|
418
|
-
useNode ? "...pobConfig.configs.node" : "...pobConfig.configs.base",
|
|
419
|
-
useAppConfig && "...pobConfig.configs.app",
|
|
420
|
-
pkg.dependencies?.["react-native-web"] &&
|
|
421
|
-
'...pobTypescriptConfigReact.configs["react-native-web"]',
|
|
422
|
-
];
|
|
423
|
-
})().filter(Boolean),
|
|
484
|
+
flatCascade,
|
|
424
485
|
};
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
const isMonorepoRoot =
|
|
428
|
-
this.options.monorepo || Boolean(inMonorepo && inMonorepo.root);
|
|
429
|
-
// non-published typescript (scripts/**/*.ts, root *.config.ts) is
|
|
430
|
-
// type-checked against tsconfig.tools.json rather than any emitting
|
|
431
|
-
// tsconfig.json; point typed lint at that project. The monorepo root owns
|
|
432
|
-
// the shared tsconfig.tools.json (its **/scripts/** glob covers package
|
|
433
|
-
// scripts too), and single repos own their own; in-monorepo packages
|
|
434
|
-
// inherit the root config.
|
|
435
|
-
if ((isMonorepoRoot || !inMonorepo) && useTypescript) {
|
|
436
|
-
flatCascade.push("...pobConfig.configs.toolsProject");
|
|
437
|
-
}
|
|
486
|
+
};
|
|
438
487
|
|
|
439
488
|
const eslintrcBadPath = this.destinationPath(".eslintrc");
|
|
440
489
|
this.fs.delete(eslintrcBadPath);
|
|
@@ -497,37 +546,44 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
497
546
|
};
|
|
498
547
|
|
|
499
548
|
const ignorePatterns = getRootIgnorePatterns();
|
|
500
|
-
const
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
549
|
+
const eslintConfigContent = await renderEslintConfig(
|
|
550
|
+
eslintConfigPath,
|
|
551
|
+
getEslintConfig(hasReact),
|
|
552
|
+
);
|
|
553
|
+
const existingEslintConfig = this.fs.read(eslintConfigPath, {
|
|
554
|
+
defaults: null,
|
|
555
|
+
});
|
|
556
|
+
if (
|
|
557
|
+
existingEslintConfig === null ||
|
|
558
|
+
// still the output of pob for other options: not edited by hand
|
|
559
|
+
(existingEslintConfig !== eslintConfigContent &&
|
|
560
|
+
(await isPreviousEslintConfigOutput(
|
|
561
|
+
eslintConfigPath,
|
|
562
|
+
existingEslintConfig,
|
|
563
|
+
[
|
|
564
|
+
getEslintConfig(!hasReact),
|
|
565
|
+
// before the react configs were used when react is detected
|
|
566
|
+
hasReact && {
|
|
567
|
+
...getEslintConfig(hasReact),
|
|
568
|
+
flatCascade: getEslintConfig(hasReact).flatCascade.map(
|
|
569
|
+
(config) =>
|
|
570
|
+
config.replace(
|
|
571
|
+
/^\.\.\.pobTypescriptConfigReact\.configs\.(node|base)$/,
|
|
572
|
+
"...pobConfig.configs.$1",
|
|
573
|
+
),
|
|
574
|
+
),
|
|
575
|
+
},
|
|
576
|
+
].filter(Boolean),
|
|
577
|
+
)))
|
|
578
|
+
) {
|
|
579
|
+
this.fs.write(eslintConfigPath, eslintConfigContent);
|
|
580
|
+
} else if (
|
|
581
|
+
hasReact &&
|
|
582
|
+
!existingEslintConfig.includes("@pob/eslint-config-typescript-react")
|
|
583
|
+
) {
|
|
584
|
+
console.warn(
|
|
585
|
+
`${path.basename(eslintConfigPath)} was edited by hand and is not updated: use the configs of @pob/eslint-config-typescript-react to lint react`,
|
|
516
586
|
);
|
|
517
|
-
// TODO
|
|
518
|
-
/* settings: {
|
|
519
|
-
"import/resolver": this.options.enableSrcResolver
|
|
520
|
-
? {
|
|
521
|
-
node: {
|
|
522
|
-
moduleDirectory: [
|
|
523
|
-
"node_modules",
|
|
524
|
-
this.options.srcDirectory,
|
|
525
|
-
],
|
|
526
|
-
},
|
|
527
|
-
}
|
|
528
|
-
: false,
|
|
529
|
-
},
|
|
530
|
-
*/
|
|
531
587
|
}
|
|
532
588
|
|
|
533
589
|
// keeps existing options, only enforces the shared config and ignores.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# Generated by pob: do not edit, it is overwritten on each pob run.
|
|
1
2
|
name: Release
|
|
2
3
|
on:
|
|
3
4
|
workflow_dispatch:
|
|
@@ -14,15 +15,25 @@ on:
|
|
|
14
15
|
default: false
|
|
15
16
|
<% if (isMonorepo && isMonorepoIndependent) { -%>
|
|
16
17
|
bump-dependents-highest-as:
|
|
17
|
-
description: "Bump dependents highest as"
|
|
18
|
-
required:
|
|
18
|
+
description: "Bump dependents highest version as"
|
|
19
|
+
required: true
|
|
19
20
|
type: choice
|
|
20
21
|
options:
|
|
21
22
|
- major
|
|
22
23
|
- minor
|
|
23
24
|
- patch
|
|
24
|
-
default:
|
|
25
|
+
default: major
|
|
25
26
|
<% } -%>
|
|
27
|
+
force:
|
|
28
|
+
description: "Force bump all packages, even without changes"
|
|
29
|
+
required: true
|
|
30
|
+
type: choice
|
|
31
|
+
options:
|
|
32
|
+
- none
|
|
33
|
+
- major
|
|
34
|
+
- minor
|
|
35
|
+
- patch
|
|
36
|
+
default: none
|
|
26
37
|
|
|
27
38
|
permissions:
|
|
28
39
|
id-token: write # Required for OIDC
|
|
@@ -52,7 +63,7 @@ jobs:
|
|
|
52
63
|
- name: Install pnpm
|
|
53
64
|
uses: pnpm/action-setup@v6
|
|
54
65
|
with:
|
|
55
|
-
version:
|
|
66
|
+
version: 12
|
|
56
67
|
<% } -%>
|
|
57
68
|
|
|
58
69
|
- uses: actions/setup-node@v7
|
|
@@ -91,7 +102,7 @@ jobs:
|
|
|
91
102
|
|
|
92
103
|
- name: New version (dry run)
|
|
93
104
|
if: github.ref == 'refs/heads/main' && inputs.dry-run
|
|
94
|
-
run: <%= packageManagerExec(packageManager, 'pob-version') %> --dry-run<% if (isMonorepo && isMonorepoIndependent) { %> --bump-dependents-highest-as=${{ inputs.bump-dependents-highest-as }}<% } %>
|
|
105
|
+
run: <%= packageManagerExec(packageManager, 'pob-version') %> --dry-run<% if (isMonorepo && isMonorepoIndependent) { %> --bump-dependents-highest-as=${{ inputs.bump-dependents-highest-as }}<% } %> ${{ inputs.force != 'none' && format('--force={0}', inputs.force) || '' }}
|
|
95
106
|
|
|
96
107
|
- name: Configure Git user
|
|
97
108
|
if: github.ref == 'refs/heads/main' && !inputs.dry-run
|
|
@@ -102,7 +113,7 @@ jobs:
|
|
|
102
113
|
- name: New version
|
|
103
114
|
if: github.ref == 'refs/heads/main' && !inputs.dry-run
|
|
104
115
|
run: |
|
|
105
|
-
<%= packageManagerExec(packageManager, 'pob-version') %> <% if (enablePublish && packageManager === "bun") { %>--publish <% } %>--create-release=github
|
|
116
|
+
<%= packageManagerExec(packageManager, 'pob-version') %> <% if (enablePublish && packageManager === "bun") { %>--publish --publish-provenance <% } %>--create-release=github<% if (isMonorepo && isMonorepoIndependent) { %> --bump-dependents-highest-as=${{ inputs.bump-dependents-highest-as }}<% } %> ${{ inputs.force != 'none' && format('--force={0}', inputs.force) || '' }} -m 'chore: release <%- isMonorepoIndependent ? '' : '%v ' %>[skip ci]<%- isMonorepoIndependent ? '\\n\\n%t' : '' %>'
|
|
106
117
|
env:
|
|
107
118
|
POB_GIT_HOOKS: 0
|
|
108
119
|
YARN_ENABLE_IMMUTABLE_INSTALLS: false
|
|
@@ -114,15 +125,15 @@ jobs:
|
|
|
114
125
|
run: |
|
|
115
126
|
<% if (packageManager === 'yarn') { -%>
|
|
116
127
|
<% if (isMonorepo) { -%>
|
|
117
|
-
yarn workspaces foreach --all --parallel --no-private npm publish --tolerate-republish
|
|
128
|
+
yarn workspaces foreach --all --parallel --no-private npm publish --tolerate-republish --provenance
|
|
118
129
|
<% } else { -%>
|
|
119
|
-
yarn npm publish
|
|
130
|
+
yarn npm publish --provenance
|
|
120
131
|
<% } -%>
|
|
121
132
|
<% } else if (packageManager === 'pnpm') { -%>
|
|
122
133
|
<% if (isMonorepo) { -%>
|
|
123
|
-
pnpm -r publish --no-git-checks
|
|
134
|
+
pnpm -r publish --no-git-checks --provenance
|
|
124
135
|
<% } else { -%>
|
|
125
|
-
pnpm publish --no-git-checks
|
|
136
|
+
pnpm publish --no-git-checks --provenance
|
|
126
137
|
<% } -%>
|
|
127
138
|
<% } -%>
|
|
128
139
|
<% } -%>
|
|
@@ -102,6 +102,12 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
102
102
|
description: "typescript additional includes",
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
+
this.option("packageManager", {
|
|
106
|
+
type: String,
|
|
107
|
+
default: "yarn",
|
|
108
|
+
description: "yarn, npm, bun, or pnpm",
|
|
109
|
+
});
|
|
110
|
+
|
|
105
111
|
this.option("onlyLatestLTS", {
|
|
106
112
|
type: Boolean,
|
|
107
113
|
required: false,
|
|
@@ -146,6 +152,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
146
152
|
},
|
|
147
153
|
];
|
|
148
154
|
const withNode = envs.some((env) => env.target === "node");
|
|
155
|
+
const withBun = this.options.packageManager === "bun";
|
|
149
156
|
|
|
150
157
|
const presets = (() => {
|
|
151
158
|
const babelEnvs =
|
|
@@ -172,7 +179,9 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
172
179
|
pkg.pob.bundler === false ||
|
|
173
180
|
pkg.pob.bundler === "tsc"
|
|
174
181
|
) {
|
|
175
|
-
return
|
|
182
|
+
return withBun
|
|
183
|
+
? ["@pob/root/tsconfigs/targets/bun.json"]
|
|
184
|
+
: [`@pob/root/tsconfigs/targets/node-${nodeVersion}.json`];
|
|
176
185
|
}
|
|
177
186
|
if (envs && envs.every((env) => env.target === "node")) {
|
|
178
187
|
return [
|
|
@@ -199,6 +208,9 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
199
208
|
}
|
|
200
209
|
return ["@pob/root/tsconfigs/targets/webpack.json"];
|
|
201
210
|
}
|
|
211
|
+
if (withBun) {
|
|
212
|
+
return ["@pob/root/tsconfigs/targets/bun.json"];
|
|
213
|
+
}
|
|
202
214
|
return [];
|
|
203
215
|
})();
|
|
204
216
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# Generated by pob: do not edit, it is overwritten on each pob run.
|
|
1
2
|
name: 'Create documentation and deploy to Github pages'
|
|
2
3
|
on:
|
|
3
4
|
push:
|
|
@@ -24,7 +25,7 @@ jobs:
|
|
|
24
25
|
- name: Install pnpm
|
|
25
26
|
uses: pnpm/action-setup@v6
|
|
26
27
|
with:
|
|
27
|
-
version:
|
|
28
|
+
version: 12
|
|
28
29
|
|
|
29
30
|
<% } -%>
|
|
30
31
|
- uses: actions/setup-node@v7
|