@ykdz/template 0.0.11 → 0.0.13
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/registry.js +2 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.d.ts +5 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.js +57 -0
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +4 -7
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/vitest.config.ts +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +176 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/+server.ts +12 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.env.example +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/dependabot.yml +23 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/workflows/check.yml +20 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/assets/logo.svg +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/components/CounterButton.vue +21 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/components/PageShell.vue +17 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/database/db.ts +14 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/database/queries/todos.ts +32 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/database/schema.ts +14 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/drizzle.config.ts +10 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/env.d.ts +6 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/global.d.ts +9 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/+Head.vue +8 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/+Layout.vue +9 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/+config.ts +10 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/index/+Page.telefunc.ts +13 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/index/+Page.vue +89 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/pages/tailwind.css +7 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/playwright.config.ts +22 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/server/api.ts +5 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/server/app.ts +25 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/test/e2e/app.spec.ts +10 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/test/todos.test.ts +20 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/vite.config.ts +12 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/vitest.config.ts +8 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/api/vitest.config.ts +7 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/playwright.config.ts +23 -7
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/api.ts +1 -4
- package/node_modules/@ykdz/template-core/dist/package-addition.js +5 -21
- package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +6 -0
- package/node_modules/@ykdz/template-core/dist/projection-capabilities.d.ts +1 -1
- package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +227 -36
- package/node_modules/@ykdz/template-shared/dist/index.d.ts +9 -9
- package/node_modules/@ykdz/template-shared/dist/index.js +29 -11
- package/package.json +3 -3
|
@@ -78,7 +78,11 @@ const capabilityInterpreters = {
|
|
|
78
78
|
state.nodeWorkspace = capability;
|
|
79
79
|
state.sourceRoot = templateSourceRootForPreset(state, sourceRootPreset(capability));
|
|
80
80
|
state.operationFactories.push(workspaceNodePackagesOperations);
|
|
81
|
-
if (capability
|
|
81
|
+
if (isRootNodeWorkspace(capability)) {
|
|
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) {
|
|
82
86
|
state.rootScriptFragments.dev = "turbo run dev --parallel";
|
|
83
87
|
}
|
|
84
88
|
const vuePackage = findVuePackage(capability);
|
|
@@ -129,25 +133,13 @@ const capabilityInterpreters = {
|
|
|
129
133
|
kind: "typescript-typecheck",
|
|
130
134
|
owner: strictTypescriptRootBoundary,
|
|
131
135
|
});
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
kind: "turbo-package-typecheck",
|
|
135
|
-
owner: workspaceBoundary,
|
|
136
|
-
});
|
|
137
|
-
if (state.nodeWorkspace !== undefined) {
|
|
138
|
-
state.rootCheckComponents.push({
|
|
139
|
-
kind: "turbo-package-build",
|
|
140
|
-
owner: workspaceBoundary,
|
|
141
|
-
});
|
|
136
|
+
if (!isRootNodeWorkspace(state.nodeWorkspace)) {
|
|
137
|
+
const workspaceBoundary = workspaceBoundaryForState(state);
|
|
142
138
|
state.rootCheckComponents.push({
|
|
143
|
-
kind: "turbo-package-
|
|
139
|
+
kind: "turbo-package-check",
|
|
144
140
|
owner: workspaceBoundary,
|
|
145
141
|
});
|
|
146
142
|
}
|
|
147
|
-
state.rootCheckComponents.push({
|
|
148
|
-
kind: "turbo-package-check",
|
|
149
|
-
owner: workspaceBoundary,
|
|
150
|
-
});
|
|
151
143
|
state.packageCheckComponents.push({
|
|
152
144
|
kind: "typescript-typecheck",
|
|
153
145
|
owner: workspacePackageBoundary,
|
|
@@ -181,19 +173,23 @@ const capabilityInterpreters = {
|
|
|
181
173
|
}, {
|
|
182
174
|
kind: "oxc-lint-fix",
|
|
183
175
|
owner: strictTypescriptRootBoundary,
|
|
184
|
-
},
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
176
|
+
}, ...(!isRootNodeWorkspace(state.nodeWorkspace)
|
|
177
|
+
? [
|
|
178
|
+
{
|
|
179
|
+
kind: "turbo-package-fix",
|
|
180
|
+
owner: workspaceBoundaryForState(state),
|
|
181
|
+
},
|
|
182
|
+
]
|
|
183
|
+
: []));
|
|
188
184
|
state.packageFixComponents.push({ kind: "oxc-format-write", owner: workspacePackageBoundary }, { kind: "oxc-lint-fix", owner: workspacePackageBoundary });
|
|
189
185
|
state.rootScriptFragments["format:check"] =
|
|
190
|
-
"oxfmt --check
|
|
186
|
+
"oxfmt --check oxlint.config.ts oxfmt.config.ts";
|
|
191
187
|
state.rootScriptFragments["format:write"] =
|
|
192
|
-
"oxfmt --write
|
|
188
|
+
"oxfmt --write oxlint.config.ts oxfmt.config.ts";
|
|
193
189
|
state.rootScriptFragments.lint =
|
|
194
|
-
"oxlint
|
|
190
|
+
"oxlint oxlint.config.ts oxfmt.config.ts";
|
|
195
191
|
state.rootScriptFragments["lint:fix"] =
|
|
196
|
-
"oxlint
|
|
192
|
+
"oxlint oxlint.config.ts oxfmt.config.ts --fix";
|
|
197
193
|
state.packageScriptFragments["format:check"] =
|
|
198
194
|
"oxfmt --check --config ../../oxfmt.config.ts .";
|
|
199
195
|
state.packageScriptFragments["format:write"] =
|
|
@@ -472,9 +468,11 @@ function blueprintPackagesForCapabilities(capabilities, packageScope, projectNam
|
|
|
472
468
|
}
|
|
473
469
|
if (capability.kind === "workspace-node-packages") {
|
|
474
470
|
return capability.packages.map((nodePackage) => {
|
|
475
|
-
const leaf = nodePackage.path
|
|
471
|
+
const leaf = nodePackage.path === "."
|
|
472
|
+
? projectName
|
|
473
|
+
: (nodePackage.path.split("/").at(-1) ?? nodePackage.path);
|
|
476
474
|
return {
|
|
477
|
-
name: `@${packageScope}/${leaf}`,
|
|
475
|
+
name: nodePackage.path === "." ? projectName : `@${packageScope}/${leaf}`,
|
|
478
476
|
path: nodePackage.path,
|
|
479
477
|
};
|
|
480
478
|
});
|
|
@@ -553,6 +551,8 @@ function packageAdditionOperationsForCapability(options) {
|
|
|
553
551
|
return libraryPackageAdditionOperations(options);
|
|
554
552
|
case "hono-api":
|
|
555
553
|
return honoApiPackageAdditionOperations(options);
|
|
554
|
+
case "vike-app":
|
|
555
|
+
throw new Error("vike-app cannot be used for Package Addition");
|
|
556
556
|
case "vue-app":
|
|
557
557
|
return vueAppPackageAdditionOperations(options);
|
|
558
558
|
}
|
|
@@ -790,11 +790,16 @@ function workspaceGlobBoundary(workspacePackageGlob) {
|
|
|
790
790
|
path: workspacePackageGlob,
|
|
791
791
|
};
|
|
792
792
|
}
|
|
793
|
+
function isRootNodeWorkspace(workspace) {
|
|
794
|
+
return (workspace?.workspacePackageGlob === "." &&
|
|
795
|
+
workspace.packages.length === 1 &&
|
|
796
|
+
workspace.packages[0]?.path === ".");
|
|
797
|
+
}
|
|
793
798
|
function hasVuePackage(capability) {
|
|
794
799
|
return findVuePackage(capability) !== undefined;
|
|
795
800
|
}
|
|
796
801
|
function findVuePackage(capability) {
|
|
797
|
-
return capability.packages.find((nodePackage) => nodePackage.kind === "vue-app");
|
|
802
|
+
return capability.packages.find((nodePackage) => nodePackage.kind === "vue-app" || nodePackage.kind === "vike-app");
|
|
798
803
|
}
|
|
799
804
|
function sourceRootPreset(capability) {
|
|
800
805
|
if (capability.packages.length === 1) {
|
|
@@ -821,6 +826,9 @@ function projectPackageScripts(checkPlan, fixPlan, fragments) {
|
|
|
821
826
|
};
|
|
822
827
|
}
|
|
823
828
|
function packageCollection(workspacePackageGlob) {
|
|
829
|
+
if (workspacePackageGlob === ".") {
|
|
830
|
+
return ".";
|
|
831
|
+
}
|
|
824
832
|
return workspacePackageGlob.slice(0, -"/*".length);
|
|
825
833
|
}
|
|
826
834
|
function workspacePackagePath(context, capability) {
|
|
@@ -874,6 +882,9 @@ function nodePackageName(context, nodePackage) {
|
|
|
874
882
|
if (packageDefinition !== undefined) {
|
|
875
883
|
return packageDefinition.name;
|
|
876
884
|
}
|
|
885
|
+
if (nodePackage.path === ".") {
|
|
886
|
+
return context.projectName.value;
|
|
887
|
+
}
|
|
877
888
|
const leaf = nodePackage.path.split("/").at(-1) ?? nodePackage.path;
|
|
878
889
|
return `@${context.projectName.value}/${leaf}`;
|
|
879
890
|
}
|
|
@@ -1005,6 +1016,50 @@ function vuePackageJson(context, packageName, scripts, packageLinkDependencies =
|
|
|
1005
1016
|
},
|
|
1006
1017
|
};
|
|
1007
1018
|
}
|
|
1019
|
+
function vikePackageJson(context, packageName, scripts) {
|
|
1020
|
+
return {
|
|
1021
|
+
name: packageName,
|
|
1022
|
+
version: "0.0.0",
|
|
1023
|
+
private: true,
|
|
1024
|
+
type: "module",
|
|
1025
|
+
imports: {
|
|
1026
|
+
"#/*": {
|
|
1027
|
+
default: "./*.ts",
|
|
1028
|
+
types: "./*.ts",
|
|
1029
|
+
},
|
|
1030
|
+
},
|
|
1031
|
+
scripts,
|
|
1032
|
+
dependencies: {
|
|
1033
|
+
"@vikejs/hono": "catalog:",
|
|
1034
|
+
"drizzle-orm": "catalog:",
|
|
1035
|
+
hono: "catalog:",
|
|
1036
|
+
telefunc: "catalog:",
|
|
1037
|
+
vike: "catalog:",
|
|
1038
|
+
"vike-vue": "catalog:",
|
|
1039
|
+
vue: "catalog:",
|
|
1040
|
+
},
|
|
1041
|
+
devDependencies: {
|
|
1042
|
+
"@playwright/test": "catalog:",
|
|
1043
|
+
"@tailwindcss/vite": "catalog:",
|
|
1044
|
+
"@types/node": "catalog:",
|
|
1045
|
+
"@vitejs/plugin-vue": "catalog:",
|
|
1046
|
+
"@vue/tsconfig": "catalog:",
|
|
1047
|
+
"drizzle-kit": "catalog:",
|
|
1048
|
+
oxfmt: "catalog:",
|
|
1049
|
+
oxlint: "catalog:",
|
|
1050
|
+
"oxlint-tsgolint": "catalog:",
|
|
1051
|
+
tailwindcss: "catalog:",
|
|
1052
|
+
typescript: "catalog:",
|
|
1053
|
+
vite: "catalog:",
|
|
1054
|
+
vitest: "catalog:",
|
|
1055
|
+
"vue-tsc": "catalog:",
|
|
1056
|
+
},
|
|
1057
|
+
engines: {
|
|
1058
|
+
node: context.toolchain.nodeLtsMajor.value,
|
|
1059
|
+
},
|
|
1060
|
+
packageManager: context.toolchain.packageManagerPin.value,
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1008
1063
|
function catalogDependencies(dependencies) {
|
|
1009
1064
|
return Object.fromEntries([...dependencies].toSorted().map((dependency) => [dependency, "catalog:"]));
|
|
1010
1065
|
}
|
|
@@ -1329,9 +1384,17 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1329
1384
|
? undefined
|
|
1330
1385
|
: packageManifestExposureFields(exposure));
|
|
1331
1386
|
}
|
|
1387
|
+
if (nodePackage.kind === "vike-app") {
|
|
1388
|
+
return vikePackageJson(context, packageName, scripts);
|
|
1389
|
+
}
|
|
1332
1390
|
return vuePackageJson(context, packageName, scripts, packageLinkPlan.manifestDependenciesByPackagePath.get(nodePackage.path));
|
|
1333
1391
|
});
|
|
1334
|
-
const rootManifest =
|
|
1392
|
+
const rootManifest = isRootNodeWorkspace(capability)
|
|
1393
|
+
? packageManifests[0]
|
|
1394
|
+
: rootPackageJson(context, packageScripts, state);
|
|
1395
|
+
if (rootManifest === undefined) {
|
|
1396
|
+
throw new Error("workspace-node-packages rendered no package manifests");
|
|
1397
|
+
}
|
|
1335
1398
|
return [
|
|
1336
1399
|
{
|
|
1337
1400
|
kind: "writeJson",
|
|
@@ -1391,16 +1454,20 @@ function workspaceNodePackagesOperations({ context, state, packageScripts, }) {
|
|
|
1391
1454
|
text: gitignoreForNodeWorkspace(capability),
|
|
1392
1455
|
},
|
|
1393
1456
|
...capability.packages.flatMap((nodePackage, index) => [
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1457
|
+
...(nodePackage.path === "."
|
|
1458
|
+
? []
|
|
1459
|
+
: [
|
|
1460
|
+
{
|
|
1461
|
+
kind: "writeJson",
|
|
1462
|
+
to: `${nodePackage.path}/package.json`,
|
|
1463
|
+
value: packageManifests[index],
|
|
1464
|
+
},
|
|
1465
|
+
]),
|
|
1399
1466
|
...nodePackageTsconfigOperations(nodePackage, capability),
|
|
1400
1467
|
...nodePackage.sourceFiles.map((sourceFile) => ({
|
|
1401
1468
|
kind: "copyFile",
|
|
1402
1469
|
from: sourceFile,
|
|
1403
|
-
to:
|
|
1470
|
+
to: nodePackageTargetPath(nodePackage, sourceFile, capability),
|
|
1404
1471
|
})),
|
|
1405
1472
|
]),
|
|
1406
1473
|
...fullStackApiAnchorOperations(context, capability),
|
|
@@ -1453,6 +1520,43 @@ function nodePackageScripts(nodePackage, workspace) {
|
|
|
1453
1520
|
typecheck: "tsc -p tsconfig.json --noEmit",
|
|
1454
1521
|
};
|
|
1455
1522
|
}
|
|
1523
|
+
if (nodePackage.kind === "vike-app") {
|
|
1524
|
+
const checks = {
|
|
1525
|
+
components: [
|
|
1526
|
+
{ kind: "oxc-format-check", owner: workspacePackageBoundary },
|
|
1527
|
+
{ kind: "oxc-lint", owner: workspacePackageBoundary },
|
|
1528
|
+
{ kind: "typescript-typecheck", owner: workspacePackageBoundary },
|
|
1529
|
+
{ kind: "build", owner: workspacePackageBoundary },
|
|
1530
|
+
{ kind: "unit-test", owner: workspacePackageBoundary },
|
|
1531
|
+
{ kind: "e2e-test", owner: workspacePackageBoundary },
|
|
1532
|
+
],
|
|
1533
|
+
environmentNeeds: [],
|
|
1534
|
+
};
|
|
1535
|
+
const fixes = {
|
|
1536
|
+
components: [
|
|
1537
|
+
{ kind: "oxc-format-write", owner: workspacePackageBoundary },
|
|
1538
|
+
{ kind: "oxc-lint-fix", owner: workspacePackageBoundary },
|
|
1539
|
+
],
|
|
1540
|
+
};
|
|
1541
|
+
return {
|
|
1542
|
+
build: "vike build",
|
|
1543
|
+
check: renderRootCheckCommand(checks),
|
|
1544
|
+
dev: "vike dev",
|
|
1545
|
+
"drizzle:generate": "drizzle-kit generate",
|
|
1546
|
+
"drizzle:migrate": "drizzle-kit migrate",
|
|
1547
|
+
"drizzle:studio": "drizzle-kit studio",
|
|
1548
|
+
fix: renderFixCommand(fixes),
|
|
1549
|
+
"format:check": "oxfmt --check --config oxfmt.config.ts .",
|
|
1550
|
+
"format:write": "oxfmt --write --config oxfmt.config.ts .",
|
|
1551
|
+
lint: "oxlint --type-aware --config oxlint.config.ts .",
|
|
1552
|
+
"lint:fix": "oxlint --type-aware --config oxlint.config.ts . --fix",
|
|
1553
|
+
preview: "vike preview",
|
|
1554
|
+
start: "node ./dist/server/index.mjs",
|
|
1555
|
+
test: "vitest run",
|
|
1556
|
+
"test:e2e": "playwright test --config playwright.config.ts",
|
|
1557
|
+
typecheck: "vue-tsc --build --noEmit",
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1456
1560
|
const checks = {
|
|
1457
1561
|
components: [
|
|
1458
1562
|
{ kind: "oxc-format-check", owner: workspacePackageBoundary },
|
|
@@ -1485,6 +1589,80 @@ function nodePackageScripts(nodePackage, workspace) {
|
|
|
1485
1589
|
};
|
|
1486
1590
|
}
|
|
1487
1591
|
function nodePackageTsconfigOperations(nodePackage, workspace) {
|
|
1592
|
+
if (nodePackage.kind === "vike-app") {
|
|
1593
|
+
return [
|
|
1594
|
+
{
|
|
1595
|
+
kind: "writeJson",
|
|
1596
|
+
to: "tsconfig.app.json",
|
|
1597
|
+
value: {
|
|
1598
|
+
extends: "@vue/tsconfig/tsconfig.dom.json",
|
|
1599
|
+
compilerOptions: {
|
|
1600
|
+
...strictTypeScriptCompilerOptions({
|
|
1601
|
+
composite: true,
|
|
1602
|
+
module: "ESNext",
|
|
1603
|
+
moduleResolution: "Bundler",
|
|
1604
|
+
paths: { "#/*": ["./*"] },
|
|
1605
|
+
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
1606
|
+
types: ["node"],
|
|
1607
|
+
}),
|
|
1608
|
+
skipLibCheck: true,
|
|
1609
|
+
},
|
|
1610
|
+
include: [
|
|
1611
|
+
"+server.ts",
|
|
1612
|
+
"assets/**/*.svg",
|
|
1613
|
+
"components/**/*.vue",
|
|
1614
|
+
"database/**/*.ts",
|
|
1615
|
+
"env.d.ts",
|
|
1616
|
+
"global.d.ts",
|
|
1617
|
+
"pages/**/*.ts",
|
|
1618
|
+
"pages/**/*.vue",
|
|
1619
|
+
"server/**/*.ts",
|
|
1620
|
+
],
|
|
1621
|
+
},
|
|
1622
|
+
},
|
|
1623
|
+
{
|
|
1624
|
+
kind: "writeJson",
|
|
1625
|
+
to: "tsconfig.test.json",
|
|
1626
|
+
value: {
|
|
1627
|
+
extends: "./tsconfig.app.json",
|
|
1628
|
+
compilerOptions: {
|
|
1629
|
+
lib: ["ESNext", "DOM", "DOM.Iterable"],
|
|
1630
|
+
paths: { "#/*": ["./*"] },
|
|
1631
|
+
skipLibCheck: true,
|
|
1632
|
+
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
|
|
1633
|
+
types: ["node", "vitest/globals"],
|
|
1634
|
+
},
|
|
1635
|
+
include: ["database/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
|
|
1636
|
+
},
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
kind: "writeJson",
|
|
1640
|
+
to: "tsconfig.node.json",
|
|
1641
|
+
multilineArrays: ["include"],
|
|
1642
|
+
value: {
|
|
1643
|
+
compilerOptions: {
|
|
1644
|
+
...strictTypeScriptCompilerOptions({
|
|
1645
|
+
composite: true,
|
|
1646
|
+
module: "ESNext",
|
|
1647
|
+
moduleResolution: "Bundler",
|
|
1648
|
+
lib: ["ESNext", "DOM", "DOM.Iterable"],
|
|
1649
|
+
paths: { "#/*": ["./*"] },
|
|
1650
|
+
tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
1651
|
+
types: ["node"],
|
|
1652
|
+
}),
|
|
1653
|
+
skipLibCheck: true,
|
|
1654
|
+
},
|
|
1655
|
+
include: [
|
|
1656
|
+
"drizzle.config.ts",
|
|
1657
|
+
"playwright.config.ts",
|
|
1658
|
+
"scripts/**/*.ts",
|
|
1659
|
+
"vite.config.ts",
|
|
1660
|
+
"vitest.config.ts",
|
|
1661
|
+
],
|
|
1662
|
+
},
|
|
1663
|
+
},
|
|
1664
|
+
];
|
|
1665
|
+
}
|
|
1488
1666
|
if (nodePackage.kind === "hono-api") {
|
|
1489
1667
|
return [
|
|
1490
1668
|
{
|
|
@@ -1633,6 +1811,13 @@ function sourcePathWithinNodePackage(sourceFile, workspace) {
|
|
|
1633
1811
|
}
|
|
1634
1812
|
return sourceFile.replace(/^(api|web)\//, "");
|
|
1635
1813
|
}
|
|
1814
|
+
function nodePackageTargetPath(nodePackage, sourceFile, workspace) {
|
|
1815
|
+
const packageRelativePath = sourcePathWithinNodePackage(sourceFile, workspace);
|
|
1816
|
+
if (nodePackage.path === ".") {
|
|
1817
|
+
return packageRelativePath;
|
|
1818
|
+
}
|
|
1819
|
+
return `${nodePackage.path}/${packageRelativePath}`;
|
|
1820
|
+
}
|
|
1636
1821
|
function gitignoreForNodeWorkspace(workspace) {
|
|
1637
1822
|
return [
|
|
1638
1823
|
"node_modules",
|
|
@@ -1656,8 +1841,7 @@ function fullStackApiAnchorOperations(context, workspace) {
|
|
|
1656
1841
|
path: "apps/web/src/api.ts",
|
|
1657
1842
|
language: "typescript",
|
|
1658
1843
|
replacements: {
|
|
1659
|
-
"api-type-
|
|
1660
|
-
"api-type-import-end": "*/",
|
|
1844
|
+
"api-type-imports": `import type { AppType } from "@${packageScope}/api";\nimport { hc } from "hono/client";`,
|
|
1661
1845
|
},
|
|
1662
1846
|
},
|
|
1663
1847
|
];
|
|
@@ -1714,6 +1898,13 @@ function rootTsconfigReferences(workspace) {
|
|
|
1714
1898
|
? []
|
|
1715
1899
|
: [{ path: `./${nodePackage.path}/tsconfig.json` }];
|
|
1716
1900
|
}
|
|
1901
|
+
if (nodePackage.kind === "vike-app") {
|
|
1902
|
+
return [
|
|
1903
|
+
{ path: "./tsconfig.app.json" },
|
|
1904
|
+
{ path: "./tsconfig.test.json" },
|
|
1905
|
+
{ path: "./tsconfig.node.json" },
|
|
1906
|
+
];
|
|
1907
|
+
}
|
|
1717
1908
|
return [
|
|
1718
1909
|
{ path: `./${nodePackage.path}/tsconfig.app.json` },
|
|
1719
1910
|
{ path: `./${nodePackage.path}/tsconfig.test.json` },
|
|
@@ -6,7 +6,7 @@ export declare const PackageAdditionSupport: {
|
|
|
6
6
|
export type PackageAdditionSupport = (typeof PackageAdditionSupport)[keyof typeof PackageAdditionSupport];
|
|
7
7
|
export declare const packageAdditionSupportValues: readonly ["supported", "unsupported"];
|
|
8
8
|
export type PackageRole = "runtime-service" | "shared-library";
|
|
9
|
-
export type PackageSourcePreset = "hono-api" | "ts-lib" | "vue-app";
|
|
9
|
+
export type PackageSourcePreset = "hono-api" | "ts-lib" | "vike-app" | "vue-app";
|
|
10
10
|
export type PackageLinkIntent = {
|
|
11
11
|
readonly consumerPackagePath: string;
|
|
12
12
|
readonly providerPackagePath: string;
|
|
@@ -77,8 +77,8 @@ export type WorkspaceLibraryPackageCapabilityDeclaration = {
|
|
|
77
77
|
readonly packageSourcePreset: "ts-lib";
|
|
78
78
|
readonly sourceFiles: readonly string[];
|
|
79
79
|
};
|
|
80
|
-
export type WorkspaceNodePackageKind = "hono-api" | "vue-app";
|
|
81
|
-
export type WorkspaceNodePackagePath = "apps/api" | "apps/web";
|
|
80
|
+
export type WorkspaceNodePackageKind = "hono-api" | "vike-app" | "vue-app";
|
|
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: "apps/*";
|
|
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 enum: readonly [".", "apps/*"];
|
|
408
408
|
};
|
|
409
409
|
readonly packages: {
|
|
410
410
|
readonly type: "array";
|
|
@@ -415,10 +415,10 @@ export declare const presetSourceManifestJsonSchema: {
|
|
|
415
415
|
readonly required: readonly ["kind", "path", "sourceFiles"];
|
|
416
416
|
readonly properties: {
|
|
417
417
|
readonly kind: {
|
|
418
|
-
readonly enum: readonly ["hono-api", "vue-app"];
|
|
418
|
+
readonly enum: readonly ["hono-api", "vike-app", "vue-app"];
|
|
419
419
|
};
|
|
420
420
|
readonly path: {
|
|
421
|
-
readonly enum: readonly ["apps/api", "apps/web"];
|
|
421
|
+
readonly enum: readonly [".", "apps/api", "apps/web"];
|
|
422
422
|
};
|
|
423
423
|
readonly sourceFiles: {
|
|
424
424
|
readonly type: "array";
|
|
@@ -732,7 +732,7 @@ export declare const blueprintJsonSchema: {
|
|
|
732
732
|
readonly enum: readonly ["runtime-service", "shared-library"];
|
|
733
733
|
};
|
|
734
734
|
readonly sourcePreset: {
|
|
735
|
-
readonly enum: readonly ["hono-api", "ts-lib", "vue-app"];
|
|
735
|
+
readonly enum: readonly ["hono-api", "ts-lib", "vike-app", "vue-app"];
|
|
736
736
|
};
|
|
737
737
|
};
|
|
738
738
|
};
|
|
@@ -776,7 +776,7 @@ export declare const projectBlueprintSchema: v.StrictObjectSchema<{
|
|
|
776
776
|
readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
777
777
|
readonly path: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
778
778
|
readonly role: v.OptionalSchema<v.PicklistSchema<["runtime-service", "shared-library"], undefined>, undefined>;
|
|
779
|
-
readonly sourcePreset: v.OptionalSchema<v.PicklistSchema<["hono-api", "ts-lib", "vue-app"], undefined>, undefined>;
|
|
779
|
+
readonly sourcePreset: v.OptionalSchema<v.PicklistSchema<["hono-api", "ts-lib", "vike-app", "vue-app"], undefined>, undefined>;
|
|
780
780
|
}, undefined>, undefined>, undefined>;
|
|
781
781
|
readonly packageLinkIntents: v.OptionalSchema<v.ArraySchema<v.StrictObjectSchema<{
|
|
782
782
|
readonly consumerPackagePath: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
@@ -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: { enum: [".", "apps/*"] },
|
|
239
239
|
packages: {
|
|
240
240
|
type: "array",
|
|
241
241
|
minItems: 1,
|
|
@@ -244,8 +244,10 @@ export const presetSourceManifestJsonSchema = {
|
|
|
244
244
|
additionalProperties: false,
|
|
245
245
|
required: ["kind", "path", "sourceFiles"],
|
|
246
246
|
properties: {
|
|
247
|
-
kind: {
|
|
248
|
-
|
|
247
|
+
kind: {
|
|
248
|
+
enum: ["hono-api", "vike-app", "vue-app"],
|
|
249
|
+
},
|
|
250
|
+
path: { enum: [".", "apps/api", "apps/web"] },
|
|
249
251
|
sourceFiles: {
|
|
250
252
|
type: "array",
|
|
251
253
|
minItems: 1,
|
|
@@ -375,6 +377,7 @@ const packageRoleSchema = v.picklist([
|
|
|
375
377
|
const packageSourcePresetSchema = v.picklist([
|
|
376
378
|
"hono-api",
|
|
377
379
|
"ts-lib",
|
|
380
|
+
"vike-app",
|
|
378
381
|
"vue-app",
|
|
379
382
|
]);
|
|
380
383
|
const presetSourceManifestPresetSourceSchema = v.strictObject({
|
|
@@ -499,7 +502,7 @@ export const blueprintJsonSchema = {
|
|
|
499
502
|
name: { type: "string", minLength: 1 },
|
|
500
503
|
path: { type: "string", minLength: 1 },
|
|
501
504
|
role: { enum: ["runtime-service", "shared-library"] },
|
|
502
|
-
sourcePreset: { enum: ["hono-api", "ts-lib", "vue-app"] },
|
|
505
|
+
sourcePreset: { enum: ["hono-api", "ts-lib", "vike-app", "vue-app"] },
|
|
503
506
|
},
|
|
504
507
|
},
|
|
505
508
|
},
|
|
@@ -841,8 +844,16 @@ function nonEmptyStringArray(value) {
|
|
|
841
844
|
return strings.length === 0 ? undefined : strings;
|
|
842
845
|
}
|
|
843
846
|
const projectionCapabilityKindSet = new Set(projectionCapabilityKinds);
|
|
844
|
-
const workspaceNodePackageKindSet = new Set([
|
|
845
|
-
|
|
847
|
+
const workspaceNodePackageKindSet = new Set([
|
|
848
|
+
"hono-api",
|
|
849
|
+
"vike-app",
|
|
850
|
+
"vue-app",
|
|
851
|
+
]);
|
|
852
|
+
const workspaceNodePackagePathSet = new Set([
|
|
853
|
+
".",
|
|
854
|
+
"apps/api",
|
|
855
|
+
"apps/web",
|
|
856
|
+
]);
|
|
846
857
|
function isProjectionCapabilityKind(value) {
|
|
847
858
|
return projectionCapabilityKindSet.has(value);
|
|
848
859
|
}
|
|
@@ -962,13 +973,13 @@ function parseWorkspaceNodePackage(value, pathPrefix) {
|
|
|
962
973
|
if (kind === undefined) {
|
|
963
974
|
issues.push({
|
|
964
975
|
path: `${pathPrefix}.kind`,
|
|
965
|
-
message: "workspace-node-packages package kind must be hono-api or vue-app",
|
|
976
|
+
message: "workspace-node-packages package kind must be hono-api, vike-app, or vue-app",
|
|
966
977
|
});
|
|
967
978
|
}
|
|
968
979
|
if (packagePath === undefined) {
|
|
969
980
|
issues.push({
|
|
970
981
|
path: `${pathPrefix}.path`,
|
|
971
|
-
message: "workspace-node-packages package path must be apps/api or apps/web",
|
|
982
|
+
message: "workspace-node-packages package path must be ., apps/api, or apps/web",
|
|
972
983
|
});
|
|
973
984
|
}
|
|
974
985
|
if (!Array.isArray(value.sourceFiles)) {
|
|
@@ -1072,10 +1083,14 @@ function parseWorkspaceNodePackageLinks(value, pathPrefix, declaredPackagePaths,
|
|
|
1072
1083
|
}
|
|
1073
1084
|
function parseWorkspaceNodePackagesCapability(capability, pathPrefix) {
|
|
1074
1085
|
const issues = [];
|
|
1075
|
-
|
|
1086
|
+
const workspacePackageGlob = capability.workspacePackageGlob === "." ||
|
|
1087
|
+
capability.workspacePackageGlob === "apps/*"
|
|
1088
|
+
? capability.workspacePackageGlob
|
|
1089
|
+
: undefined;
|
|
1090
|
+
if (workspacePackageGlob === undefined) {
|
|
1076
1091
|
issues.push({
|
|
1077
1092
|
path: `${pathPrefix}.workspacePackageGlob`,
|
|
1078
|
-
message: "workspace-node-packages currently supports workspacePackageGlob: apps/*",
|
|
1093
|
+
message: "workspace-node-packages currently supports workspacePackageGlob: . or apps/*",
|
|
1079
1094
|
});
|
|
1080
1095
|
}
|
|
1081
1096
|
if (!Array.isArray(capability.packages) || capability.packages.length === 0) {
|
|
@@ -1101,9 +1116,12 @@ function parseWorkspaceNodePackagesCapability(capability, pathPrefix) {
|
|
|
1101
1116
|
if (issues.length > 0) {
|
|
1102
1117
|
return issues;
|
|
1103
1118
|
}
|
|
1119
|
+
if (workspacePackageGlob === undefined) {
|
|
1120
|
+
throw new Error(`workspace-node-packages validation failed without workspacePackageGlob diagnostic at ${pathPrefix}`);
|
|
1121
|
+
}
|
|
1104
1122
|
return {
|
|
1105
1123
|
kind: "workspace-node-packages",
|
|
1106
|
-
workspacePackageGlob
|
|
1124
|
+
workspacePackageGlob,
|
|
1107
1125
|
packages,
|
|
1108
1126
|
...(packageLinks === undefined ? {} : { packageLinks }),
|
|
1109
1127
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ykdz/template",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Project template generator for YKDZ starter projects.",
|
|
6
6
|
"keywords": [
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"typescript": "^6.0.3",
|
|
36
36
|
"valibot": "^1.4.2",
|
|
37
37
|
"@ykdz/template-builtin-source": "0.0.0",
|
|
38
|
-
"@ykdz/template-
|
|
39
|
-
"@ykdz/template-
|
|
38
|
+
"@ykdz/template-core": "0.0.0",
|
|
39
|
+
"@ykdz/template-shared": "0.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^24.0.0",
|