@ykdz/template 0.0.14 → 0.0.15
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/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.js +9 -8
- package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.js +1 -1
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.js +4 -1
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +6 -7
- package/node_modules/@ykdz/template-builtin-source/templates/rust-bin/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/ts-lib/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/workflows/check.yml +2 -2
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-core/dist/project-github.js +1 -1
- package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +41 -94
- package/node_modules/@ykdz/template-shared/dist/index.d.ts +4 -4
- package/node_modules/@ykdz/template-shared/dist/index.js +21 -12
- package/package.json +3 -3
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{env.d.ts → types/env.d.ts} +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{global.d.ts → types/global.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { playwrightBrowserAssetsEnvironmentNeed } from "@ykdz/template-core/module-graph";
|
|
2
|
-
const
|
|
2
|
+
const appsWorkspaceBoundary = {
|
|
3
3
|
kind: "package-boundary",
|
|
4
|
-
path: "
|
|
4
|
+
path: "apps/*",
|
|
5
5
|
};
|
|
6
6
|
const apiPackageBoundary = {
|
|
7
7
|
kind: "package-boundary",
|
|
@@ -39,11 +39,11 @@ function nodeFixComponents(owner) {
|
|
|
39
39
|
export function selectNodeCheckComponents(target) {
|
|
40
40
|
switch (target) {
|
|
41
41
|
case "hono-api":
|
|
42
|
-
return honoApiCheckComponents(
|
|
42
|
+
return honoApiCheckComponents(apiPackageBoundary);
|
|
43
43
|
case "vue-app":
|
|
44
|
-
return vueAppCheckComponents(
|
|
44
|
+
return vueAppCheckComponents(webPackageBoundary);
|
|
45
45
|
case "vue-hono-root":
|
|
46
|
-
return [{ kind: "turbo-check", owner:
|
|
46
|
+
return [{ kind: "turbo-check", owner: appsWorkspaceBoundary }];
|
|
47
47
|
case "vue-hono-api":
|
|
48
48
|
return honoApiCheckComponents(apiPackageBoundary);
|
|
49
49
|
case "vue-hono-web":
|
|
@@ -53,10 +53,11 @@ export function selectNodeCheckComponents(target) {
|
|
|
53
53
|
export function selectNodeFixComponents(target) {
|
|
54
54
|
switch (target) {
|
|
55
55
|
case "hono-api":
|
|
56
|
+
return nodeFixComponents(apiPackageBoundary);
|
|
56
57
|
case "vue-app":
|
|
57
|
-
return nodeFixComponents(
|
|
58
|
+
return nodeFixComponents(webPackageBoundary);
|
|
58
59
|
case "vue-hono-root":
|
|
59
|
-
return [{ kind: "turbo-fix", owner:
|
|
60
|
+
return [{ kind: "turbo-fix", owner: appsWorkspaceBoundary }];
|
|
60
61
|
case "vue-hono-api":
|
|
61
62
|
return nodeFixComponents(apiPackageBoundary);
|
|
62
63
|
case "vue-hono-web":
|
|
@@ -68,7 +69,7 @@ function checkEnvironmentNeeds(target) {
|
|
|
68
69
|
return [
|
|
69
70
|
playwrightBrowserAssetsEnvironmentNeed({
|
|
70
71
|
browser: "chromium",
|
|
71
|
-
owner:
|
|
72
|
+
owner: webPackageBoundary,
|
|
72
73
|
id: "install-playwright-browsers",
|
|
73
74
|
label: "Install Playwright browser assets",
|
|
74
75
|
}),
|
|
@@ -24,6 +24,9 @@ export const vikeAppPresetMetadata = {
|
|
|
24
24
|
function projectNameFromDir(targetDir) {
|
|
25
25
|
return targetDir.split(/[\\/]/).filter(Boolean).at(-1) ?? "vike-app";
|
|
26
26
|
}
|
|
27
|
+
function scopedPackageName(packageScope) {
|
|
28
|
+
return `@${packageScope}/web`;
|
|
29
|
+
}
|
|
27
30
|
export function vikeAppBlueprint(options = { targetDir: process.cwd() }) {
|
|
28
31
|
const projectName = projectNameFromDir(options.targetDir);
|
|
29
32
|
return {
|
|
@@ -32,7 +35,7 @@ export function vikeAppBlueprint(options = { targetDir: process.cwd() }) {
|
|
|
32
35
|
packageManager: "pnpm",
|
|
33
36
|
projectKind: "multi-package",
|
|
34
37
|
features: [...vikeAppPresetMetadata.features],
|
|
35
|
-
packages: [{ name: projectName, path: "
|
|
38
|
+
packages: [{ name: scopedPackageName(projectName), path: "apps/web" }],
|
|
36
39
|
};
|
|
37
40
|
}
|
|
38
41
|
export const vikeAppPresetProjection = {
|
|
@@ -458,11 +458,11 @@
|
|
|
458
458
|
"capabilities": [
|
|
459
459
|
{
|
|
460
460
|
"kind": "workspace-node-packages",
|
|
461
|
-
"workspacePackageGlob": "
|
|
461
|
+
"workspacePackageGlob": "apps/*",
|
|
462
462
|
"packages": [
|
|
463
463
|
{
|
|
464
464
|
"kind": "vike-app",
|
|
465
|
-
"path": "
|
|
465
|
+
"path": "apps/web",
|
|
466
466
|
"sourceFiles": [
|
|
467
467
|
"+server.ts",
|
|
468
468
|
".env.example",
|
|
@@ -473,8 +473,6 @@
|
|
|
473
473
|
"database/queries/todos.ts",
|
|
474
474
|
"database/schema.ts",
|
|
475
475
|
"drizzle.config.ts",
|
|
476
|
-
"env.d.ts",
|
|
477
|
-
"global.d.ts",
|
|
478
476
|
"pages/+Head.vue",
|
|
479
477
|
"pages/+Layout.vue",
|
|
480
478
|
"pages/+config.ts",
|
|
@@ -486,6 +484,8 @@
|
|
|
486
484
|
"server/app.ts",
|
|
487
485
|
"test/e2e/app.spec.ts",
|
|
488
486
|
"test/todos.test.ts",
|
|
487
|
+
"types/env.d.ts",
|
|
488
|
+
"types/global.d.ts",
|
|
489
489
|
"vite.config.ts",
|
|
490
490
|
"vitest.config.ts"
|
|
491
491
|
]
|
|
@@ -512,14 +512,13 @@
|
|
|
512
512
|
"vike-app/database",
|
|
513
513
|
"vike-app/pages",
|
|
514
514
|
"vike-app/server",
|
|
515
|
-
"vike-app/test"
|
|
515
|
+
"vike-app/test",
|
|
516
|
+
"vike-app/types"
|
|
516
517
|
],
|
|
517
518
|
"files": [
|
|
518
519
|
"vike-app/+server.ts",
|
|
519
520
|
"vike-app/.env.example",
|
|
520
521
|
"vike-app/drizzle.config.ts",
|
|
521
|
-
"vike-app/env.d.ts",
|
|
522
|
-
"vike-app/global.d.ts",
|
|
523
522
|
"vike-app/playwright.config.ts",
|
|
524
523
|
"vike-app/vite.config.ts",
|
|
525
524
|
"vike-app/vitest.config.ts"
|
package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/workflows/check.yml
CHANGED
|
@@ -10,11 +10,11 @@ jobs:
|
|
|
10
10
|
check:
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
13
|
+
- uses: actions/checkout@v7
|
|
14
14
|
- uses: actions/setup-node@v6
|
|
15
15
|
with:
|
|
16
16
|
node-version-file: package.json
|
|
17
17
|
- run: corepack enable
|
|
18
18
|
- run: pnpm install
|
|
19
|
-
- run: pnpm exec playwright install --with-deps chromium
|
|
19
|
+
- run: pnpm --filter ./apps/web exec playwright install --with-deps chromium
|
|
20
20
|
- run: pnpm run check
|
|
@@ -29,7 +29,7 @@ export function projectCheckWorkflow(options) {
|
|
|
29
29
|
` ${capability.jobName}:`,
|
|
30
30
|
` runs-on: ${capability.runner}`,
|
|
31
31
|
" steps:",
|
|
32
|
-
" - uses: actions/checkout@
|
|
32
|
+
" - uses: actions/checkout@v7",
|
|
33
33
|
];
|
|
34
34
|
if (environmentPreparation.nodeFromPackageMetadata) {
|
|
35
35
|
lines.push(" - uses: actions/setup-node@v6", " with:", " node-version-file: package.json", " - run: corepack enable");
|
|
@@ -78,11 +78,7 @@ const capabilityInterpreters = {
|
|
|
78
78
|
state.nodeWorkspace = capability;
|
|
79
79
|
state.sourceRoot = templateSourceRootForPreset(state, sourceRootPreset(capability));
|
|
80
80
|
state.operationFactories.push(workspaceNodePackagesOperations);
|
|
81
|
-
if (
|
|
82
|
-
state.rootScriptFragments.dev = "vike dev";
|
|
83
|
-
state.rootCheckComponents.push({ kind: "build", owner: strictTypescriptRootBoundary }, { kind: "unit-test", owner: strictTypescriptRootBoundary }, { kind: "e2e-test", owner: strictTypescriptRootBoundary });
|
|
84
|
-
}
|
|
85
|
-
else if (capability.packages.length > 1) {
|
|
81
|
+
if (capability.packages.length > 1) {
|
|
86
82
|
state.rootScriptFragments.dev = "turbo run dev --parallel";
|
|
87
83
|
}
|
|
88
84
|
const vuePackage = findVuePackage(capability);
|
|
@@ -133,13 +129,11 @@ const capabilityInterpreters = {
|
|
|
133
129
|
kind: "typescript-typecheck",
|
|
134
130
|
owner: strictTypescriptRootBoundary,
|
|
135
131
|
});
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
});
|
|
142
|
-
}
|
|
132
|
+
const workspaceBoundary = workspaceBoundaryForState(state);
|
|
133
|
+
state.rootCheckComponents.push({
|
|
134
|
+
kind: "turbo-package-check",
|
|
135
|
+
owner: workspaceBoundary,
|
|
136
|
+
});
|
|
143
137
|
state.packageCheckComponents.push({
|
|
144
138
|
kind: "typescript-typecheck",
|
|
145
139
|
owner: workspacePackageBoundary,
|
|
@@ -173,14 +167,10 @@ const capabilityInterpreters = {
|
|
|
173
167
|
}, {
|
|
174
168
|
kind: "oxc-lint-fix",
|
|
175
169
|
owner: strictTypescriptRootBoundary,
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
owner: workspaceBoundaryForState(state),
|
|
181
|
-
},
|
|
182
|
-
]
|
|
183
|
-
: []));
|
|
170
|
+
}, {
|
|
171
|
+
kind: "turbo-package-fix",
|
|
172
|
+
owner: workspaceBoundaryForState(state),
|
|
173
|
+
});
|
|
184
174
|
state.packageFixComponents.push({ kind: "oxc-format-write", owner: workspacePackageBoundary }, { kind: "oxc-lint-fix", owner: workspacePackageBoundary });
|
|
185
175
|
state.rootScriptFragments["format:check"] =
|
|
186
176
|
"oxfmt --check oxlint.config.ts oxfmt.config.ts";
|
|
@@ -468,11 +458,9 @@ function blueprintPackagesForCapabilities(capabilities, packageScope, projectNam
|
|
|
468
458
|
}
|
|
469
459
|
if (capability.kind === "workspace-node-packages") {
|
|
470
460
|
return capability.packages.map((nodePackage) => {
|
|
471
|
-
const leaf = nodePackage.path
|
|
472
|
-
? projectName
|
|
473
|
-
: (nodePackage.path.split("/").at(-1) ?? nodePackage.path);
|
|
461
|
+
const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
|
|
474
462
|
return {
|
|
475
|
-
name:
|
|
463
|
+
name: `@${packageScope}/${leaf}`,
|
|
476
464
|
path: nodePackage.path,
|
|
477
465
|
};
|
|
478
466
|
});
|
|
@@ -790,11 +778,6 @@ function workspaceGlobBoundary(workspacePackageGlob) {
|
|
|
790
778
|
path: workspacePackageGlob,
|
|
791
779
|
};
|
|
792
780
|
}
|
|
793
|
-
function isRootNodeWorkspace(workspace) {
|
|
794
|
-
return (workspace?.workspacePackageGlob === "." &&
|
|
795
|
-
workspace.packages.length === 1 &&
|
|
796
|
-
workspace.packages[0]?.path === ".");
|
|
797
|
-
}
|
|
798
781
|
function hasVuePackage(capability) {
|
|
799
782
|
return findVuePackage(capability) !== undefined;
|
|
800
783
|
}
|
|
@@ -853,11 +836,6 @@ function leafScriptFragments(fragments) {
|
|
|
853
836
|
function directScriptFragments(fragments) {
|
|
854
837
|
return Object.fromEntries(Object.entries(fragments).filter(([scriptName]) => !leafEntrypointNames.has(scriptName)));
|
|
855
838
|
}
|
|
856
|
-
function rootEntrypointScriptsFromRootPackageScripts(scripts) {
|
|
857
|
-
return Object.fromEntries(Object.entries(scripts).filter(([scriptName]) => !scriptName.endsWith(":run") ||
|
|
858
|
-
scriptName === "check:run" ||
|
|
859
|
-
scriptName === "fix:run"));
|
|
860
|
-
}
|
|
861
839
|
function rootTaskEntrypoints(checkPlan, fixPlan) {
|
|
862
840
|
const taskNames = new Set([
|
|
863
841
|
...checkPlan.components.map((component) => renderCheckLeafCommand(component).startsWith("turbo run ")
|
|
@@ -913,9 +891,6 @@ function noopTaskCommand() {
|
|
|
913
891
|
return 'node -e ""';
|
|
914
892
|
}
|
|
915
893
|
function packageCollection(workspacePackageGlob) {
|
|
916
|
-
if (workspacePackageGlob === ".") {
|
|
917
|
-
return ".";
|
|
918
|
-
}
|
|
919
894
|
return workspacePackageGlob.slice(0, -"/*".length);
|
|
920
895
|
}
|
|
921
896
|
function workspacePackagePath(context, capability) {
|
|
@@ -969,9 +944,6 @@ function nodePackageName(context, nodePackage) {
|
|
|
969
944
|
if (packageDefinition !== undefined) {
|
|
970
945
|
return packageDefinition.name;
|
|
971
946
|
}
|
|
972
|
-
if (nodePackage.path === ".") {
|
|
973
|
-
return context.projectName.value;
|
|
974
|
-
}
|
|
975
947
|
const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
|
|
976
948
|
return `@${context.projectName.value}/${leaf}`;
|
|
977
949
|
}
|
|
@@ -1470,9 +1442,7 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1470
1442
|
}
|
|
1471
1443
|
return vuePackageJson(context, packageName, scripts, packageLinkPlan.manifestDependenciesByPackagePath.get(nodePackage.path));
|
|
1472
1444
|
});
|
|
1473
|
-
const rootManifest =
|
|
1474
|
-
? rootNodePackageManifest(packageManifests[0], packageScripts)
|
|
1475
|
-
: rootPackageJson(context, packageScripts, state);
|
|
1445
|
+
const rootManifest = rootPackageJson(context, packageScripts, state);
|
|
1476
1446
|
if (rootManifest === undefined) {
|
|
1477
1447
|
throw new Error("workspace-node-packages rendered no package manifests");
|
|
1478
1448
|
}
|
|
@@ -1528,15 +1498,11 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1528
1498
|
text: gitignoreForNodeWorkspace(capability),
|
|
1529
1499
|
},
|
|
1530
1500
|
...capability.packages.flatMap((nodePackage, index) => [
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
:
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
to: `${nodePackage.path}/package.json`,
|
|
1537
|
-
value: packageManifests[index],
|
|
1538
|
-
},
|
|
1539
|
-
]),
|
|
1501
|
+
{
|
|
1502
|
+
kind: "writeJson",
|
|
1503
|
+
to: `${nodePackage.path}/package.json`,
|
|
1504
|
+
value: packageManifests[index],
|
|
1505
|
+
},
|
|
1540
1506
|
...nodePackageTsconfigOperations(nodePackage, capability),
|
|
1541
1507
|
...nodePackage.sourceFiles.map((sourceFile) => ({
|
|
1542
1508
|
kind: "copyFile",
|
|
@@ -1557,33 +1523,6 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1557
1523
|
},
|
|
1558
1524
|
];
|
|
1559
1525
|
}
|
|
1560
|
-
function rootNodePackageManifest(packageManifest, rootPackageScripts) {
|
|
1561
|
-
if (packageManifest === undefined) {
|
|
1562
|
-
return undefined;
|
|
1563
|
-
}
|
|
1564
|
-
const packageScripts = packageManifest.scripts;
|
|
1565
|
-
if (packageScripts === undefined ||
|
|
1566
|
-
typeof packageScripts !== "object" ||
|
|
1567
|
-
packageScripts === null ||
|
|
1568
|
-
Array.isArray(packageScripts)) {
|
|
1569
|
-
throw new Error("Root node package manifest rendered invalid scripts");
|
|
1570
|
-
}
|
|
1571
|
-
const checkedPackageScripts = {};
|
|
1572
|
-
for (const scriptName of Object.keys(packageScripts)) {
|
|
1573
|
-
const command = Reflect.get(packageScripts, scriptName);
|
|
1574
|
-
if (typeof command !== "string") {
|
|
1575
|
-
throw new Error("Root node package manifest rendered non-string scripts");
|
|
1576
|
-
}
|
|
1577
|
-
checkedPackageScripts[scriptName] = command;
|
|
1578
|
-
}
|
|
1579
|
-
return {
|
|
1580
|
-
...packageManifest,
|
|
1581
|
-
scripts: {
|
|
1582
|
-
...rootEntrypointScriptsFromRootPackageScripts(rootPackageScripts),
|
|
1583
|
-
...checkedPackageScripts,
|
|
1584
|
-
},
|
|
1585
|
-
};
|
|
1586
|
-
}
|
|
1587
1526
|
function nodePackageScripts(nodePackage, workspace) {
|
|
1588
1527
|
const oxcScripts = {
|
|
1589
1528
|
"format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
|
|
@@ -1610,10 +1549,10 @@ function nodePackageScripts(nodePackage, workspace) {
|
|
|
1610
1549
|
"drizzle:generate": "drizzle-kit generate",
|
|
1611
1550
|
"drizzle:migrate": "drizzle-kit migrate",
|
|
1612
1551
|
"drizzle:studio": "drizzle-kit studio",
|
|
1613
|
-
"format:check:run": "oxfmt --check --config oxfmt.config.ts .",
|
|
1614
|
-
"format:write:run": "oxfmt --write --config oxfmt.config.ts .",
|
|
1615
|
-
"lint:run": "oxlint --type-aware --config oxlint.config.ts .",
|
|
1616
|
-
"lint:fix:run": "oxlint --type-aware --config oxlint.config.ts . --fix",
|
|
1552
|
+
"format:check:run": "oxfmt --check --config ../../oxfmt.config.ts .",
|
|
1553
|
+
"format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
1554
|
+
"lint:run": "oxlint --type-aware --config ../../oxlint.config.ts .",
|
|
1555
|
+
"lint:fix:run": "oxlint --type-aware --config ../../oxlint.config.ts . --fix",
|
|
1617
1556
|
preview: "vike preview",
|
|
1618
1557
|
start: "node ./dist/server/index.mjs",
|
|
1619
1558
|
"test:run": "vitest run",
|
|
@@ -1638,7 +1577,19 @@ function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
|
1638
1577
|
return [
|
|
1639
1578
|
{
|
|
1640
1579
|
kind: "writeJson",
|
|
1641
|
-
to:
|
|
1580
|
+
to: `${nodePackage.path}/tsconfig.json`,
|
|
1581
|
+
value: {
|
|
1582
|
+
files: [],
|
|
1583
|
+
references: [
|
|
1584
|
+
{ path: "./tsconfig.app.json" },
|
|
1585
|
+
{ path: "./tsconfig.test.json" },
|
|
1586
|
+
{ path: "./tsconfig.node.json" },
|
|
1587
|
+
],
|
|
1588
|
+
},
|
|
1589
|
+
},
|
|
1590
|
+
{
|
|
1591
|
+
kind: "writeJson",
|
|
1592
|
+
to: `${nodePackage.path}/tsconfig.app.json`,
|
|
1642
1593
|
value: {
|
|
1643
1594
|
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
1644
1595
|
compilerOptions: {
|
|
@@ -1657,17 +1608,16 @@ function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
|
1657
1608
|
"assets/**/*.svg",
|
|
1658
1609
|
"components/**/*.vue",
|
|
1659
1610
|
"database/**/*.ts",
|
|
1660
|
-
"env.d.ts",
|
|
1661
|
-
"global.d.ts",
|
|
1662
1611
|
"pages/**/*.ts",
|
|
1663
1612
|
"pages/**/*.vue",
|
|
1664
1613
|
"server/**/*.ts",
|
|
1614
|
+
"types/**/*.d.ts",
|
|
1665
1615
|
],
|
|
1666
1616
|
},
|
|
1667
1617
|
},
|
|
1668
1618
|
{
|
|
1669
1619
|
kind: "writeJson",
|
|
1670
|
-
to:
|
|
1620
|
+
to: `${nodePackage.path}/tsconfig.test.json`,
|
|
1671
1621
|
value: {
|
|
1672
1622
|
extends: "./tsconfig.app.json",
|
|
1673
1623
|
compilerOptions: {
|
|
@@ -1682,7 +1632,7 @@ function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
|
1682
1632
|
},
|
|
1683
1633
|
{
|
|
1684
1634
|
kind: "writeJson",
|
|
1685
|
-
to:
|
|
1635
|
+
to: `${nodePackage.path}/tsconfig.node.json`,
|
|
1686
1636
|
multilineArrays: ["include"],
|
|
1687
1637
|
value: {
|
|
1688
1638
|
compilerOptions: {
|
|
@@ -1858,9 +1808,6 @@ function sourcePathWithinNodePackage(sourceFile, workspace) {
|
|
|
1858
1808
|
}
|
|
1859
1809
|
function nodePackageTargetPath(nodePackage, sourceFile, workspace) {
|
|
1860
1810
|
const packageRelativePath = sourcePathWithinNodePackage(sourceFile, workspace);
|
|
1861
|
-
if (nodePackage.path === ".") {
|
|
1862
|
-
return packageRelativePath;
|
|
1863
|
-
}
|
|
1864
1811
|
return `${nodePackage.path}/${packageRelativePath}`;
|
|
1865
1812
|
}
|
|
1866
1813
|
function gitignoreForNodeWorkspace(workspace) {
|
|
@@ -1945,9 +1892,9 @@ function rootTsconfigReferences(workspace) {
|
|
|
1945
1892
|
}
|
|
1946
1893
|
if (nodePackage.kind === "vike-app") {
|
|
1947
1894
|
return [
|
|
1948
|
-
{ path:
|
|
1949
|
-
{ path:
|
|
1950
|
-
{ path:
|
|
1895
|
+
{ path: `./${nodePackage.path}/tsconfig.app.json` },
|
|
1896
|
+
{ path: `./${nodePackage.path}/tsconfig.test.json` },
|
|
1897
|
+
{ path: `./${nodePackage.path}/tsconfig.node.json` },
|
|
1951
1898
|
];
|
|
1952
1899
|
}
|
|
1953
1900
|
return [
|
|
@@ -78,7 +78,7 @@ export type WorkspaceLibraryPackageCapabilityDeclaration = {
|
|
|
78
78
|
readonly sourceFiles: readonly string[];
|
|
79
79
|
};
|
|
80
80
|
export type WorkspaceNodePackageKind = "hono-api" | "vike-app" | "vue-app";
|
|
81
|
-
export type WorkspaceNodePackagePath = "
|
|
81
|
+
export type WorkspaceNodePackagePath = "apps/api" | "apps/web";
|
|
82
82
|
export type WorkspaceNodePackageDeclaration = {
|
|
83
83
|
readonly kind: WorkspaceNodePackageKind;
|
|
84
84
|
readonly path: WorkspaceNodePackagePath;
|
|
@@ -86,7 +86,7 @@ export type WorkspaceNodePackageDeclaration = {
|
|
|
86
86
|
};
|
|
87
87
|
export type WorkspaceNodePackagesCapabilityDeclaration = {
|
|
88
88
|
readonly kind: "workspace-node-packages";
|
|
89
|
-
readonly workspacePackageGlob: "
|
|
89
|
+
readonly workspacePackageGlob: "apps/*";
|
|
90
90
|
readonly packages: readonly WorkspaceNodePackageDeclaration[];
|
|
91
91
|
readonly packageLinks?: readonly {
|
|
92
92
|
readonly consumerPackagePath: "apps/web";
|
|
@@ -404,7 +404,7 @@ export declare const presetSourceManifestJsonSchema: {
|
|
|
404
404
|
readonly const: "workspace-node-packages";
|
|
405
405
|
};
|
|
406
406
|
readonly workspacePackageGlob: {
|
|
407
|
-
readonly
|
|
407
|
+
readonly const: "apps/*";
|
|
408
408
|
};
|
|
409
409
|
readonly packages: {
|
|
410
410
|
readonly type: "array";
|
|
@@ -418,7 +418,7 @@ export declare const presetSourceManifestJsonSchema: {
|
|
|
418
418
|
readonly enum: readonly ["hono-api", "vike-app", "vue-app"];
|
|
419
419
|
};
|
|
420
420
|
readonly path: {
|
|
421
|
-
readonly enum: readonly ["
|
|
421
|
+
readonly enum: readonly ["apps/api", "apps/web"];
|
|
422
422
|
};
|
|
423
423
|
readonly sourceFiles: {
|
|
424
424
|
readonly type: "array";
|
|
@@ -235,7 +235,7 @@ export const presetSourceManifestJsonSchema = {
|
|
|
235
235
|
required: ["kind", "workspacePackageGlob", "packages"],
|
|
236
236
|
properties: {
|
|
237
237
|
kind: { const: "workspace-node-packages" },
|
|
238
|
-
workspacePackageGlob: {
|
|
238
|
+
workspacePackageGlob: { const: "apps/*" },
|
|
239
239
|
packages: {
|
|
240
240
|
type: "array",
|
|
241
241
|
minItems: 1,
|
|
@@ -247,7 +247,7 @@ export const presetSourceManifestJsonSchema = {
|
|
|
247
247
|
kind: {
|
|
248
248
|
enum: ["hono-api", "vike-app", "vue-app"],
|
|
249
249
|
},
|
|
250
|
-
path: { enum: ["
|
|
250
|
+
path: { enum: ["apps/api", "apps/web"] },
|
|
251
251
|
sourceFiles: {
|
|
252
252
|
type: "array",
|
|
253
253
|
minItems: 1,
|
|
@@ -849,11 +849,7 @@ const workspaceNodePackageKindSet = new Set([
|
|
|
849
849
|
"vike-app",
|
|
850
850
|
"vue-app",
|
|
851
851
|
]);
|
|
852
|
-
const workspaceNodePackagePathSet = new Set([
|
|
853
|
-
".",
|
|
854
|
-
"apps/api",
|
|
855
|
-
"apps/web",
|
|
856
|
-
]);
|
|
852
|
+
const workspaceNodePackagePathSet = new Set(["apps/api", "apps/web"]);
|
|
857
853
|
function isProjectionCapabilityKind(value) {
|
|
858
854
|
return projectionCapabilityKindSet.has(value);
|
|
859
855
|
}
|
|
@@ -979,7 +975,7 @@ function parseWorkspaceNodePackage(value, pathPrefix) {
|
|
|
979
975
|
if (packagePath === undefined) {
|
|
980
976
|
issues.push({
|
|
981
977
|
path: `${pathPrefix}.path`,
|
|
982
|
-
message: "workspace-node-packages package path must be
|
|
978
|
+
message: "workspace-node-packages package path must be apps/api or apps/web",
|
|
983
979
|
});
|
|
984
980
|
}
|
|
985
981
|
if (!Array.isArray(value.sourceFiles)) {
|
|
@@ -1083,14 +1079,13 @@ function parseWorkspaceNodePackageLinks(value, pathPrefix, declaredPackagePaths,
|
|
|
1083
1079
|
}
|
|
1084
1080
|
function parseWorkspaceNodePackagesCapability(capability, pathPrefix) {
|
|
1085
1081
|
const issues = [];
|
|
1086
|
-
const workspacePackageGlob = capability.workspacePackageGlob === "
|
|
1087
|
-
capability.workspacePackageGlob === "apps/*"
|
|
1082
|
+
const workspacePackageGlob = capability.workspacePackageGlob === "apps/*"
|
|
1088
1083
|
? capability.workspacePackageGlob
|
|
1089
1084
|
: undefined;
|
|
1090
1085
|
if (workspacePackageGlob === undefined) {
|
|
1091
1086
|
issues.push({
|
|
1092
1087
|
path: `${pathPrefix}.workspacePackageGlob`,
|
|
1093
|
-
message: "workspace-node-packages currently supports workspacePackageGlob:
|
|
1088
|
+
message: "workspace-node-packages currently supports workspacePackageGlob: apps/*",
|
|
1094
1089
|
});
|
|
1095
1090
|
}
|
|
1096
1091
|
if (!Array.isArray(capability.packages) || capability.packages.length === 0) {
|
|
@@ -1591,6 +1586,17 @@ function normalizeProjectBlueprint(blueprint) {
|
|
|
1591
1586
|
}),
|
|
1592
1587
|
};
|
|
1593
1588
|
}
|
|
1589
|
+
function packagePathIssue(packagePath, path) {
|
|
1590
|
+
const segments = packagePath.split("/");
|
|
1591
|
+
if (segments.length !== 2 ||
|
|
1592
|
+
segments.some((segment) => segment.length === 0 || segment === ".")) {
|
|
1593
|
+
return {
|
|
1594
|
+
path,
|
|
1595
|
+
message: "Package Path must be exactly two non-root path segments, such as apps/web or packages/ui",
|
|
1596
|
+
};
|
|
1597
|
+
}
|
|
1598
|
+
return undefined;
|
|
1599
|
+
}
|
|
1594
1600
|
export function validateProjectBlueprint(input, options = {}) {
|
|
1595
1601
|
const result = v.safeParse(projectBlueprintSchema, input);
|
|
1596
1602
|
if (!result.success) {
|
|
@@ -1646,7 +1652,10 @@ export function validateProjectBlueprint(input, options = {}) {
|
|
|
1646
1652
|
}
|
|
1647
1653
|
}
|
|
1648
1654
|
if (blueprint.packages) {
|
|
1649
|
-
semanticIssues.push(...duplicateIssues(blueprint.packages.map((projectPackage) => projectPackage.name), "$.packages.name"), ...duplicateIssues(blueprint.packages.map((projectPackage) => projectPackage.path), "$.packages.path"))
|
|
1655
|
+
semanticIssues.push(...duplicateIssues(blueprint.packages.map((projectPackage) => projectPackage.name), "$.packages.name"), ...duplicateIssues(blueprint.packages.map((projectPackage) => projectPackage.path), "$.packages.path"), ...blueprint.packages.flatMap((projectPackage, index) => {
|
|
1656
|
+
const issue = packagePathIssue(projectPackage.path, `$.packages[${index}].path`);
|
|
1657
|
+
return issue === undefined ? [] : [issue];
|
|
1658
|
+
}));
|
|
1650
1659
|
}
|
|
1651
1660
|
if (semanticIssues.length > 0) {
|
|
1652
1661
|
return { ok: false, issues: semanticIssues };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ykdz/template",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Project template generator for YKDZ starter projects.",
|
|
6
6
|
"keywords": [
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"typescript": "^6.0.3",
|
|
36
36
|
"valibot": "^1.4.2",
|
|
37
|
-
"@ykdz/template-
|
|
37
|
+
"@ykdz/template-builtin-source": "0.0.0",
|
|
38
38
|
"@ykdz/template-shared": "0.0.0",
|
|
39
|
-
"@ykdz/template-
|
|
39
|
+
"@ykdz/template-core": "0.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^24.0.0",
|
/package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{env.d.ts → types/env.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|