pob 38.2.1 → 38.4.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 +11 -1
- package/lib/generators/app/expo/AppExpoGenerator.js +11 -0
- package/lib/generators/{app/e2e-testing/AppE2ETestingGenerator.js → common/e2e/CommonE2eGenerator.js} +5 -17
- package/lib/generators/common/format-lint/CommonLintGenerator.js +13 -13
- package/lib/generators/common/transpiler/CommonTranspilerGenerator.js +14 -2
- package/lib/generators/common/typescript/CommonTypescriptGenerator.js +26 -4
- package/lib/generators/common/typescript/templates/tsconfig.json.ejs +1 -2
- package/lib/generators/common/typescript/templates/tsconfig.tools.json.ejs +21 -0
- package/lib/generators/core/ci/templates/github-action-push-workflow.yml.ejs +5 -0
- package/lib/generators/core/gitignore/CoreGitignoreGenerator.js +8 -0
- package/lib/generators/core/gitignore/templates/gitignore.ejs +6 -0
- package/lib/generators/core/npm/CoreNpmGenerator.js +2 -1
- package/lib/generators/lib/PobLibGenerator.js +18 -1
- package/lib/generators/monorepo/typescript/MonorepoTypescriptGenerator.js +20 -13
- package/lib/generators/monorepo/typescript/templates/tsconfig.json.ejs +2 -2
- package/lib/generators/monorepo/typescript/templates/tsconfig.tools.json.ejs +25 -0
- package/lib/generators/monorepo/workspaces/MonorepoWorkspacesGenerator.js +2 -0
- package/lib/pob.js +12 -6
- package/package.json +6 -6
- package/lib/generators/monorepo/typescript/templates/tsconfig.root-configs.json.ejs +0 -13
|
@@ -139,6 +139,12 @@ export default class PobAppGenerator extends Generator {
|
|
|
139
139
|
default: !config || false,
|
|
140
140
|
when: (values) => values.testing,
|
|
141
141
|
},
|
|
142
|
+
{
|
|
143
|
+
type: "confirm",
|
|
144
|
+
name: "e2e",
|
|
145
|
+
message: "Do you want e2e testing (Playwright) ?",
|
|
146
|
+
default: (config && config.e2e) || false,
|
|
147
|
+
},
|
|
142
148
|
{
|
|
143
149
|
type: "confirm",
|
|
144
150
|
name: "storybook",
|
|
@@ -295,8 +301,9 @@ export default class PobAppGenerator extends Generator {
|
|
|
295
301
|
srcDirectory,
|
|
296
302
|
});
|
|
297
303
|
|
|
298
|
-
this.composeWith("pob:
|
|
304
|
+
this.composeWith("pob:common:e2e", {
|
|
299
305
|
enable: this.appConfig.e2e,
|
|
306
|
+
ci: this.options.ci,
|
|
300
307
|
});
|
|
301
308
|
|
|
302
309
|
this.composeWith("pob:common:format-lint", {
|
|
@@ -380,6 +387,9 @@ export default class PobAppGenerator extends Generator {
|
|
|
380
387
|
enableServer: this.appConfig.type === "vite-with-server",
|
|
381
388
|
});
|
|
382
389
|
break;
|
|
390
|
+
case "expo":
|
|
391
|
+
this.composeWith("pob:app:expo", {});
|
|
392
|
+
break;
|
|
383
393
|
// no default
|
|
384
394
|
}
|
|
385
395
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Generator from "yeoman-generator";
|
|
2
|
+
|
|
3
|
+
export default class AppExpoGenerator extends Generator {
|
|
4
|
+
writing() {
|
|
5
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
6
|
+
|
|
7
|
+
pkg.main = "./src/AppEntry.tsx";
|
|
8
|
+
|
|
9
|
+
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import Generator from "yeoman-generator";
|
|
2
2
|
import * as packageUtils from "../../../utils/package.js";
|
|
3
|
-
// import * as templateUtils from '../../../utils/templateUtils.js';
|
|
4
3
|
import { writeAndFormatJson } from "../../../utils/writeAndFormat.js";
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
// Common e2e (Playwright) generator. The .gitignore entries are emitted by
|
|
6
|
+
// pob:core:gitignore (the sole owner of .gitignore), gated on the same e2e flag.
|
|
7
|
+
export default class CommonE2eGenerator extends Generator {
|
|
7
8
|
constructor(args, opts) {
|
|
8
9
|
super(args, opts);
|
|
9
10
|
|
|
@@ -12,12 +13,6 @@ export default class AppE2ETestingGenerator extends Generator {
|
|
|
12
13
|
default: true,
|
|
13
14
|
description: "enable e2e testing",
|
|
14
15
|
});
|
|
15
|
-
|
|
16
|
-
this.option("ci", {
|
|
17
|
-
type: Boolean,
|
|
18
|
-
required: true,
|
|
19
|
-
description: "ci",
|
|
20
|
-
});
|
|
21
16
|
}
|
|
22
17
|
|
|
23
18
|
writing() {
|
|
@@ -25,21 +20,14 @@ export default class AppE2ETestingGenerator extends Generator {
|
|
|
25
20
|
|
|
26
21
|
packageUtils.addOrRemoveDevDependencies(pkg, this.options.enable, [
|
|
27
22
|
"@playwright/test",
|
|
23
|
+
"playwright",
|
|
28
24
|
]);
|
|
29
25
|
|
|
30
26
|
packageUtils.addOrRemoveScripts(pkg, this.options.enable, {
|
|
27
|
+
"test:e2e:prepare": "playwright install chromium",
|
|
31
28
|
"test:e2e": "playwright test",
|
|
32
29
|
});
|
|
33
30
|
|
|
34
|
-
// templateUtils.addOrRemoveTemplate(
|
|
35
|
-
// this.fs,
|
|
36
|
-
// this.options.enable && this.options.ci,
|
|
37
|
-
// this.destinationPath('playwright.config.js'),
|
|
38
|
-
// );
|
|
39
|
-
|
|
40
|
-
if (this.options.enable) {
|
|
41
|
-
}
|
|
42
|
-
|
|
43
31
|
return writeAndFormatJson(
|
|
44
32
|
this.fs,
|
|
45
33
|
this.destinationPath("package.json"),
|
|
@@ -316,12 +316,7 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
316
316
|
!pkg.name.startsWith("@pob/eslint-config") &&
|
|
317
317
|
pkg.name !== "@pob/use-eslint-plugin"
|
|
318
318
|
) {
|
|
319
|
-
|
|
320
|
-
// via "@pob/root/eslint-config"), so projects only need @pob/root.
|
|
321
|
-
if (pkg.name !== "@pob/root") {
|
|
322
|
-
packageUtils.addDevDependencies(pkg, ["@pob/root"]);
|
|
323
|
-
}
|
|
324
|
-
packageUtils.removeDevDependencies(pkg, ["@pob/eslint-config"]);
|
|
319
|
+
packageUtils.addDevDependencies(pkg, ["@pob/eslint-config"]);
|
|
325
320
|
packageUtils.addOrRemoveDevDependencies(
|
|
326
321
|
pkg,
|
|
327
322
|
shouldHavePluginsDependencies,
|
|
@@ -378,7 +373,7 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
378
373
|
|
|
379
374
|
return {
|
|
380
375
|
imports: [
|
|
381
|
-
'import pobConfig from "@pob/
|
|
376
|
+
'import pobConfig from "@pob/eslint-config"',
|
|
382
377
|
useTypescript &&
|
|
383
378
|
hasReact &&
|
|
384
379
|
'import pobTypescriptConfigReact from "@pob/eslint-config-typescript-react"',
|
|
@@ -414,8 +409,14 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
414
409
|
|
|
415
410
|
const isMonorepoRoot =
|
|
416
411
|
this.options.monorepo || Boolean(inMonorepo && inMonorepo.root);
|
|
417
|
-
|
|
418
|
-
|
|
412
|
+
// non-published typescript (scripts/**/*.ts, root *.config.ts) is
|
|
413
|
+
// type-checked against tsconfig.tools.json rather than any emitting
|
|
414
|
+
// tsconfig.json; point typed lint at that project. The monorepo root owns
|
|
415
|
+
// the shared tsconfig.tools.json (its **/scripts/** glob covers package
|
|
416
|
+
// scripts too), and single repos own their own; in-monorepo packages
|
|
417
|
+
// inherit the root config.
|
|
418
|
+
if ((isMonorepoRoot || !inMonorepo) && useTypescript) {
|
|
419
|
+
flatCascade.push("...pobConfig.configs.toolsProject");
|
|
419
420
|
}
|
|
420
421
|
|
|
421
422
|
const eslintrcBadPath = this.destinationPath(".eslintrc");
|
|
@@ -540,11 +541,10 @@ export default class CommonFormatLintGenerator extends Generator {
|
|
|
540
541
|
delete pkg.scripts.format;
|
|
541
542
|
delete pkg.scripts["format:check"];
|
|
542
543
|
}
|
|
543
|
-
|
|
544
|
-
delete pkg.scripts["lint:prettier"];
|
|
545
|
-
delete pkg.scripts["lint:prettier:fix"];
|
|
546
|
-
delete pkg.scripts["typescript-check"];
|
|
547
544
|
}
|
|
545
|
+
delete pkg.scripts["typescript-check"];
|
|
546
|
+
delete pkg.scripts["lint:prettier"];
|
|
547
|
+
delete pkg.scripts["lint:prettier:fix"];
|
|
548
548
|
|
|
549
549
|
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
550
550
|
}
|
|
@@ -385,7 +385,11 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
385
385
|
};
|
|
386
386
|
|
|
387
387
|
this.entries.forEach((entryWithOptionalExt) => {
|
|
388
|
-
const
|
|
388
|
+
const entryName =
|
|
389
|
+
typeof entryWithOptionalExt === "string"
|
|
390
|
+
? entryWithOptionalExt
|
|
391
|
+
: entryWithOptionalExt.name;
|
|
392
|
+
const entry = entryName.replace(/\.[jt]sx?$/, "");
|
|
389
393
|
const isBrowserOnly =
|
|
390
394
|
withBabel &&
|
|
391
395
|
entry === "browser" &&
|
|
@@ -557,7 +561,15 @@ export default class CommonTranspilerGenerator extends Generator {
|
|
|
557
561
|
}
|
|
558
562
|
}
|
|
559
563
|
|
|
560
|
-
|
|
564
|
+
if (
|
|
565
|
+
extraEntryConfig.name.startsWith(`${this.options.srcDirectory}/`)
|
|
566
|
+
) {
|
|
567
|
+
pkg.exports[
|
|
568
|
+
`./${extraEntryConfig.name.slice(this.options.srcDirectory.length + 1)}`
|
|
569
|
+
] = exportValue;
|
|
570
|
+
} else {
|
|
571
|
+
pkg.exports[`./${extraEntryConfig.name}`] = exportValue;
|
|
572
|
+
}
|
|
561
573
|
});
|
|
562
574
|
}
|
|
563
575
|
} else if (!pkg.exports) {
|
|
@@ -222,6 +222,7 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
222
222
|
const tsconfigCheckPath = this.destinationPath("tsconfig.check.json");
|
|
223
223
|
const tsconfigEslintPath = this.destinationPath("tsconfig.eslint.json");
|
|
224
224
|
const tsconfigBuildPath = this.destinationPath("tsconfig.build.json");
|
|
225
|
+
const tsconfigToolsPath = this.destinationPath("tsconfig.tools.json");
|
|
225
226
|
|
|
226
227
|
if (this.options.enable) {
|
|
227
228
|
const { jsx, dom } = this.options;
|
|
@@ -320,9 +321,6 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
320
321
|
rootDir: this.options.rootDir,
|
|
321
322
|
srcDirectory: this.options.srcDirectory || this.options.rootDir,
|
|
322
323
|
enableHashSlash: this.options.enableHashSlash,
|
|
323
|
-
scriptsDirectory: this.fs.exists(this.destinationPath("scripts"))
|
|
324
|
-
? "scripts"
|
|
325
|
-
: undefined,
|
|
326
324
|
jsx,
|
|
327
325
|
jsxPreserve: this.options.jsxPreserve,
|
|
328
326
|
nextConfig: this.options.nextConfig,
|
|
@@ -364,15 +362,39 @@ export default class CommonTypescriptGenerator extends Generator {
|
|
|
364
362
|
// } else {
|
|
365
363
|
this.fs.delete(tsconfigBuildPath);
|
|
366
364
|
// }
|
|
365
|
+
|
|
366
|
+
// non-published typescript run in place (scripts/**/*.ts, root
|
|
367
|
+
// *.config.ts) is not part of the emitting tsconfig.json: give it a
|
|
368
|
+
// dedicated noEmit project so it is type-checked without emitting
|
|
369
|
+
// definitions nor violating rootDir. Monorepos handle this at the root
|
|
370
|
+
// via the shared tsconfig.tools.json, so only single repos get it here.
|
|
371
|
+
if (inMonorepo) {
|
|
372
|
+
this.fs.delete(tsconfigToolsPath);
|
|
373
|
+
} else {
|
|
374
|
+
await copyAndFormatTpl(
|
|
375
|
+
this.fs,
|
|
376
|
+
this.templatePath("tsconfig.tools.json.ejs"),
|
|
377
|
+
tsconfigToolsPath,
|
|
378
|
+
{
|
|
379
|
+
nodeVersion: latestLTS,
|
|
380
|
+
},
|
|
381
|
+
);
|
|
382
|
+
}
|
|
367
383
|
} else {
|
|
368
384
|
this.fs.delete(tsconfigPath);
|
|
369
385
|
this.fs.delete(tsconfigBuildPath);
|
|
370
386
|
this.fs.delete(tsconfigCheckPath);
|
|
371
387
|
this.fs.delete(tsconfigEslintPath);
|
|
388
|
+
this.fs.delete(tsconfigToolsPath);
|
|
372
389
|
}
|
|
373
390
|
|
|
374
391
|
if (!pkg.workspaces || !this.options.enable) {
|
|
375
|
-
packageUtils.addOrRemoveScripts(pkg, this.options.enable, {
|
|
392
|
+
packageUtils.addOrRemoveScripts(pkg, this.options.enable, {
|
|
393
|
+
tsc:
|
|
394
|
+
inMonorepo || !this.options.enable
|
|
395
|
+
? "tsc"
|
|
396
|
+
: "tsc && tsc -p tsconfig.tools.json",
|
|
397
|
+
});
|
|
376
398
|
}
|
|
377
399
|
|
|
378
400
|
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
@@ -4,8 +4,7 @@
|
|
|
4
4
|
<%- presets.map(p => `"${p}"`).join(',\n ') %><% } %>
|
|
5
5
|
],
|
|
6
6
|
"include": [
|
|
7
|
-
"<%= srcDirectory %>/**/*.ts"<% if (
|
|
8
|
-
"<%= scriptsDirectory %>/**/*.ts",<% } %><% if (jsx) { -%>,
|
|
7
|
+
"<%= srcDirectory %>/**/*.ts"<% if (jsx) { -%>,
|
|
9
8
|
"<%= srcDirectory %>/**/*.tsx"<% } %><% if (srcDirectory !== rootDir) { -%>,
|
|
10
9
|
"<%= rootDir %>/*.ts"<% } %><% if (additionalIncludes.length > 0) { -%>,
|
|
11
10
|
<%- additionalIncludes.map(adi => `"${adi}"`).join(',\n ') %><% } %>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": [
|
|
3
|
+
"@pob/root/tsconfigs/strict.json",
|
|
4
|
+
"@pob/root/tsconfigs/targets/node-<%= nodeVersion %>.json"
|
|
5
|
+
],
|
|
6
|
+
"files": [],
|
|
7
|
+
"include": [
|
|
8
|
+
"scripts/**/*.ts",
|
|
9
|
+
"scripts/**/*.mts",
|
|
10
|
+
"scripts/**/*.cts",
|
|
11
|
+
"*.config.ts",
|
|
12
|
+
"*.config.mts",
|
|
13
|
+
"*.config.cts"
|
|
14
|
+
],
|
|
15
|
+
"compilerOptions": {
|
|
16
|
+
"noEmit": true,
|
|
17
|
+
"incremental": true,
|
|
18
|
+
"tsBuildInfoFile": "node_modules/.cache/tsc/tsbuildinfo-tools",
|
|
19
|
+
"resolveJsonModule": true
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -111,8 +111,13 @@ jobs:
|
|
|
111
111
|
<% } -%>
|
|
112
112
|
<% if (e2eTesting) { -%>
|
|
113
113
|
|
|
114
|
+
- name: E2E testing prepare
|
|
115
|
+
run: <%= packageManagerRun("test:e2e:prepare", e2eTesting) %>
|
|
116
|
+
if: startsWith(matrix.node-version, '<%= nodeLatestMajorVersion %>.')
|
|
117
|
+
|
|
114
118
|
- name: E2E testing
|
|
115
119
|
run: <%= packageManagerRun("test:e2e", e2eTesting) %>
|
|
120
|
+
if: startsWith(matrix.node-version, '<%= nodeLatestMajorVersion %>.')
|
|
116
121
|
<% } -%>
|
|
117
122
|
<% if (isReleasePleaseEnabled) { -%>
|
|
118
123
|
|
|
@@ -59,6 +59,13 @@ export default class CoreGitignoreGenerator extends Generator {
|
|
|
59
59
|
default: "",
|
|
60
60
|
description: "Build directory.",
|
|
61
61
|
});
|
|
62
|
+
|
|
63
|
+
this.option("playwright", {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
required: false,
|
|
66
|
+
default: false,
|
|
67
|
+
description: "Playwright e2e testing enabled.",
|
|
68
|
+
});
|
|
62
69
|
}
|
|
63
70
|
|
|
64
71
|
writing() {
|
|
@@ -82,6 +89,7 @@ export default class CoreGitignoreGenerator extends Generator {
|
|
|
82
89
|
typescript: withBabel || this.options.typescript,
|
|
83
90
|
paths: this.options.paths,
|
|
84
91
|
buildInGit: this.options.buildInGit,
|
|
92
|
+
playwright: this.options.playwright,
|
|
85
93
|
});
|
|
86
94
|
}
|
|
87
95
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
1
2
|
import Generator from "yeoman-generator";
|
|
2
3
|
|
|
3
4
|
export default class CoreNpmGenerator extends Generator {
|
|
@@ -51,7 +52,7 @@ export default class CoreNpmGenerator extends Generator {
|
|
|
51
52
|
files.add("bin");
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
if (
|
|
55
|
+
if (fs.existsSync(this.destinationPath("skills"))) {
|
|
55
56
|
files.add("skills");
|
|
56
57
|
}
|
|
57
58
|
|
|
@@ -243,6 +243,17 @@ export default class PobLibGenerator extends Generator {
|
|
|
243
243
|
Object.assign(this.pobjson.testing, testingPrompts);
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
// e2e
|
|
247
|
+
if (!this.updateOnly || this.pobjson.e2e === undefined) {
|
|
248
|
+
const { e2e } = await this.prompt({
|
|
249
|
+
type: "confirm",
|
|
250
|
+
name: "e2e",
|
|
251
|
+
message: "Would you like e2e testing (Playwright) ?",
|
|
252
|
+
default: this.pobjson.e2e || false,
|
|
253
|
+
});
|
|
254
|
+
this.pobjson.e2e = e2e;
|
|
255
|
+
}
|
|
256
|
+
|
|
246
257
|
this.fs.writeJSON(this.destinationPath("package.json"), pkg);
|
|
247
258
|
|
|
248
259
|
this.composeWith("pob:common:babel", {
|
|
@@ -310,7 +321,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
310
321
|
enable: this.pobjson.testing,
|
|
311
322
|
disableYarnGitCache: this.options.disableYarnGitCache,
|
|
312
323
|
testing: this.pobjson.testing,
|
|
313
|
-
e2eTesting: false,
|
|
324
|
+
e2eTesting: this.pobjson.e2e ? "." : false,
|
|
314
325
|
runner: this.pobjson.testing
|
|
315
326
|
? (inMonorepo
|
|
316
327
|
? inMonorepo.pobMonorepoConfig.testRunner
|
|
@@ -328,6 +339,11 @@ export default class PobLibGenerator extends Generator {
|
|
|
328
339
|
onlyLatestLTS: this.onlyLatestLTS,
|
|
329
340
|
});
|
|
330
341
|
|
|
342
|
+
this.composeWith("pob:common:e2e", {
|
|
343
|
+
enable: this.pobjson.e2e,
|
|
344
|
+
ci: this.options.ci,
|
|
345
|
+
});
|
|
346
|
+
|
|
331
347
|
// must be after testing
|
|
332
348
|
this.composeWith("pob:common:format-lint", {
|
|
333
349
|
typescript: withTypescript,
|
|
@@ -390,6 +406,7 @@ export default class PobLibGenerator extends Generator {
|
|
|
390
406
|
documentation: this.pobjson.documentation,
|
|
391
407
|
testing: !!this.pobjson.testing,
|
|
392
408
|
buildDirectory,
|
|
409
|
+
playwright: this.pobjson.e2e,
|
|
393
410
|
});
|
|
394
411
|
|
|
395
412
|
this.composeWith("pob:core:npm", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readdirSync } from "node:fs";
|
|
1
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
2
2
|
import Generator from "yeoman-generator";
|
|
3
3
|
import { latestLTS } from "../../../utils/nodeVersions.js";
|
|
4
4
|
import * as packageUtils from "../../../utils/package.js";
|
|
@@ -138,34 +138,41 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
138
138
|
const tsconfigCheckPath = this.destinationPath("tsconfig.check.json");
|
|
139
139
|
const tsconfigBuildPath = this.destinationPath("tsconfig.build.json");
|
|
140
140
|
const tsconfigTestPath = this.destinationPath("tsconfig.test.json");
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
);
|
|
141
|
+
const tsconfigToolsPath = this.destinationPath("tsconfig.tools.json");
|
|
142
|
+
// previous name, migrate to tsconfig.tools.json
|
|
143
|
+
this.fs.delete(this.destinationPath("tsconfig.root-configs.json"));
|
|
144
144
|
this.fs.delete(tsconfigTestPath);
|
|
145
145
|
|
|
146
146
|
if (!this.options.enable) {
|
|
147
147
|
this.fs.delete(tsconfigPath);
|
|
148
148
|
this.fs.delete(tsconfigCheckPath);
|
|
149
149
|
this.fs.delete(tsconfigBuildPath);
|
|
150
|
-
this.fs.delete(
|
|
150
|
+
this.fs.delete(tsconfigToolsPath);
|
|
151
151
|
} else {
|
|
152
152
|
const packagePaths = JSON.parse(this.options.packagePaths);
|
|
153
|
+
const pkg = this.fs.readJSON(this.destinationPath("package.json"));
|
|
153
154
|
|
|
154
|
-
//
|
|
155
|
-
//
|
|
156
|
-
//
|
|
155
|
+
// non-published typescript run in place is not part of any package's
|
|
156
|
+
// emitting tsconfig, so it needs a dedicated noEmit project for type-aware
|
|
157
|
+
// linting and tsc -b: root config files (e.g. vitest.config.ts), a root
|
|
158
|
+
// scripts/ dir, and each package's scripts/ dir (matched via the
|
|
159
|
+
// workspace globs so all packages are covered)
|
|
157
160
|
const hasRootConfigs = hasRootConfigFiles(this.destinationPath());
|
|
158
|
-
|
|
161
|
+
const hasRootScripts = existsSync(this.destinationPath("scripts"));
|
|
162
|
+
const workspaceGlobs = pkg.workspaces || [];
|
|
163
|
+
const hasTools = hasRootConfigs || hasRootScripts;
|
|
164
|
+
if (hasTools) {
|
|
159
165
|
await copyAndFormatTpl(
|
|
160
166
|
this.fs,
|
|
161
|
-
this.templatePath("tsconfig.
|
|
162
|
-
|
|
167
|
+
this.templatePath("tsconfig.tools.json.ejs"),
|
|
168
|
+
tsconfigToolsPath,
|
|
163
169
|
{
|
|
164
170
|
nodeVersion: latestLTS,
|
|
171
|
+
workspaceGlobs,
|
|
165
172
|
},
|
|
166
173
|
);
|
|
167
174
|
} else {
|
|
168
|
-
this.fs.delete(
|
|
175
|
+
this.fs.delete(tsconfigToolsPath);
|
|
169
176
|
}
|
|
170
177
|
|
|
171
178
|
await copyAndFormatTpl(
|
|
@@ -175,7 +182,7 @@ export default class MonorepoTypescriptGenerator extends Generator {
|
|
|
175
182
|
{
|
|
176
183
|
packagePaths,
|
|
177
184
|
tsConfigSuffix: false,
|
|
178
|
-
|
|
185
|
+
hasTools,
|
|
179
186
|
},
|
|
180
187
|
);
|
|
181
188
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"files": [],
|
|
3
3
|
"references": [
|
|
4
|
-
<% if (
|
|
5
|
-
{ "path": "tsconfig.
|
|
4
|
+
<% if (hasTools) { -%>
|
|
5
|
+
{ "path": "tsconfig.tools.json" }<%= packagePaths.length > 0 ? ',' : '' %>
|
|
6
6
|
<% } -%>
|
|
7
7
|
<% packagePaths.forEach((packagePath, index) => { -%>
|
|
8
8
|
{ "path": "<%= packagePath %>/tsconfig<%= tsConfigSuffix ? `.${tsConfigSuffix}` : '' %>.json" }<%= index === packagePaths.length -1 ? '' : ',' %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": [
|
|
3
|
+
"@pob/root/tsconfigs/strict.json",
|
|
4
|
+
"@pob/root/tsconfigs/targets/node-<%= nodeVersion %>.json"
|
|
5
|
+
],
|
|
6
|
+
"include": [
|
|
7
|
+
"*.config.ts",
|
|
8
|
+
"*.config.mts",
|
|
9
|
+
"*.config.cts",
|
|
10
|
+
"scripts/**/*.ts",
|
|
11
|
+
"scripts/**/*.mts",
|
|
12
|
+
"scripts/**/*.cts",
|
|
13
|
+
<% workspaceGlobs.forEach((workspaceGlob, index) => { -%>
|
|
14
|
+
"<%= workspaceGlob %>/scripts/**/*.ts",
|
|
15
|
+
"<%= workspaceGlob %>/scripts/**/*.mts",
|
|
16
|
+
"<%= workspaceGlob %>/scripts/**/*.cts"<%= index === workspaceGlobs.length - 1 ? '' : ',' %>
|
|
17
|
+
<% }) -%>
|
|
18
|
+
],
|
|
19
|
+
"compilerOptions": {
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"tsBuildInfoFile": "node_modules/.cache/tsc/tsbuildinfo-tools",
|
|
22
|
+
"incremental": true,
|
|
23
|
+
"resolveJsonModule": true
|
|
24
|
+
}
|
|
25
|
+
}
|
package/lib/pob.js
CHANGED
|
@@ -12,9 +12,10 @@ import path from "node:path";
|
|
|
12
12
|
import minimist from "minimist";
|
|
13
13
|
import * as yeoman from "yeoman-environment";
|
|
14
14
|
import PobAppGenerator from "./generators/app/PobAppGenerator.js";
|
|
15
|
-
import
|
|
15
|
+
import AppExpoGenerator from "./generators/app/expo/AppExpoGenerator.js";
|
|
16
16
|
import AppViteGenerator from "./generators/app/vite/AppViteGenerator.js";
|
|
17
17
|
import CommonBabelGenerator from "./generators/common/babel/CommonBabelGenerator.js";
|
|
18
|
+
import CommonE2eGenerator from "./generators/common/e2e/CommonE2eGenerator.js";
|
|
18
19
|
import CommonLintGenerator from "./generators/common/format-lint/CommonLintGenerator.js";
|
|
19
20
|
import CommonHuskyGenerator from "./generators/common/husky/CommonHuskyGenerator.js";
|
|
20
21
|
import CommonRemoveOldDependenciesGenerator from "./generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js";
|
|
@@ -92,16 +93,16 @@ env.registerStub(
|
|
|
92
93
|
"pob:app",
|
|
93
94
|
`${__dirname}/generators/app/PobAppGenerator.js`,
|
|
94
95
|
);
|
|
95
|
-
env.registerStub(
|
|
96
|
-
AppE2ETestingGenerator,
|
|
97
|
-
"pob:app:e2e-testing",
|
|
98
|
-
`${__dirname}/generators/app/e2e-testing/AppE2ETestingGenerator.js`,
|
|
99
|
-
);
|
|
100
96
|
env.registerStub(
|
|
101
97
|
AppViteGenerator,
|
|
102
98
|
"pob:app:vite",
|
|
103
99
|
`${__dirname}/generators/app/vite/AppViteGenerator.js`,
|
|
104
100
|
);
|
|
101
|
+
env.registerStub(
|
|
102
|
+
AppExpoGenerator,
|
|
103
|
+
"pob:app:expo",
|
|
104
|
+
`${__dirname}/generators/app/expo/AppExpoGenerator.js`,
|
|
105
|
+
);
|
|
105
106
|
env.registerStub(
|
|
106
107
|
CommonBabelGenerator,
|
|
107
108
|
"pob:common:babel",
|
|
@@ -127,6 +128,11 @@ env.registerStub(
|
|
|
127
128
|
"pob:common:remove-old-dependencies",
|
|
128
129
|
`${__dirname}/generators/common/old-dependencies/CommonRemoveOldDependenciesGenerator.js`,
|
|
129
130
|
);
|
|
131
|
+
env.registerStub(
|
|
132
|
+
CommonE2eGenerator,
|
|
133
|
+
"pob:common:e2e",
|
|
134
|
+
`${__dirname}/generators/common/e2e/CommonE2eGenerator.js`,
|
|
135
|
+
);
|
|
130
136
|
env.registerStub(
|
|
131
137
|
CommonReleaseGenerator,
|
|
132
138
|
"pob:common:release",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pob",
|
|
3
|
-
"version": "38.
|
|
3
|
+
"version": "38.4.0",
|
|
4
4
|
"description": "Pile of bones, library generator with git/babel/typescript/typedoc/readme/vitest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"skeleton"
|
|
@@ -48,17 +48,17 @@
|
|
|
48
48
|
"validate-npm-package-name": "^8.0.0",
|
|
49
49
|
"yeoman-environment": "6.1.0",
|
|
50
50
|
"yeoman-generator": "8.2.2",
|
|
51
|
-
"@pob/eslint-config": "67.
|
|
52
|
-
"
|
|
51
|
+
"@pob/eslint-config-typescript-react": "67.3.0",
|
|
52
|
+
"pob-dependencies": "27.3.0",
|
|
53
|
+
"@pob/sort-object": "11.1.1",
|
|
53
54
|
"@pob/sort-pkg": "13.1.2",
|
|
54
|
-
"pob-
|
|
55
|
-
"@pob/sort-object": "11.1.1"
|
|
55
|
+
"@pob/eslint-config": "67.3.0"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "24.13.3",
|
|
59
59
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
60
60
|
"@yeoman/types": "1.11.1",
|
|
61
|
-
"@pob/root": "27.
|
|
61
|
+
"@pob/root": "27.4.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
64
|
"node": ">=22.18.0"
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": [
|
|
3
|
-
"@pob/root/tsconfigs/strict.json",
|
|
4
|
-
"@pob/root/tsconfigs/targets/node-<%= nodeVersion %>.json"
|
|
5
|
-
],
|
|
6
|
-
"include": ["*.config.ts", "*.config.mts", "*.config.cts"],
|
|
7
|
-
"compilerOptions": {
|
|
8
|
-
"noEmit": true,
|
|
9
|
-
"tsBuildInfoFile": "node_modules/.cache/tsc/tsbuildinfo-root-configs",
|
|
10
|
-
"incremental": true,
|
|
11
|
-
"resolveJsonModule": true
|
|
12
|
-
}
|
|
13
|
-
}
|