@ykdz/template 0.0.7 → 0.0.8
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} +26 -14
- 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 +92 -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 +230 -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 +214 -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 +353 -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 +46 -0
- package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/node/oxlint.config.ts +3 -0
- package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/vue/oxlint.config.ts +3 -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 +11 -13
- package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.js +2 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.js +3 -1
- package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.d.ts +2 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.js +16 -5
- 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 +11 -10
- package/{pnpm-workspace.yaml → node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml} +3 -1
- 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 +13 -29
- package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.d.ts +10 -2
- package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.js +22 -49
- package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.js +12 -4
- package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.js +2 -0
- package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.js +1 -1
- package/node_modules/@ykdz/template-core/package.json +27 -0
- package/package.json +14 -34
- package/README.md +0 -35
- package/dist/src/package-addition.d.ts +0 -8
- /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}/preset-source.json +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/env.d.ts +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/env.d.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.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}/generation-context.js +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}/next-step-instructions.js +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}/preset-projection.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.d.ts +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.js +0 -0
- /package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.d.ts +0 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
|
|
3
|
+
import { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
|
|
4
|
+
import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
|
|
5
|
+
import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
|
|
6
|
+
import { renderNewProject } from "@ykdz/template-core/renderer";
|
|
7
|
+
export const vueHonoAppPresetMetadata = {
|
|
8
|
+
name: "vue-hono-app",
|
|
9
|
+
title: "Vue Hono app",
|
|
10
|
+
description: "Full-stack Vue and Hono workspace with Hono RPC typing.",
|
|
11
|
+
generation: "supported",
|
|
12
|
+
supportedPackageManagers: ["pnpm"],
|
|
13
|
+
supportedProjectKinds: ["multi-package"],
|
|
14
|
+
packageAdditionSupport: PackageAdditionSupport.Unsupported,
|
|
15
|
+
features: [
|
|
16
|
+
"pnpm-catalog",
|
|
17
|
+
"oxc-format-lint",
|
|
18
|
+
"strict-typescript",
|
|
19
|
+
"root-check",
|
|
20
|
+
"fix-command",
|
|
21
|
+
"devcontainer",
|
|
22
|
+
"github-actions",
|
|
23
|
+
"dependabot",
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
const rootBoundary = {
|
|
27
|
+
kind: "workspace-orchestration",
|
|
28
|
+
path: ".",
|
|
29
|
+
};
|
|
30
|
+
const apiPackageBoundary = {
|
|
31
|
+
kind: "package-boundary",
|
|
32
|
+
path: ".",
|
|
33
|
+
};
|
|
34
|
+
const webPackageBoundary = {
|
|
35
|
+
kind: "package-boundary",
|
|
36
|
+
path: ".",
|
|
37
|
+
};
|
|
38
|
+
const workspacePackageBoundary = {
|
|
39
|
+
kind: "package-boundary",
|
|
40
|
+
path: "apps/*",
|
|
41
|
+
};
|
|
42
|
+
const webWorkspaceBoundary = {
|
|
43
|
+
kind: "package-boundary",
|
|
44
|
+
path: "apps/web",
|
|
45
|
+
};
|
|
46
|
+
function honoApiCheckComponents(owner) {
|
|
47
|
+
return [
|
|
48
|
+
{ kind: "oxc-format-check", owner },
|
|
49
|
+
{ kind: "oxc-lint", owner },
|
|
50
|
+
{ kind: "typescript-typecheck", owner },
|
|
51
|
+
{ kind: "build", owner },
|
|
52
|
+
{ kind: "unit-test", owner },
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
function vueWebCheckComponents(owner) {
|
|
56
|
+
return [
|
|
57
|
+
{ kind: "oxc-format-check", owner },
|
|
58
|
+
{ kind: "oxc-lint", owner },
|
|
59
|
+
{ kind: "typescript-typecheck", owner },
|
|
60
|
+
{ kind: "build", owner },
|
|
61
|
+
{ kind: "unit-test", owner },
|
|
62
|
+
{ kind: "e2e-test", owner },
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
function nodeFixComponents(owner) {
|
|
66
|
+
return [
|
|
67
|
+
{ kind: "oxc-format-write", owner },
|
|
68
|
+
{ kind: "oxc-lint-fix", owner },
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
function planVueHonoRootChecks() {
|
|
72
|
+
return {
|
|
73
|
+
components: [
|
|
74
|
+
{ kind: "oxc-format-check", owner: rootBoundary },
|
|
75
|
+
{ kind: "oxc-lint", owner: rootBoundary },
|
|
76
|
+
{ kind: "typescript-typecheck", owner: rootBoundary },
|
|
77
|
+
{ kind: "turbo-package-typecheck", owner: workspacePackageBoundary },
|
|
78
|
+
{ kind: "turbo-package-build", owner: workspacePackageBoundary },
|
|
79
|
+
{ kind: "turbo-package-test", owner: workspacePackageBoundary },
|
|
80
|
+
{ kind: "turbo-package-e2e-test", owner: workspacePackageBoundary },
|
|
81
|
+
{ kind: "turbo-package-check", owner: workspacePackageBoundary },
|
|
82
|
+
],
|
|
83
|
+
environmentNeeds: [
|
|
84
|
+
{
|
|
85
|
+
kind: "playwright-browser-assets",
|
|
86
|
+
browser: "chromium",
|
|
87
|
+
owner: webWorkspaceBoundary,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function planVueHonoRootFixes() {
|
|
93
|
+
return {
|
|
94
|
+
components: [
|
|
95
|
+
{ kind: "oxc-format-write", owner: rootBoundary },
|
|
96
|
+
{ kind: "oxc-lint-fix", owner: rootBoundary },
|
|
97
|
+
{ kind: "turbo-package-fix", owner: workspacePackageBoundary },
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function planVueHonoApiChecks() {
|
|
102
|
+
return {
|
|
103
|
+
components: [...honoApiCheckComponents(apiPackageBoundary)],
|
|
104
|
+
environmentNeeds: [],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function planVueHonoWebChecks() {
|
|
108
|
+
return {
|
|
109
|
+
components: [...vueWebCheckComponents(webPackageBoundary)],
|
|
110
|
+
environmentNeeds: [],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function planVueHonoPackageFixes(owner) {
|
|
114
|
+
return {
|
|
115
|
+
components: [...nodeFixComponents(owner)],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function projectNameFromDir(targetDir) {
|
|
119
|
+
return path.basename(path.resolve(targetDir));
|
|
120
|
+
}
|
|
121
|
+
function packageScopeFromOptions(options) {
|
|
122
|
+
return options.scope ?? projectNameFromDir(options.targetDir);
|
|
123
|
+
}
|
|
124
|
+
function scopedPackageName(packageScope, leaf) {
|
|
125
|
+
return `@${packageScope}/${leaf}`;
|
|
126
|
+
}
|
|
127
|
+
export function vueHonoAppBlueprint(options) {
|
|
128
|
+
const packageScope = packageScopeFromOptions(options);
|
|
129
|
+
return {
|
|
130
|
+
schemaVersion: 1,
|
|
131
|
+
preset: "vue-hono-app",
|
|
132
|
+
packageManager: "pnpm",
|
|
133
|
+
projectKind: "multi-package",
|
|
134
|
+
features: [...vueHonoAppPresetMetadata.features],
|
|
135
|
+
packages: [
|
|
136
|
+
{ name: scopedPackageName(packageScope, "web"), path: "apps/web" },
|
|
137
|
+
{ name: scopedPackageName(packageScope, "api"), path: "apps/api" },
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
export function projectVueHonoRootPackageScripts() {
|
|
142
|
+
return {
|
|
143
|
+
check: renderRootCheckCommand(planVueHonoRootChecks()),
|
|
144
|
+
dev: "turbo run dev --parallel",
|
|
145
|
+
fix: renderFixCommand(planVueHonoRootFixes()),
|
|
146
|
+
"format:check": "oxfmt --check --config oxfmt.config.ts oxlint.config.ts oxfmt.config.ts",
|
|
147
|
+
"format:write": "oxfmt --write --config oxfmt.config.ts oxlint.config.ts oxfmt.config.ts",
|
|
148
|
+
lint: "oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts --deny-warnings",
|
|
149
|
+
"lint:fix": "oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts --fix --deny-warnings",
|
|
150
|
+
typecheck: "tsc -p tsconfig.config.json --noEmit",
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
export function projectVueHonoApiPackageScripts() {
|
|
154
|
+
return {
|
|
155
|
+
build: "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
156
|
+
check: renderRootCheckCommand(planVueHonoApiChecks()),
|
|
157
|
+
dev: "tsx watch src/server.ts",
|
|
158
|
+
fix: renderFixCommand(planVueHonoPackageFixes(apiPackageBoundary)),
|
|
159
|
+
"format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
|
|
160
|
+
"format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
161
|
+
lint: "oxlint --config ../../oxlint.config.ts . --deny-warnings",
|
|
162
|
+
"lint:fix": "oxlint --config ../../oxlint.config.ts . --fix --deny-warnings",
|
|
163
|
+
start: "node dist/server.js",
|
|
164
|
+
test: "vitest run",
|
|
165
|
+
typecheck: "tsc -p tsconfig.json --noEmit",
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export function projectVueHonoWebPackageScripts() {
|
|
169
|
+
return {
|
|
170
|
+
build: "vite build",
|
|
171
|
+
check: renderRootCheckCommand(planVueHonoWebChecks()),
|
|
172
|
+
dev: "vite",
|
|
173
|
+
fix: renderFixCommand(planVueHonoPackageFixes(webPackageBoundary)),
|
|
174
|
+
"format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
|
|
175
|
+
"format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
176
|
+
lint: "oxlint --config ../../oxlint.config.ts . --deny-warnings",
|
|
177
|
+
"lint:fix": "oxlint --config ../../oxlint.config.ts . --fix --deny-warnings",
|
|
178
|
+
preview: "vite preview",
|
|
179
|
+
test: "vitest run",
|
|
180
|
+
"test:e2e": "pnpm run build && playwright test",
|
|
181
|
+
typecheck: "vue-tsc --build",
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
export const vueHonoAppPresetProjection = {
|
|
185
|
+
metadata: vueHonoAppPresetMetadata,
|
|
186
|
+
blueprint: vueHonoAppBlueprint,
|
|
187
|
+
project(context) {
|
|
188
|
+
return interpretPresetProjectionDeclaration({
|
|
189
|
+
preset: vueHonoAppPresetMetadata,
|
|
190
|
+
declaration: loadBuiltInPresetProjectionDeclaration("vue-hono-app"),
|
|
191
|
+
context,
|
|
192
|
+
sourceRoots: builtInPresetProjectionSourceRoots(),
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
async render({ targetDir, plan }) {
|
|
196
|
+
await renderNewProject({
|
|
197
|
+
sourceRoot: plan.sourceRoot,
|
|
198
|
+
sourceRoots: plan.sourceRoots,
|
|
199
|
+
targetRoot: targetDir,
|
|
200
|
+
operations: [...plan.operations],
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ykdz/template-builtin-source",
|
|
3
|
+
"version": "0.0.8",
|
|
4
|
+
"private": true,
|
|
5
|
+
"files": [
|
|
6
|
+
"dist",
|
|
7
|
+
"templates",
|
|
8
|
+
"!templates/*.tmp",
|
|
9
|
+
"!templates/registry.ts",
|
|
10
|
+
"!templates/projection-plans.ts",
|
|
11
|
+
"!templates/*/projection.ts",
|
|
12
|
+
"!templates/shared/oxc/tsconfig.json",
|
|
13
|
+
"!templates/**/node_modules"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/src/index.d.ts",
|
|
19
|
+
"default": "./dist/src/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./registry": {
|
|
22
|
+
"types": "./dist/templates/registry.d.ts",
|
|
23
|
+
"default": "./dist/templates/registry.js"
|
|
24
|
+
},
|
|
25
|
+
"./projection-plans": {
|
|
26
|
+
"types": "./dist/templates/projection-plans.d.ts",
|
|
27
|
+
"default": "./dist/templates/projection-plans.js"
|
|
28
|
+
},
|
|
29
|
+
"./templates/*": {
|
|
30
|
+
"types": "./dist/templates/*.d.ts",
|
|
31
|
+
"default": "./dist/templates/*.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
36
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@ykdz/template-core": "workspace:*",
|
|
40
|
+
"typescript": "catalog:",
|
|
41
|
+
"valibot": "catalog:"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "catalog:"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -38,7 +38,6 @@ export type ProjectBlueprint = {
|
|
|
38
38
|
packages?: ProjectPackage[];
|
|
39
39
|
packageLinkIntents?: PackageLinkIntent[];
|
|
40
40
|
};
|
|
41
|
-
export declare const builtInPresets: readonly BuiltInPreset[];
|
|
42
41
|
export declare const presetFileJsonSchema: {
|
|
43
42
|
readonly $schema: "https://json-schema.org/draft/2020-12/schema";
|
|
44
43
|
readonly $id: "https://ykdz.dev/schemas/project-kit/preset-file.schema.json";
|
|
@@ -195,6 +194,10 @@ export type ValidationResult<T> = {
|
|
|
195
194
|
ok: false;
|
|
196
195
|
issues: ValidationIssue[];
|
|
197
196
|
};
|
|
198
|
-
export
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
export type PresetCatalogValidationOptions = {
|
|
198
|
+
readonly presets?: readonly BuiltInPreset[];
|
|
199
|
+
readonly presetLabel?: string;
|
|
200
|
+
};
|
|
201
|
+
export declare function validatePresetFile(input: unknown, options?: PresetCatalogValidationOptions): ValidationResult<PresetFile>;
|
|
202
|
+
export declare function findPreset(presets: readonly BuiltInPreset[], name: string): BuiltInPreset | undefined;
|
|
203
|
+
export declare function validateProjectBlueprint(input: unknown, options?: PresetCatalogValidationOptions): ValidationResult<ProjectBlueprint>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
|
-
import { loadBuiltInPresetSourceManifest } from "./preset-source.js";
|
|
3
|
-
export const builtInPresets = loadBuiltInPresetSourceManifest().presets;
|
|
4
2
|
const featureNames = [
|
|
5
3
|
"pnpm-catalog",
|
|
6
4
|
"oxc-format-lint",
|
|
@@ -180,7 +178,7 @@ function unsupportedSinglePackageProjectShapeIssue(path) {
|
|
|
180
178
|
message: "single-package Project Shape is unsupported in V1; use the workspace monorepo Project Shape",
|
|
181
179
|
};
|
|
182
180
|
}
|
|
183
|
-
export function validatePresetFile(input) {
|
|
181
|
+
export function validatePresetFile(input, options = {}) {
|
|
184
182
|
const result = v.safeParse(presetFileSchema, input);
|
|
185
183
|
if (!result.success) {
|
|
186
184
|
return { ok: false, issues: shapeIssues(result.issues) };
|
|
@@ -193,9 +191,9 @@ export function validatePresetFile(input) {
|
|
|
193
191
|
if (result.output.supportedProjectKinds.includes("single-package")) {
|
|
194
192
|
semanticIssues.push(unsupportedSinglePackageProjectShapeIssue("$.supportedProjectKinds"));
|
|
195
193
|
}
|
|
196
|
-
const
|
|
197
|
-
const unsupportedGeneration =
|
|
198
|
-
? generationSupportIssue(
|
|
194
|
+
const catalogPreset = findPreset(options.presets ?? [], result.output.name);
|
|
195
|
+
const unsupportedGeneration = catalogPreset
|
|
196
|
+
? generationSupportIssue(catalogPreset, "$.name")
|
|
199
197
|
: undefined;
|
|
200
198
|
if (unsupportedGeneration) {
|
|
201
199
|
semanticIssues.push(unsupportedGeneration);
|
|
@@ -205,29 +203,29 @@ export function validatePresetFile(input) {
|
|
|
205
203
|
}
|
|
206
204
|
return { ok: true, value: result.output };
|
|
207
205
|
}
|
|
208
|
-
export function
|
|
209
|
-
return
|
|
206
|
+
export function findPreset(presets, name) {
|
|
207
|
+
return presets.find((preset) => preset.name === name);
|
|
210
208
|
}
|
|
211
|
-
export function validateProjectBlueprint(input) {
|
|
209
|
+
export function validateProjectBlueprint(input, options = {}) {
|
|
212
210
|
const result = v.safeParse(projectBlueprintSchema, input);
|
|
213
211
|
if (!result.success) {
|
|
214
212
|
return { ok: false, issues: shapeIssues(result.issues) };
|
|
215
213
|
}
|
|
216
214
|
const blueprint = result.output;
|
|
217
|
-
const preset =
|
|
215
|
+
const preset = findPreset(options.presets ?? [], blueprint.preset);
|
|
218
216
|
const semanticIssues = [
|
|
219
217
|
...duplicateIssues(blueprint.features, "$.features"),
|
|
220
218
|
];
|
|
221
219
|
if (blueprint.projectKind === "single-package") {
|
|
222
220
|
semanticIssues.push(unsupportedSinglePackageProjectShapeIssue("$.projectKind"));
|
|
223
221
|
}
|
|
224
|
-
if (!preset) {
|
|
222
|
+
if (options.presets && !preset) {
|
|
225
223
|
semanticIssues.push({
|
|
226
224
|
path: "$.preset",
|
|
227
|
-
message: `Unknown built-in preset: ${blueprint.preset}`,
|
|
225
|
+
message: `Unknown ${options.presetLabel ?? "built-in"} preset: ${blueprint.preset}`,
|
|
228
226
|
});
|
|
229
227
|
}
|
|
230
|
-
else {
|
|
228
|
+
else if (preset) {
|
|
231
229
|
const unsupportedGeneration = generationSupportIssue(preset, "$.preset");
|
|
232
230
|
if (unsupportedGeneration) {
|
|
233
231
|
semanticIssues.push(unsupportedGeneration);
|
|
@@ -4,8 +4,10 @@ import { fileURLToPath } from "node:url";
|
|
|
4
4
|
function templateRepositoryRoot() {
|
|
5
5
|
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
6
6
|
const candidates = [
|
|
7
|
+
moduleDir,
|
|
7
8
|
path.resolve(moduleDir, ".."),
|
|
8
9
|
path.resolve(moduleDir, "..", ".."),
|
|
10
|
+
path.resolve(moduleDir, "..", "..", ".."),
|
|
9
11
|
];
|
|
10
12
|
return (candidates.find((candidate) => existsSync(path.join(candidate, "pnpm-workspace.yaml"))) ?? candidates[0]);
|
|
11
13
|
}
|
|
@@ -15,10 +15,12 @@ const defaultOxcConfigPaths = {
|
|
|
15
15
|
const declarations = loadEditorCustomizationDeclarations();
|
|
16
16
|
function editorCustomizationDeclarationPath() {
|
|
17
17
|
const moduleDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
18
|
-
const relativeDeclarationPath = "templates/shared/editor-customization/capabilities.json";
|
|
18
|
+
const relativeDeclarationPath = "builtin-source/templates/shared/editor-customization/capabilities.json";
|
|
19
19
|
const candidates = [
|
|
20
20
|
path.resolve(moduleDirectory, "..", relativeDeclarationPath),
|
|
21
21
|
path.resolve(moduleDirectory, "..", "..", relativeDeclarationPath),
|
|
22
|
+
path.resolve(moduleDirectory, "..", "..", "template-builtin-source", "templates", "shared", "editor-customization", "capabilities.json"),
|
|
23
|
+
path.resolve(moduleDirectory, "..", "..", "..", "packages", relativeDeclarationPath),
|
|
22
24
|
];
|
|
23
25
|
const declarationPath = candidates.find((candidate) => existsSync(candidate));
|
|
24
26
|
if (!declarationPath) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PresetSourceManifest } from "./preset-source.js";
|
|
2
|
+
import { type PresetProjectionSourceRoots } from "./projection-capabilities.js";
|
|
2
3
|
export type GeneratedScenarioSet = "init" | "package-addition-matrix";
|
|
3
4
|
export type GeneratedScenario = {
|
|
4
5
|
readonly set: GeneratedScenarioSet;
|
|
@@ -38,6 +39,7 @@ export type GeneratedScenarioReporter = {
|
|
|
38
39
|
export type GeneratedScenarioRunnerOptions = {
|
|
39
40
|
readonly repoRoot: string;
|
|
40
41
|
readonly cliPath: string;
|
|
42
|
+
readonly projectionSourceRoots: PresetProjectionSourceRoots;
|
|
41
43
|
readonly runCommand?: GeneratedScenarioCommandRunner;
|
|
42
44
|
readonly reporter?: GeneratedScenarioReporter;
|
|
43
45
|
readonly deterministicToolchainEnv?: Record<string, string>;
|
|
@@ -10,6 +10,12 @@ const defaultDeterministicToolchainEnv = {
|
|
|
10
10
|
TEMPLATE_TOOLCHAIN_RESOLUTION: "bundled-fallback",
|
|
11
11
|
};
|
|
12
12
|
const defaultFixtureConcurrency = 2;
|
|
13
|
+
function cliSourceExecutionEnv(options, env = {}) {
|
|
14
|
+
return {
|
|
15
|
+
...env,
|
|
16
|
+
TSX_TSCONFIG_PATH: path.join(options.repoRoot, "tsconfig.json"),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
13
19
|
export function createExclusiveLock() {
|
|
14
20
|
let tail = Promise.resolve();
|
|
15
21
|
return {
|
|
@@ -50,7 +56,7 @@ export function generatedScenarioLabel(scenario) {
|
|
|
50
56
|
}
|
|
51
57
|
return `${scenario.basePreset} + ${scenario.addedPreset}`;
|
|
52
58
|
}
|
|
53
|
-
function
|
|
59
|
+
function createGeneratedScenario(set, input) {
|
|
54
60
|
return {
|
|
55
61
|
set,
|
|
56
62
|
basePreset: input.basePreset,
|
|
@@ -65,11 +71,11 @@ export function selectGeneratedScenarios(manifest, set) {
|
|
|
65
71
|
if (!contract) {
|
|
66
72
|
throw new Error(`Preset Source ${manifest.name} does not declare a Fixture Matrix Contract`);
|
|
67
73
|
}
|
|
68
|
-
const initScenarios = contract.initSupport.map((support) =>
|
|
74
|
+
const initScenarios = contract.initSupport.map((support) => createGeneratedScenario(set, { basePreset: support.preset }));
|
|
69
75
|
if (set === "init") {
|
|
70
76
|
return { runnable: initScenarios, skipped: [] };
|
|
71
77
|
}
|
|
72
|
-
const matrixScenarios = contract.supportedCombinations.map((combination) =>
|
|
78
|
+
const matrixScenarios = contract.supportedCombinations.map((combination) => createGeneratedScenario(set, {
|
|
73
79
|
basePreset: combination.basePreset,
|
|
74
80
|
addedPreset: combination.addedPreset,
|
|
75
81
|
linkFrom: combination.linkFrom,
|
|
@@ -115,7 +121,7 @@ async function generateScenario(scenario, workspace, options) {
|
|
|
115
121
|
scenario.basePreset,
|
|
116
122
|
"--yes",
|
|
117
123
|
], options.repoRoot, {
|
|
118
|
-
env: options.deterministicToolchainEnv,
|
|
124
|
+
env: cliSourceExecutionEnv(options, options.deterministicToolchainEnv),
|
|
119
125
|
logPrefix: scenario.label,
|
|
120
126
|
});
|
|
121
127
|
return projectDir;
|
|
@@ -137,7 +143,10 @@ async function applyPackageAddition(manifest, scenario, projectDir, options) {
|
|
|
137
143
|
"--name",
|
|
138
144
|
packageLeafName,
|
|
139
145
|
...linkFromArgs(scenario.linkFrom ?? []),
|
|
140
|
-
], projectDir, {
|
|
146
|
+
], projectDir, {
|
|
147
|
+
env: cliSourceExecutionEnv(options),
|
|
148
|
+
logPrefix: scenario.label,
|
|
149
|
+
});
|
|
141
150
|
await assertLinkedConsumerSourcesUnchanged(projectDir, beforeConsumerSources);
|
|
142
151
|
return readAddedPackagePath(projectDir, packageLeafName);
|
|
143
152
|
}
|
|
@@ -193,6 +202,7 @@ function projectionPlanForPreset(presetName, projectDir, manifest, options, pack
|
|
|
193
202
|
});
|
|
194
203
|
return projectPresetSourcePreset({
|
|
195
204
|
preset,
|
|
205
|
+
sourceRoots: options.projectionSourceRoots,
|
|
196
206
|
context: assembleGenerationContext({
|
|
197
207
|
targetDir: projectDir,
|
|
198
208
|
blueprint,
|
|
@@ -312,6 +322,7 @@ function normalizeRunnerOptions(options) {
|
|
|
312
322
|
return {
|
|
313
323
|
repoRoot: options.repoRoot,
|
|
314
324
|
cliPath: options.cliPath,
|
|
325
|
+
projectionSourceRoots: options.projectionSourceRoots,
|
|
315
326
|
runCommand: options.runCommand ?? defaultGeneratedScenarioCommandRunner,
|
|
316
327
|
reporter: options.reporter ?? {
|
|
317
328
|
info: console.log,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PresetSourceManifest } from "./preset-source.js";
|
|
2
|
+
import { type PresetProjectionSourceRoots } from "./projection-capabilities.js";
|
|
3
|
+
export type AddPackageOptions = {
|
|
4
|
+
cwd: string;
|
|
5
|
+
preset: string;
|
|
6
|
+
name: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
linkFrom?: readonly string[];
|
|
9
|
+
presetSourceManifest: PresetSourceManifest;
|
|
10
|
+
projectionSourceRoots: PresetProjectionSourceRoots;
|
|
11
|
+
};
|
|
12
|
+
export declare function addPackage(options: AddPackageOptions): Promise<void>;
|
|
@@ -4,7 +4,7 @@ import { validateProjectBlueprint, } from "./declarations.js";
|
|
|
4
4
|
import { collectGeneratedManifestCatalogReferences, pnpmWorkspaceYamlWithCatalogDependencies, } from "./dependency-catalog.js";
|
|
5
5
|
import { PackageAdditionSupport } from "./package-addition-support.js";
|
|
6
6
|
import { assertTypeScriptPackageBoundaryForLinkIntent, packageTurboTasks, planPackageLinks, } from "./package-linking.js";
|
|
7
|
-
import {
|
|
7
|
+
import { findPresetSourceManifestPreset, } from "./preset-source.js";
|
|
8
8
|
import { defaultPackagePathForPresetSourcePackageAddition, planPresetSourcePackageAddition, } from "./projection-capabilities.js";
|
|
9
9
|
import { renderProject } from "./renderer.js";
|
|
10
10
|
function projectNameFromBlueprint(blueprint, fallbackProjectName) {
|
|
@@ -75,16 +75,16 @@ function validateExplicitPackagePath(packagePath) {
|
|
|
75
75
|
}
|
|
76
76
|
return packagePath;
|
|
77
77
|
}
|
|
78
|
-
function supportedPackageAdditionPresetNames() {
|
|
79
|
-
return
|
|
80
|
-
.
|
|
78
|
+
function supportedPackageAdditionPresetNames(manifest) {
|
|
79
|
+
return manifest.presets
|
|
80
|
+
.filter((preset) => preset.packageAdditionSupport === PackageAdditionSupport.Supported)
|
|
81
81
|
.map((preset) => preset.name);
|
|
82
82
|
}
|
|
83
|
-
function formatUnsupportedPackageAdditionPresetError(preset) {
|
|
83
|
+
function formatUnsupportedPackageAdditionPresetError(preset, manifest) {
|
|
84
84
|
return [
|
|
85
85
|
`Preset ${preset} cannot be used for Package Addition.`,
|
|
86
86
|
"It can still initialize a Generated Repository, but it cannot be added to an existing one.",
|
|
87
|
-
`Supported Package Addition presets: ${supportedPackageAdditionPresetNames().join(", ")}`,
|
|
87
|
+
`Supported Package Addition presets: ${supportedPackageAdditionPresetNames(manifest).join(", ")}`,
|
|
88
88
|
].join("\n");
|
|
89
89
|
}
|
|
90
90
|
function assertNoPackageConflict(blueprint, packageName, packagePath) {
|
|
@@ -228,7 +228,7 @@ async function readGeneratedWorkspaceBlueprint(root) {
|
|
|
228
228
|
catch (error) {
|
|
229
229
|
if (error instanceof SyntaxError ||
|
|
230
230
|
(isNodeError(error) && error.code === "ENOENT")) {
|
|
231
|
-
throw new Error("Package Addition requires a valid .template/blueprint.json");
|
|
231
|
+
throw new Error("Package Addition requires a valid .template/blueprint.json", { cause: error });
|
|
232
232
|
}
|
|
233
233
|
throw error;
|
|
234
234
|
}
|
|
@@ -622,18 +622,19 @@ export async function addPackage(options) {
|
|
|
622
622
|
const repositoryMetadata = await readGeneratedRepositoryPackageMetadata(root);
|
|
623
623
|
const projectName = projectNameFromBlueprint(blueprint, repositoryMetadata.projectName);
|
|
624
624
|
const packageName = `@${projectName}/${options.name}`;
|
|
625
|
-
const preset =
|
|
625
|
+
const preset = findPresetSourceManifestPreset(options.presetSourceManifest, options.preset);
|
|
626
626
|
if (!preset) {
|
|
627
627
|
throw new Error(`Unknown preset for Package Addition: ${options.preset}`);
|
|
628
628
|
}
|
|
629
629
|
if (preset.packageAdditionSupport !== PackageAdditionSupport.Supported) {
|
|
630
|
-
throw new Error(formatUnsupportedPackageAdditionPresetError(options.preset));
|
|
630
|
+
throw new Error(formatUnsupportedPackageAdditionPresetError(options.preset, options.presetSourceManifest));
|
|
631
631
|
}
|
|
632
632
|
const packagePath = options.path
|
|
633
633
|
? validateExplicitPackagePath(options.path)
|
|
634
|
-
: defaultPackagePathForPresetSourcePackageAddition(preset, options.name);
|
|
634
|
+
: defaultPackagePathForPresetSourcePackageAddition(preset, options.name, options.projectionSourceRoots);
|
|
635
635
|
const additionPlan = await planPresetSourcePackageAddition({
|
|
636
636
|
preset,
|
|
637
|
+
sourceRoots: options.projectionSourceRoots,
|
|
637
638
|
addition: {
|
|
638
639
|
root,
|
|
639
640
|
blueprint,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
packages:
|
|
2
|
-
-
|
|
2
|
+
- packages/*
|
|
3
3
|
|
|
4
4
|
catalog:
|
|
5
5
|
"@hono/node-server": ^2.0.6
|
|
@@ -10,6 +10,7 @@ catalog:
|
|
|
10
10
|
"@vitejs/plugin-vue": ^6.0.7
|
|
11
11
|
"@vue/tsconfig": ^0.9.1
|
|
12
12
|
"@vueuse/core": ^14.3.0
|
|
13
|
+
execa: ^9.6.1
|
|
13
14
|
hono: ^4.12.27
|
|
14
15
|
oxfmt: ^0.57.0
|
|
15
16
|
oxlint: ^1.72.0
|
|
@@ -24,6 +25,7 @@ catalog:
|
|
|
24
25
|
vitest: ^4.1.9
|
|
25
26
|
vue: ^3.5.39
|
|
26
27
|
vue-tsc: ^3.3.6
|
|
28
|
+
yaml: ^2.9.0
|
|
27
29
|
|
|
28
30
|
allowBuilds:
|
|
29
31
|
esbuild: true
|
|
@@ -229,7 +229,7 @@ export declare const presetSourceManifestJsonSchema: {
|
|
|
229
229
|
readonly features: {
|
|
230
230
|
readonly type: "array";
|
|
231
231
|
readonly items: {
|
|
232
|
-
readonly enum: ("
|
|
232
|
+
readonly enum: ("pnpm-catalog" | "oxc-format-lint" | "strict-typescript" | "root-check" | "fix-command" | "devcontainer" | "github-actions" | "dependabot" | "rustfmt-clippy" | "cargo-test" | "native-binary-release")[];
|
|
233
233
|
};
|
|
234
234
|
readonly uniqueItems: true;
|
|
235
235
|
};
|
|
@@ -425,6 +425,4 @@ export declare function validatePresetSourceManifest(input: unknown, options?: P
|
|
|
425
425
|
export declare function validateBuiltInPresetSourceManifest(input: unknown, options?: PresetSourceManifestValidationOptions): ValidationResult<PresetSourceManifest>;
|
|
426
426
|
export declare function manifestReferencedSourceFiles(manifest: PresetSourceManifest, sourceRoot: string): string[];
|
|
427
427
|
export declare function loadPresetSourceManifestFile(filePath: string): PresetSourceManifest;
|
|
428
|
-
export declare function loadBuiltInPresetSourceManifest(): PresetSourceManifest;
|
|
429
428
|
export declare function findPresetSourceManifestPreset(manifest: PresetSourceManifest, presetName: string): PresetSourceManifestPreset | undefined;
|
|
430
|
-
export declare function findBuiltInPresetSourceManifestPreset(presetName: string): PresetSourceManifestPreset | undefined;
|