@ykdz/template 0.0.7 → 0.0.9
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/dist/{src/cli.js → cli.js} +33 -21
- package/node_modules/@ykdz/template-builtin-source/dist/src/index.d.ts +22 -0
- package/node_modules/@ykdz/template-builtin-source/dist/src/index.js +96 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.d.ts +6 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +240 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.d.ts +7 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.js +94 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.d.ts +2 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +15 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.d.ts +9 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.js +103 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.d.ts +6 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +224 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.d.ts +6 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +372 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.d.ts +8 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +203 -0
- package/node_modules/@ykdz/template-builtin-source/package.json +59 -0
- package/{templates → node_modules/@ykdz/template-builtin-source/templates}/preset-source.json +14 -2
- package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/node/oxlint.config.ts +34 -0
- package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/tsconfig.config.json +20 -0
- package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/vue/oxlint.config.ts +36 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/env.d.ts +8 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/env.d.ts +16 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/declarations.d.ts +7 -4
- package/{dist/src → node_modules/@ykdz/template-core/dist}/declarations.js +45 -14
- package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.js +13 -6
- package/{dist/src → node_modules/@ykdz/template-core/dist}/devcontainer.d.ts +5 -5
- package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.js +23 -30
- package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.d.ts +6 -4
- package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.js +45 -14
- package/{dist/src → node_modules/@ykdz/template-core/dist}/generation-context.js +8 -3
- package/{dist/src → node_modules/@ykdz/template-core/dist}/next-step-instructions.js +3 -0
- package/node_modules/@ykdz/template-core/dist/package-addition.d.ts +12 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition.js +33 -18
- package/{pnpm-workspace.yaml → node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml} +4 -1
- package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.d.ts +3 -3
- package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.js +1 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-source.d.ts +1 -3
- package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-source.js +73 -74
- package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.d.ts +3 -3
- package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.js +1 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.d.ts +17 -5
- package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.js +209 -169
- package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.d.ts +2 -2
- package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.js +14 -6
- package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.js +2 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.d.ts +1 -1
- package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.js +8 -10
- package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.d.ts +5 -5
- package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.js +10 -11
- package/node_modules/@ykdz/template-core/package.json +34 -0
- package/package.json +18 -31
- package/README.md +0 -35
- package/dist/src/package-addition.d.ts +0 -8
- package/templates/shared/oxc/node/oxlint.config.ts +0 -9
- package/templates/shared/oxc/vue/oxlint.config.ts +0 -9
- package/templates/vue-app/env.d.ts +0 -1
- package/templates/vue-hono-app/web/env.d.ts +0 -9
- /package/dist/{src/cli.d.ts → cli.d.ts} +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/.github/dependabot.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/.github/workflows/check.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/src/app.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/src/server.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/test/app.test.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/vitest.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/.github/dependabot.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/.github/workflows/check.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/rust-toolchain.toml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/rustfmt.toml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/src/main.rs +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/browser-test.Dockerfile +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/node-pnpm.Dockerfile +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/rust.Dockerfile +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/editor-customization/capabilities.json +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/oxfmt.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/.github/dependabot.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/.github/workflows/check.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/src/index.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/src/name-schema.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/.github/dependabot.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/.github/workflows/check.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/index.html +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/playwright.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/playwright.package-addition.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/App.vue +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/main.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/stores/counter.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/style.css +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/test/app.test.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/test/e2e/app.spec.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/vite.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/vitest.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/.github/dependabot.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/.github/workflows/check.yml +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/index.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/runtime.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/server.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/test/app.test.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/vitest.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/index.html +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/playwright.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/App.vue +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/api.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/main.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/stores/counter.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/style.css +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/test/app.test.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/test/e2e/app.spec.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/vite.config.ts +0 -0
- /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/vitest.config.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/devcontainer.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/generation-context.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/module-graph.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/module-graph.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/next-step-instructions.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition-support.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition-support.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-linking.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-linking.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.d.ts +0 -0
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
1
|
import { readFile } from "node:fs/promises";
|
|
3
2
|
import path from "node:path";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
3
|
import { collectGeneratedManifestCatalogDependencies, collectGeneratedManifestCatalogReferences, renderGeneratedPnpmWorkspaceYaml, } from "./dependency-catalog.js";
|
|
6
4
|
import { browserTestToolLayer, checkedDockerfileFirstNodePnpmDevcontainer, dockerfileFirstRustPnpmDevcontainer, nodePnpmToolLayer, rustToolLayer, } from "./devcontainer.js";
|
|
7
5
|
import { editorCustomizationForCapabilities, } from "./editor-customization.js";
|
|
8
6
|
import { renderFixCommand, renderRootCheckCommand, } from "./module-graph.js";
|
|
9
7
|
import { packageManifestExposureFields, planPackageLinks, } from "./package-linking.js";
|
|
10
|
-
import { packageTemplateRoot } from "./runtime-paths.js";
|
|
11
8
|
const projectionCapabilityKinds = [
|
|
12
9
|
"workspace-library-package",
|
|
13
10
|
"workspace-node-packages",
|
|
@@ -18,6 +15,8 @@ const projectionCapabilityKinds = [
|
|
|
18
15
|
"github-maintenance",
|
|
19
16
|
];
|
|
20
17
|
const projectionCapabilityKindSet = new Set(projectionCapabilityKinds);
|
|
18
|
+
const workspaceNodePackageKindSet = new Set(["hono-api", "vue-app"]);
|
|
19
|
+
const workspaceNodePackagePathSet = new Set(["apps/api", "apps/web"]);
|
|
21
20
|
const strictTypescriptRootBoundary = {
|
|
22
21
|
kind: "workspace-orchestration",
|
|
23
22
|
path: ".",
|
|
@@ -26,10 +25,6 @@ const workspacePackageBoundary = {
|
|
|
26
25
|
kind: "package-boundary",
|
|
27
26
|
path: ".",
|
|
28
27
|
};
|
|
29
|
-
const workspacePackageCollectionBoundary = {
|
|
30
|
-
kind: "package-boundary",
|
|
31
|
-
path: "packages/*",
|
|
32
|
-
};
|
|
33
28
|
const requiredPlanCapabilityProviders = [
|
|
34
29
|
{
|
|
35
30
|
flag: "rootCheck",
|
|
@@ -78,12 +73,30 @@ const exactCapabilityKeys = {
|
|
|
78
73
|
"github-maintenance": ["kind"],
|
|
79
74
|
};
|
|
80
75
|
const dependencyMaintenanceEcosystems = ["npm", "github-actions", "docker"];
|
|
76
|
+
function strictTypeScriptCompilerOptions(options) {
|
|
77
|
+
return {
|
|
78
|
+
...options,
|
|
79
|
+
erasableSyntaxOnly: true,
|
|
80
|
+
exactOptionalPropertyTypes: true,
|
|
81
|
+
forceConsistentCasingInFileNames: true,
|
|
82
|
+
isolatedModules: true,
|
|
83
|
+
noEmitOnError: true,
|
|
84
|
+
noFallthroughCasesInSwitch: true,
|
|
85
|
+
noImplicitOverride: true,
|
|
86
|
+
noImplicitReturns: true,
|
|
87
|
+
noUncheckedIndexedAccess: true,
|
|
88
|
+
skipLibCheck: false,
|
|
89
|
+
strict: true,
|
|
90
|
+
target: "es2023",
|
|
91
|
+
verbatimModuleSyntax: true,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
81
94
|
const capabilityInterpreters = {
|
|
82
95
|
"workspace-library-package": {
|
|
83
96
|
kind: "workspace-library-package",
|
|
84
97
|
contribute({ capability, state }) {
|
|
85
98
|
state.package = capability;
|
|
86
|
-
state.sourceRoot = templateSourceRoot(capability.packageSourcePreset);
|
|
99
|
+
state.sourceRoot = templateSourceRoot(state, capability.packageSourcePreset);
|
|
87
100
|
state.packageDependencies.add("valibot");
|
|
88
101
|
state.operationFactories.push(workspaceLibraryPackageOperations);
|
|
89
102
|
},
|
|
@@ -92,7 +105,7 @@ const capabilityInterpreters = {
|
|
|
92
105
|
kind: "workspace-node-packages",
|
|
93
106
|
contribute({ capability, state }) {
|
|
94
107
|
state.nodeWorkspace = capability;
|
|
95
|
-
state.sourceRoot = templateSourceRootForPreset(sourceRootPreset(capability));
|
|
108
|
+
state.sourceRoot = templateSourceRootForPreset(state, sourceRootPreset(capability));
|
|
96
109
|
state.operationFactories.push(workspaceNodePackagesOperations);
|
|
97
110
|
if (capability.packages.length > 1) {
|
|
98
111
|
state.rootScriptFragments.dev = "turbo run dev --parallel";
|
|
@@ -112,8 +125,9 @@ const capabilityInterpreters = {
|
|
|
112
125
|
kind: "rust-binary-workspace",
|
|
113
126
|
contribute({ capability, state }) {
|
|
114
127
|
state.rustWorkspace = capability;
|
|
115
|
-
state.sourceRoot = templateSourceRootForPreset("rust-bin");
|
|
116
|
-
state.sourceRoots.sharedDevcontainer =
|
|
128
|
+
state.sourceRoot = templateSourceRootForPreset(state, "rust-bin");
|
|
129
|
+
state.sourceRoots.sharedDevcontainer =
|
|
130
|
+
state.projectionSourceRoots.sharedDevcontainer();
|
|
117
131
|
state.rootCheckComponents.push({
|
|
118
132
|
kind: "turbo-package-check",
|
|
119
133
|
owner: workspaceGlobBoundary(capability.workspacePackageGlob),
|
|
@@ -186,7 +200,7 @@ const capabilityInterpreters = {
|
|
|
186
200
|
"oxc-format-lint": {
|
|
187
201
|
kind: "oxc-format-lint",
|
|
188
202
|
contribute({ state }) {
|
|
189
|
-
state.sourceRoots.sharedOxc =
|
|
203
|
+
state.sourceRoots.sharedOxc = state.projectionSourceRoots.sharedOxc();
|
|
190
204
|
state.rootCheckComponents.unshift({
|
|
191
205
|
kind: "oxc-format-check",
|
|
192
206
|
owner: strictTypescriptRootBoundary,
|
|
@@ -211,21 +225,23 @@ const capabilityInterpreters = {
|
|
|
211
225
|
state.rootScriptFragments["format:write"] =
|
|
212
226
|
"oxfmt --write --config oxfmt.config.ts oxlint.config.ts oxfmt.config.ts";
|
|
213
227
|
state.rootScriptFragments.lint =
|
|
214
|
-
"oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts
|
|
228
|
+
"oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts";
|
|
215
229
|
state.rootScriptFragments["lint:fix"] =
|
|
216
|
-
"oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts --fix
|
|
230
|
+
"oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts --fix";
|
|
217
231
|
state.packageScriptFragments["format:check"] =
|
|
218
232
|
"oxfmt --check --config ../../oxfmt.config.ts .";
|
|
219
233
|
state.packageScriptFragments["format:write"] =
|
|
220
234
|
"oxfmt --write --config ../../oxfmt.config.ts .";
|
|
221
235
|
state.packageScriptFragments.lint =
|
|
222
|
-
"oxlint --config ../../oxlint.config.ts .
|
|
236
|
+
"oxlint --config ../../oxlint.config.ts .";
|
|
223
237
|
state.packageScriptFragments["lint:fix"] =
|
|
224
|
-
"oxlint --config ../../oxlint.config.ts . --fix
|
|
238
|
+
"oxlint --config ../../oxlint.config.ts . --fix";
|
|
225
239
|
state.rootDevDependencies.add("oxfmt");
|
|
226
240
|
state.rootDevDependencies.add("oxlint");
|
|
241
|
+
state.rootDevDependencies.add("oxlint-tsgolint");
|
|
227
242
|
state.packageDevDependencies.add("oxfmt");
|
|
228
243
|
state.packageDevDependencies.add("oxlint");
|
|
244
|
+
state.packageDevDependencies.add("oxlint-tsgolint");
|
|
229
245
|
state.editorCustomizationCapabilities.push("oxc-format-lint");
|
|
230
246
|
state.flags.fixCommand = true;
|
|
231
247
|
state.operationFactories.push(oxcFormatLintOperations);
|
|
@@ -234,7 +250,8 @@ const capabilityInterpreters = {
|
|
|
234
250
|
"node-pnpm-devcontainer": {
|
|
235
251
|
kind: "node-pnpm-devcontainer",
|
|
236
252
|
contribute({ state }) {
|
|
237
|
-
state.sourceRoots.sharedDevcontainer =
|
|
253
|
+
state.sourceRoots.sharedDevcontainer =
|
|
254
|
+
state.projectionSourceRoots.sharedDevcontainer();
|
|
238
255
|
state.flags.devcontainer = true;
|
|
239
256
|
state.operationFactories.push(nodePnpmDevcontainerOperations);
|
|
240
257
|
},
|
|
@@ -249,6 +266,52 @@ const capabilityInterpreters = {
|
|
|
249
266
|
},
|
|
250
267
|
},
|
|
251
268
|
};
|
|
269
|
+
function contributeProjectionCapability(capability, state) {
|
|
270
|
+
switch (capability.kind) {
|
|
271
|
+
case "workspace-library-package":
|
|
272
|
+
capabilityInterpreters["workspace-library-package"].contribute({
|
|
273
|
+
capability,
|
|
274
|
+
state,
|
|
275
|
+
});
|
|
276
|
+
return;
|
|
277
|
+
case "workspace-node-packages":
|
|
278
|
+
capabilityInterpreters["workspace-node-packages"].contribute({
|
|
279
|
+
capability,
|
|
280
|
+
state,
|
|
281
|
+
});
|
|
282
|
+
return;
|
|
283
|
+
case "rust-binary-workspace":
|
|
284
|
+
capabilityInterpreters["rust-binary-workspace"].contribute({
|
|
285
|
+
capability,
|
|
286
|
+
state,
|
|
287
|
+
});
|
|
288
|
+
return;
|
|
289
|
+
case "strict-typescript-root":
|
|
290
|
+
capabilityInterpreters["strict-typescript-root"].contribute({
|
|
291
|
+
capability,
|
|
292
|
+
state,
|
|
293
|
+
});
|
|
294
|
+
return;
|
|
295
|
+
case "oxc-format-lint":
|
|
296
|
+
capabilityInterpreters["oxc-format-lint"].contribute({
|
|
297
|
+
capability,
|
|
298
|
+
state,
|
|
299
|
+
});
|
|
300
|
+
return;
|
|
301
|
+
case "node-pnpm-devcontainer":
|
|
302
|
+
capabilityInterpreters["node-pnpm-devcontainer"].contribute({
|
|
303
|
+
capability,
|
|
304
|
+
state,
|
|
305
|
+
});
|
|
306
|
+
return;
|
|
307
|
+
case "github-maintenance":
|
|
308
|
+
capabilityInterpreters["github-maintenance"].contribute({
|
|
309
|
+
capability,
|
|
310
|
+
state,
|
|
311
|
+
});
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
252
315
|
export function validateProjectionCapabilities(input) {
|
|
253
316
|
if (!isRecord(input) || !Array.isArray(input.capabilities)) {
|
|
254
317
|
return {
|
|
@@ -279,7 +342,7 @@ export function validateProjectionCapabilities(input) {
|
|
|
279
342
|
});
|
|
280
343
|
return;
|
|
281
344
|
}
|
|
282
|
-
if (!
|
|
345
|
+
if (!isProjectionCapabilityKind(capability.kind)) {
|
|
283
346
|
issues.push({
|
|
284
347
|
path: `${pathPrefix}.kind`,
|
|
285
348
|
message: `Unknown Projection Capability kind: ${capability.kind}`,
|
|
@@ -287,7 +350,7 @@ export function validateProjectionCapabilities(input) {
|
|
|
287
350
|
return;
|
|
288
351
|
}
|
|
289
352
|
const kind = capability.kind;
|
|
290
|
-
issues.push(...unknownCapabilityPropertyIssues(capability, pathPrefix));
|
|
353
|
+
issues.push(...unknownCapabilityPropertyIssues(kind, capability, pathPrefix));
|
|
291
354
|
if (kind === "workspace-library-package") {
|
|
292
355
|
const workspaceCapability = parseWorkspaceLibraryPackageCapability(capability, pathPrefix);
|
|
293
356
|
if (Array.isArray(workspaceCapability)) {
|
|
@@ -361,12 +424,9 @@ export function interpretPresetProjectionDeclaration(options) {
|
|
|
361
424
|
.map((issue) => ` - ${issue.path}: ${issue.message}`)
|
|
362
425
|
.join("\n")}`);
|
|
363
426
|
}
|
|
364
|
-
const state = createProjectionCompositionState();
|
|
427
|
+
const state = createProjectionCompositionState(options.sourceRoots);
|
|
365
428
|
for (const capability of validation.value.capabilities) {
|
|
366
|
-
|
|
367
|
-
capability: capability,
|
|
368
|
-
state,
|
|
369
|
-
});
|
|
429
|
+
contributeProjectionCapability(capability, state);
|
|
370
430
|
}
|
|
371
431
|
const checkPlan = {
|
|
372
432
|
components: state.rootCheckComponents,
|
|
@@ -410,10 +470,11 @@ export function interpretPresetProjectionDeclaration(options) {
|
|
|
410
470
|
export function blueprintForPresetSourcePreset(preset, options = { targetDir: process.cwd() }) {
|
|
411
471
|
const packageScope = options.scope ?? projectNameFromDir(options.targetDir);
|
|
412
472
|
const projectName = projectNameFromDir(options.targetDir);
|
|
473
|
+
const packageManager = preset.supportedPackageManagers[0];
|
|
413
474
|
const blueprint = {
|
|
414
475
|
schemaVersion: 1,
|
|
415
476
|
preset: preset.name,
|
|
416
|
-
packageManager:
|
|
477
|
+
...(packageManager === undefined ? {} : { packageManager }),
|
|
417
478
|
projectKind: preset.supportedProjectKinds[0] ?? "multi-package",
|
|
418
479
|
features: [...preset.features],
|
|
419
480
|
};
|
|
@@ -437,13 +498,14 @@ export function projectPresetSourcePreset(options) {
|
|
|
437
498
|
preset: options.preset,
|
|
438
499
|
declaration: options.preset.projection,
|
|
439
500
|
context: options.context,
|
|
501
|
+
sourceRoots: options.sourceRoots,
|
|
440
502
|
});
|
|
441
503
|
}
|
|
442
504
|
export async function planPresetSourcePackageAddition(options) {
|
|
443
505
|
if (options.preset.projection === undefined) {
|
|
444
506
|
throw new Error(`Preset ${options.preset.name} declares Package Addition support but has no Projection Declaration`);
|
|
445
507
|
}
|
|
446
|
-
const state = stateForProjectionDeclaration(options.preset.projection);
|
|
508
|
+
const state = stateForProjectionDeclaration(options.preset.projection, options.sourceRoots);
|
|
447
509
|
const additionCapability = packageAdditionCapabilityForState(options.preset.name, state);
|
|
448
510
|
return {
|
|
449
511
|
packagePath: options.addition.packagePath,
|
|
@@ -451,7 +513,7 @@ export async function planPresetSourcePackageAddition(options) {
|
|
|
451
513
|
workspaceMembershipGlob: `${packageCollectionFromPackagePath(options.addition.packagePath)}/*`,
|
|
452
514
|
packageRole: additionCapability.packageRole,
|
|
453
515
|
packageSourcePreset: additionCapability.packageSourcePreset,
|
|
454
|
-
sourceRoot: templateSourceRootForPreset(additionCapability.sourcePreset),
|
|
516
|
+
sourceRoot: templateSourceRootForPreset(state, additionCapability.sourcePreset),
|
|
455
517
|
sourceRoots: state.sourceRoots,
|
|
456
518
|
operations: [
|
|
457
519
|
...packageAdditionOperationsForCapability({
|
|
@@ -475,34 +537,17 @@ export async function planPresetSourcePackageAddition(options) {
|
|
|
475
537
|
],
|
|
476
538
|
};
|
|
477
539
|
}
|
|
478
|
-
export function defaultPackagePathForPresetSourcePackageAddition(preset, packageLeafName) {
|
|
540
|
+
export function defaultPackagePathForPresetSourcePackageAddition(preset, packageLeafName, sourceRoots) {
|
|
479
541
|
if (preset.projection === undefined) {
|
|
480
542
|
throw new Error(`Preset ${preset.name} declares Package Addition support but has no Projection Declaration`);
|
|
481
543
|
}
|
|
482
|
-
const state = stateForProjectionDeclaration(preset.projection);
|
|
544
|
+
const state = stateForProjectionDeclaration(preset.projection, sourceRoots);
|
|
483
545
|
const additionCapability = packageAdditionCapabilityForState(preset.name, state);
|
|
484
546
|
return `${packageCollection(additionCapability.workspacePackageGlob)}/${packageLeafName}`;
|
|
485
547
|
}
|
|
486
|
-
|
|
487
|
-
const manifestPath = path.join(packageTemplateRoot(path.dirname(fileURLToPath(import.meta.url))), "preset-source.json");
|
|
488
|
-
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
489
|
-
if (!isRecord(manifest) || !Array.isArray(manifest.presets)) {
|
|
490
|
-
throw new Error("Built-in Preset Source Manifest must declare presets");
|
|
491
|
-
}
|
|
492
|
-
const preset = manifest.presets.find((candidate) => isRecord(candidate) && candidate.name === presetName);
|
|
493
|
-
if (!isRecord(preset) || preset.projection === undefined) {
|
|
494
|
-
throw new Error(`Built-in Preset ${presetName} must declare a Projection Declaration`);
|
|
495
|
-
}
|
|
496
|
-
const result = validateProjectionCapabilities(preset.projection);
|
|
497
|
-
if (!result.ok) {
|
|
498
|
-
throw new Error(`Built-in Preset ${presetName} Projection Declaration is invalid:\n${result.issues
|
|
499
|
-
.map((issue) => ` - ${issue.path}: ${issue.message}`)
|
|
500
|
-
.join("\n")}`);
|
|
501
|
-
}
|
|
502
|
-
return result.value;
|
|
503
|
-
}
|
|
504
|
-
function createProjectionCompositionState() {
|
|
548
|
+
function createProjectionCompositionState(sourceRoots) {
|
|
505
549
|
return {
|
|
550
|
+
projectionSourceRoots: sourceRoots,
|
|
506
551
|
sourceRoots: {},
|
|
507
552
|
rootCheckComponents: [],
|
|
508
553
|
rootCheckEnvironmentNeeds: [],
|
|
@@ -523,11 +568,29 @@ function createProjectionCompositionState() {
|
|
|
523
568
|
function isRecord(value) {
|
|
524
569
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
525
570
|
}
|
|
571
|
+
function isProjectionCapabilityKind(value) {
|
|
572
|
+
return projectionCapabilityKindSet.has(value);
|
|
573
|
+
}
|
|
574
|
+
function isWorkspaceNodePackageKind(value) {
|
|
575
|
+
return typeof value === "string" && workspaceNodePackageKindSet.has(value);
|
|
576
|
+
}
|
|
577
|
+
function isWorkspaceNodePackagePath(value) {
|
|
578
|
+
return typeof value === "string" && workspaceNodePackagePathSet.has(value);
|
|
579
|
+
}
|
|
526
580
|
function isNonEmptyString(value) {
|
|
527
581
|
return typeof value === "string" && value.length > 0;
|
|
528
582
|
}
|
|
529
|
-
function
|
|
530
|
-
const
|
|
583
|
+
function nonEmptyStringArray(value) {
|
|
584
|
+
const strings = [];
|
|
585
|
+
for (const entry of value) {
|
|
586
|
+
if (!isNonEmptyString(entry)) {
|
|
587
|
+
return undefined;
|
|
588
|
+
}
|
|
589
|
+
strings.push(entry);
|
|
590
|
+
}
|
|
591
|
+
return strings.length === 0 ? undefined : strings;
|
|
592
|
+
}
|
|
593
|
+
function unknownCapabilityPropertyIssues(kind, capability, pathPrefix) {
|
|
531
594
|
const allowedKeys = new Set(exactCapabilityKeys[kind]);
|
|
532
595
|
return Object.keys(capability)
|
|
533
596
|
.filter((key) => !allowedKeys.has(key))
|
|
@@ -538,6 +601,7 @@ function unknownCapabilityPropertyIssues(capability, pathPrefix) {
|
|
|
538
601
|
}
|
|
539
602
|
function parseWorkspaceLibraryPackageCapability(capability, pathPrefix) {
|
|
540
603
|
const issues = [];
|
|
604
|
+
let sourceFiles = [];
|
|
541
605
|
if (capability.workspacePackageGlob !== "packages/*") {
|
|
542
606
|
issues.push({
|
|
543
607
|
path: `${pathPrefix}.workspacePackageGlob`,
|
|
@@ -562,12 +626,17 @@ function parseWorkspaceLibraryPackageCapability(capability, pathPrefix) {
|
|
|
562
626
|
message: "workspace-library-package sourceFiles must be a non-empty array",
|
|
563
627
|
});
|
|
564
628
|
}
|
|
565
|
-
else
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
629
|
+
else {
|
|
630
|
+
const parsedSourceFiles = nonEmptyStringArray(capability.sourceFiles);
|
|
631
|
+
if (parsedSourceFiles === undefined) {
|
|
632
|
+
issues.push({
|
|
633
|
+
path: `${pathPrefix}.sourceFiles`,
|
|
634
|
+
message: "workspace-library-package sourceFiles must be a non-empty array of paths",
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
sourceFiles = parsedSourceFiles;
|
|
639
|
+
}
|
|
571
640
|
}
|
|
572
641
|
if (issues.length > 0) {
|
|
573
642
|
return issues;
|
|
@@ -577,7 +646,7 @@ function parseWorkspaceLibraryPackageCapability(capability, pathPrefix) {
|
|
|
577
646
|
workspacePackageGlob: "packages/*",
|
|
578
647
|
packageRole: "shared-library",
|
|
579
648
|
packageSourcePreset: "ts-lib",
|
|
580
|
-
sourceFiles
|
|
649
|
+
sourceFiles,
|
|
581
650
|
};
|
|
582
651
|
}
|
|
583
652
|
function parseWorkspaceNodePackagesCapability(capability, pathPrefix) {
|
|
@@ -628,13 +697,18 @@ function parseWorkspaceNodePackage(value, pathPrefix) {
|
|
|
628
697
|
},
|
|
629
698
|
];
|
|
630
699
|
}
|
|
631
|
-
|
|
700
|
+
const kind = isWorkspaceNodePackageKind(value.kind) ? value.kind : undefined;
|
|
701
|
+
const packagePath = isWorkspaceNodePackagePath(value.path)
|
|
702
|
+
? value.path
|
|
703
|
+
: undefined;
|
|
704
|
+
let sourceFiles = [];
|
|
705
|
+
if (kind === undefined) {
|
|
632
706
|
issues.push({
|
|
633
707
|
path: `${pathPrefix}.kind`,
|
|
634
708
|
message: "workspace-node-packages package kind must be hono-api or vue-app",
|
|
635
709
|
});
|
|
636
710
|
}
|
|
637
|
-
if (
|
|
711
|
+
if (packagePath === undefined) {
|
|
638
712
|
issues.push({
|
|
639
713
|
path: `${pathPrefix}.path`,
|
|
640
714
|
message: "workspace-node-packages package path must be apps/api or apps/web",
|
|
@@ -646,12 +720,17 @@ function parseWorkspaceNodePackage(value, pathPrefix) {
|
|
|
646
720
|
message: "workspace-node-packages package sourceFiles must be a non-empty array",
|
|
647
721
|
});
|
|
648
722
|
}
|
|
649
|
-
else
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
723
|
+
else {
|
|
724
|
+
const parsedSourceFiles = nonEmptyStringArray(value.sourceFiles);
|
|
725
|
+
if (parsedSourceFiles === undefined) {
|
|
726
|
+
issues.push({
|
|
727
|
+
path: `${pathPrefix}.sourceFiles`,
|
|
728
|
+
message: "workspace-node-packages package sourceFiles must be a non-empty array of paths",
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
else {
|
|
732
|
+
sourceFiles = parsedSourceFiles;
|
|
733
|
+
}
|
|
655
734
|
}
|
|
656
735
|
const allowedKeys = new Set(["kind", "path", "sourceFiles"]);
|
|
657
736
|
for (const key of Object.keys(value)) {
|
|
@@ -665,10 +744,13 @@ function parseWorkspaceNodePackage(value, pathPrefix) {
|
|
|
665
744
|
if (issues.length > 0) {
|
|
666
745
|
return issues;
|
|
667
746
|
}
|
|
747
|
+
if (kind === undefined || packagePath === undefined) {
|
|
748
|
+
throw new Error(`workspace-node-packages package validation failed without diagnostics at ${pathPrefix}`);
|
|
749
|
+
}
|
|
668
750
|
return {
|
|
669
|
-
kind
|
|
670
|
-
path:
|
|
671
|
-
sourceFiles
|
|
751
|
+
kind,
|
|
752
|
+
path: packagePath,
|
|
753
|
+
sourceFiles,
|
|
672
754
|
};
|
|
673
755
|
}
|
|
674
756
|
function parseWorkspaceNodePackageLinks(value, pathPrefix, declaredPackagePaths, issues) {
|
|
@@ -733,6 +815,7 @@ function parseWorkspaceNodePackageLinks(value, pathPrefix, declaredPackagePaths,
|
|
|
733
815
|
}
|
|
734
816
|
function parseRustBinaryWorkspaceCapability(capability, pathPrefix) {
|
|
735
817
|
const issues = [];
|
|
818
|
+
let sourceFiles = [];
|
|
736
819
|
if (capability.workspacePackageGlob !== "packages/*") {
|
|
737
820
|
issues.push({
|
|
738
821
|
path: `${pathPrefix}.workspacePackageGlob`,
|
|
@@ -745,12 +828,17 @@ function parseRustBinaryWorkspaceCapability(capability, pathPrefix) {
|
|
|
745
828
|
message: "rust-binary-workspace sourceFiles must be a non-empty array",
|
|
746
829
|
});
|
|
747
830
|
}
|
|
748
|
-
else
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
831
|
+
else {
|
|
832
|
+
const parsedSourceFiles = nonEmptyStringArray(capability.sourceFiles);
|
|
833
|
+
if (parsedSourceFiles === undefined) {
|
|
834
|
+
issues.push({
|
|
835
|
+
path: `${pathPrefix}.sourceFiles`,
|
|
836
|
+
message: "rust-binary-workspace sourceFiles must be a non-empty array of paths",
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
else {
|
|
840
|
+
sourceFiles = parsedSourceFiles;
|
|
841
|
+
}
|
|
754
842
|
}
|
|
755
843
|
if (issues.length > 0) {
|
|
756
844
|
return issues;
|
|
@@ -758,7 +846,7 @@ function parseRustBinaryWorkspaceCapability(capability, pathPrefix) {
|
|
|
758
846
|
return {
|
|
759
847
|
kind: "rust-binary-workspace",
|
|
760
848
|
workspacePackageGlob: "packages/*",
|
|
761
|
-
sourceFiles
|
|
849
|
+
sourceFiles,
|
|
762
850
|
};
|
|
763
851
|
}
|
|
764
852
|
function duplicateCapabilityIssues(capabilities) {
|
|
@@ -860,19 +948,16 @@ function blueprintPackagesForCapabilities(capabilities, packageScope, projectNam
|
|
|
860
948
|
return [];
|
|
861
949
|
});
|
|
862
950
|
}
|
|
863
|
-
function stateForProjectionDeclaration(declaration) {
|
|
951
|
+
function stateForProjectionDeclaration(declaration, sourceRoots) {
|
|
864
952
|
const validation = validateProjectionCapabilities(declaration);
|
|
865
953
|
if (!validation.ok) {
|
|
866
954
|
throw new Error(`Projection Declaration is invalid:\n${validation.issues
|
|
867
955
|
.map((issue) => ` - ${issue.path}: ${issue.message}`)
|
|
868
956
|
.join("\n")}`);
|
|
869
957
|
}
|
|
870
|
-
const state = createProjectionCompositionState();
|
|
958
|
+
const state = createProjectionCompositionState(sourceRoots);
|
|
871
959
|
for (const capability of validation.value.capabilities) {
|
|
872
|
-
|
|
873
|
-
capability: capability,
|
|
874
|
-
state,
|
|
875
|
-
});
|
|
960
|
+
contributeProjectionCapability(capability, state);
|
|
876
961
|
}
|
|
877
962
|
return state;
|
|
878
963
|
}
|
|
@@ -896,6 +981,9 @@ function packageAdditionCapabilityForState(presetName, state) {
|
|
|
896
981
|
throw new Error(`Preset ${presetName} is an initialization-only workspace and cannot be used for Package Addition`);
|
|
897
982
|
}
|
|
898
983
|
const nodePackage = state.nodeWorkspace.packages[0];
|
|
984
|
+
if (nodePackage === undefined) {
|
|
985
|
+
throw new Error(`Preset ${presetName} must declare one package for Package Addition`);
|
|
986
|
+
}
|
|
899
987
|
return {
|
|
900
988
|
sourcePreset: nodePackage.kind,
|
|
901
989
|
workspacePackageGlob: state.nodeWorkspace.workspacePackageGlob,
|
|
@@ -1004,19 +1092,15 @@ function libraryPackageAdditionOperations(options) {
|
|
|
1004
1092
|
}
|
|
1005
1093
|
function libraryTsconfigJson() {
|
|
1006
1094
|
return {
|
|
1007
|
-
compilerOptions: {
|
|
1095
|
+
compilerOptions: strictTypeScriptCompilerOptions({
|
|
1008
1096
|
composite: true,
|
|
1009
1097
|
declaration: true,
|
|
1010
1098
|
declarationMap: true,
|
|
1011
|
-
module: "
|
|
1012
|
-
moduleResolution: "
|
|
1013
|
-
noEmitOnError: true,
|
|
1099
|
+
module: "nodenext",
|
|
1100
|
+
moduleResolution: "nodenext",
|
|
1014
1101
|
rootDir: "src",
|
|
1015
|
-
skipLibCheck: false,
|
|
1016
|
-
strict: true,
|
|
1017
|
-
target: "ES2022",
|
|
1018
1102
|
types: ["node"],
|
|
1019
|
-
},
|
|
1103
|
+
}),
|
|
1020
1104
|
include: ["src/**/*.ts"],
|
|
1021
1105
|
};
|
|
1022
1106
|
}
|
|
@@ -1168,7 +1252,11 @@ function hasVuePackage(capability) {
|
|
|
1168
1252
|
}
|
|
1169
1253
|
function sourceRootPreset(capability) {
|
|
1170
1254
|
if (capability.packages.length === 1) {
|
|
1171
|
-
|
|
1255
|
+
const nodePackage = capability.packages[0];
|
|
1256
|
+
if (nodePackage === undefined) {
|
|
1257
|
+
throw new Error("Node package workspace must contain one package");
|
|
1258
|
+
}
|
|
1259
|
+
return nodePackage.kind;
|
|
1172
1260
|
}
|
|
1173
1261
|
return "vue-hono-app";
|
|
1174
1262
|
}
|
|
@@ -1318,6 +1406,7 @@ function honoApiPackageJson(context, packageName, scripts, exposureFields) {
|
|
|
1318
1406
|
"@types/node": "catalog:",
|
|
1319
1407
|
oxfmt: "catalog:",
|
|
1320
1408
|
oxlint: "catalog:",
|
|
1409
|
+
"oxlint-tsgolint": "catalog:",
|
|
1321
1410
|
"tsc-alias": "catalog:",
|
|
1322
1411
|
...(scripts.dev === undefined ? {} : { tsx: "catalog:" }),
|
|
1323
1412
|
typescript: "catalog:",
|
|
@@ -1359,6 +1448,7 @@ function vuePackageJson(context, packageName, scripts, packageLinkDependencies =
|
|
|
1359
1448
|
"@vue/tsconfig": "catalog:",
|
|
1360
1449
|
oxfmt: "catalog:",
|
|
1361
1450
|
oxlint: "catalog:",
|
|
1451
|
+
"oxlint-tsgolint": "catalog:",
|
|
1362
1452
|
tailwindcss: "catalog:",
|
|
1363
1453
|
typescript: "catalog:",
|
|
1364
1454
|
vite: "catalog:",
|
|
@@ -1371,7 +1461,7 @@ function vuePackageJson(context, packageName, scripts, packageLinkDependencies =
|
|
|
1371
1461
|
};
|
|
1372
1462
|
}
|
|
1373
1463
|
function catalogDependencies(dependencies) {
|
|
1374
|
-
return Object.fromEntries([...dependencies].
|
|
1464
|
+
return Object.fromEntries([...dependencies].toSorted().map((dependency) => [dependency, "catalog:"]));
|
|
1375
1465
|
}
|
|
1376
1466
|
function generationRecord(context) {
|
|
1377
1467
|
return {
|
|
@@ -1783,8 +1873,8 @@ function nodePackageScripts(nodePackage, workspace) {
|
|
|
1783
1873
|
const oxcScripts = {
|
|
1784
1874
|
"format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
|
|
1785
1875
|
"format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
1786
|
-
lint: "oxlint --config ../../oxlint.config.ts .
|
|
1787
|
-
"lint:fix": "oxlint --config ../../oxlint.config.ts . --fix
|
|
1876
|
+
lint: "oxlint --config ../../oxlint.config.ts .",
|
|
1877
|
+
"lint:fix": "oxlint --config ../../oxlint.config.ts . --fix",
|
|
1788
1878
|
};
|
|
1789
1879
|
if (nodePackage.kind === "hono-api") {
|
|
1790
1880
|
const checks = {
|
|
@@ -1854,19 +1944,15 @@ function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
|
1854
1944
|
kind: "writeJson",
|
|
1855
1945
|
to: `${nodePackage.path}/tsconfig.json`,
|
|
1856
1946
|
value: {
|
|
1857
|
-
compilerOptions: {
|
|
1947
|
+
compilerOptions: strictTypeScriptCompilerOptions({
|
|
1858
1948
|
composite: true,
|
|
1859
1949
|
...(workspace.packages.length > 1
|
|
1860
1950
|
? { declaration: true, declarationMap: true }
|
|
1861
1951
|
: {}),
|
|
1862
|
-
module: "
|
|
1863
|
-
moduleResolution: "
|
|
1864
|
-
noEmitOnError: true,
|
|
1865
|
-
skipLibCheck: false,
|
|
1866
|
-
strict: true,
|
|
1867
|
-
target: "ES2022",
|
|
1952
|
+
module: "nodenext",
|
|
1953
|
+
moduleResolution: "nodenext",
|
|
1868
1954
|
types: ["node", "vitest/globals"],
|
|
1869
|
-
},
|
|
1955
|
+
}),
|
|
1870
1956
|
include: ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
|
|
1871
1957
|
},
|
|
1872
1958
|
},
|
|
@@ -1903,17 +1989,13 @@ function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
|
1903
1989
|
to: `${nodePackage.path}/tsconfig.app.json`,
|
|
1904
1990
|
value: {
|
|
1905
1991
|
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
1906
|
-
compilerOptions: {
|
|
1992
|
+
compilerOptions: strictTypeScriptCompilerOptions({
|
|
1907
1993
|
composite: true,
|
|
1908
1994
|
module: "ESNext",
|
|
1909
1995
|
moduleResolution: "Bundler",
|
|
1910
|
-
noEmitOnError: true,
|
|
1911
|
-
skipLibCheck: false,
|
|
1912
|
-
strict: true,
|
|
1913
|
-
target: "ES2022",
|
|
1914
1996
|
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
1915
1997
|
types: ["web-bluetooth"],
|
|
1916
|
-
},
|
|
1998
|
+
}),
|
|
1917
1999
|
include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue"],
|
|
1918
2000
|
},
|
|
1919
2001
|
},
|
|
@@ -1934,21 +2016,17 @@ function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
|
1934
2016
|
kind: "writeJson",
|
|
1935
2017
|
to: `${nodePackage.path}/tsconfig.node.json`,
|
|
1936
2018
|
value: {
|
|
1937
|
-
compilerOptions: {
|
|
2019
|
+
compilerOptions: strictTypeScriptCompilerOptions({
|
|
1938
2020
|
composite: true,
|
|
1939
2021
|
module: "ESNext",
|
|
1940
2022
|
moduleResolution: "Bundler",
|
|
1941
|
-
noEmitOnError: true,
|
|
1942
2023
|
lib: ["ESNext", "DOM", "DOM.Iterable"],
|
|
1943
2024
|
...(workspace.packages.length > 1
|
|
1944
2025
|
? { outDir: "./node_modules/.tmp/tsconfig.node" }
|
|
1945
2026
|
: {}),
|
|
1946
|
-
skipLibCheck: false,
|
|
1947
|
-
strict: true,
|
|
1948
|
-
target: "ES2022",
|
|
1949
2027
|
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
1950
2028
|
types: ["node"],
|
|
1951
|
-
},
|
|
2029
|
+
}),
|
|
1952
2030
|
include: ["playwright.config.ts", "vite.config.ts", "vitest.config.ts"],
|
|
1953
2031
|
},
|
|
1954
2032
|
},
|
|
@@ -2035,6 +2113,17 @@ function strictTypescriptOperations({ context, state, }) {
|
|
|
2035
2113
|
if (state.package === undefined && state.nodeWorkspace === undefined) {
|
|
2036
2114
|
throw new Error("strict-typescript-root requires a workspace package layout");
|
|
2037
2115
|
}
|
|
2116
|
+
const rootConfigTsconfigOperation = () => {
|
|
2117
|
+
if (state.sourceRoots.sharedOxc === undefined) {
|
|
2118
|
+
throw new Error("strict-typescript-root requires shared OXC source when rendering tsconfig.config.json");
|
|
2119
|
+
}
|
|
2120
|
+
return {
|
|
2121
|
+
kind: "copyFile",
|
|
2122
|
+
from: "tsconfig.config.json",
|
|
2123
|
+
to: "tsconfig.config.json",
|
|
2124
|
+
sourceRoot: "sharedOxc",
|
|
2125
|
+
};
|
|
2126
|
+
};
|
|
2038
2127
|
if (state.nodeWorkspace !== undefined) {
|
|
2039
2128
|
return [
|
|
2040
2129
|
{
|
|
@@ -2045,21 +2134,7 @@ function strictTypescriptOperations({ context, state, }) {
|
|
|
2045
2134
|
references: rootTsconfigReferences(state.nodeWorkspace),
|
|
2046
2135
|
},
|
|
2047
2136
|
},
|
|
2048
|
-
|
|
2049
|
-
kind: "writeJson",
|
|
2050
|
-
to: "tsconfig.config.json",
|
|
2051
|
-
value: {
|
|
2052
|
-
compilerOptions: {
|
|
2053
|
-
module: "NodeNext",
|
|
2054
|
-
moduleResolution: "NodeNext",
|
|
2055
|
-
noEmitOnError: true,
|
|
2056
|
-
skipLibCheck: false,
|
|
2057
|
-
strict: true,
|
|
2058
|
-
target: "ES2022",
|
|
2059
|
-
},
|
|
2060
|
-
include: ["oxlint.config.ts", "oxfmt.config.ts"],
|
|
2061
|
-
},
|
|
2062
|
-
},
|
|
2137
|
+
rootConfigTsconfigOperation(),
|
|
2063
2138
|
];
|
|
2064
2139
|
}
|
|
2065
2140
|
const libraryPackage = state.package;
|
|
@@ -2071,40 +2146,11 @@ function strictTypescriptOperations({ context, state, }) {
|
|
|
2071
2146
|
files: [],
|
|
2072
2147
|
},
|
|
2073
2148
|
},
|
|
2074
|
-
|
|
2075
|
-
kind: "writeJson",
|
|
2076
|
-
to: "tsconfig.config.json",
|
|
2077
|
-
value: {
|
|
2078
|
-
compilerOptions: {
|
|
2079
|
-
module: "NodeNext",
|
|
2080
|
-
moduleResolution: "NodeNext",
|
|
2081
|
-
noEmitOnError: true,
|
|
2082
|
-
skipLibCheck: false,
|
|
2083
|
-
strict: true,
|
|
2084
|
-
target: "ES2022",
|
|
2085
|
-
},
|
|
2086
|
-
include: ["oxlint.config.ts", "oxfmt.config.ts"],
|
|
2087
|
-
},
|
|
2088
|
-
},
|
|
2149
|
+
rootConfigTsconfigOperation(),
|
|
2089
2150
|
{
|
|
2090
2151
|
kind: "writeJson",
|
|
2091
2152
|
to: `${workspacePackagePath(context, libraryPackage)}/tsconfig.json`,
|
|
2092
|
-
value:
|
|
2093
|
-
compilerOptions: {
|
|
2094
|
-
composite: true,
|
|
2095
|
-
declaration: true,
|
|
2096
|
-
declarationMap: true,
|
|
2097
|
-
module: "NodeNext",
|
|
2098
|
-
moduleResolution: "NodeNext",
|
|
2099
|
-
noEmitOnError: true,
|
|
2100
|
-
rootDir: "src",
|
|
2101
|
-
skipLibCheck: false,
|
|
2102
|
-
strict: true,
|
|
2103
|
-
target: "ES2022",
|
|
2104
|
-
types: ["node"],
|
|
2105
|
-
},
|
|
2106
|
-
include: ["src/**/*.ts"],
|
|
2107
|
-
},
|
|
2153
|
+
value: libraryTsconfigJson(),
|
|
2108
2154
|
},
|
|
2109
2155
|
];
|
|
2110
2156
|
}
|
|
@@ -2193,15 +2239,9 @@ function githubMaintenanceOperations() {
|
|
|
2193
2239
|
},
|
|
2194
2240
|
];
|
|
2195
2241
|
}
|
|
2196
|
-
function templateSourceRoot(sourcePreset) {
|
|
2197
|
-
return templateSourceRootForPreset(sourcePreset);
|
|
2198
|
-
}
|
|
2199
|
-
function templateSourceRootForPreset(sourcePreset) {
|
|
2200
|
-
return packageTemplateRoot(path.dirname(fileURLToPath(import.meta.url)), sourcePreset);
|
|
2201
|
-
}
|
|
2202
|
-
function sharedOxcSourceRoot() {
|
|
2203
|
-
return packageTemplateRoot(path.dirname(fileURLToPath(import.meta.url)), "shared", "oxc");
|
|
2242
|
+
function templateSourceRoot(state, sourcePreset) {
|
|
2243
|
+
return templateSourceRootForPreset(state, sourcePreset);
|
|
2204
2244
|
}
|
|
2205
|
-
function
|
|
2206
|
-
return
|
|
2245
|
+
function templateSourceRootForPreset(state, sourcePreset) {
|
|
2246
|
+
return state.projectionSourceRoots.preset(sourcePreset);
|
|
2207
2247
|
}
|