@ykdz/template 0.0.6 → 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.
Files changed (118) hide show
  1. package/dist/{src/cli.js → cli.js} +101 -44
  2. package/node_modules/@ykdz/template-builtin-source/dist/src/index.d.ts +22 -0
  3. package/node_modules/@ykdz/template-builtin-source/dist/src/index.js +92 -0
  4. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.d.ts +6 -0
  5. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +230 -0
  6. package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.d.ts +7 -0
  7. package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.js +94 -0
  8. package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.d.ts +2 -0
  9. package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +15 -0
  10. package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.d.ts +9 -0
  11. package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.js +103 -0
  12. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.d.ts +6 -0
  13. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +214 -0
  14. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.d.ts +6 -0
  15. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +353 -0
  16. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.d.ts +8 -0
  17. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +203 -0
  18. package/node_modules/@ykdz/template-builtin-source/package.json +46 -0
  19. package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/node/oxlint.config.ts +3 -0
  20. package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/vue/oxlint.config.ts +3 -0
  21. package/{dist/src → node_modules/@ykdz/template-core/dist}/declarations.d.ts +7 -4
  22. package/{dist/src → node_modules/@ykdz/template-core/dist}/declarations.js +11 -13
  23. package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.js +2 -0
  24. package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.js +3 -1
  25. package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.d.ts +2 -0
  26. package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.js +16 -5
  27. package/node_modules/@ykdz/template-core/dist/package-addition.d.ts +12 -0
  28. package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition.js +11 -10
  29. package/{pnpm-workspace.yaml → node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml} +3 -1
  30. package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-source.d.ts +1 -3
  31. package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-source.js +13 -29
  32. package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.d.ts +10 -2
  33. package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.js +22 -49
  34. package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.js +12 -4
  35. package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.js +2 -0
  36. package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.js +1 -1
  37. package/node_modules/@ykdz/template-core/package.json +27 -0
  38. package/package.json +14 -34
  39. package/README.md +0 -35
  40. package/dist/src/package-addition.d.ts +0 -8
  41. /package/dist/{src/cli.d.ts → cli.d.ts} +0 -0
  42. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/.github/dependabot.yml +0 -0
  43. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/.github/workflows/check.yml +0 -0
  44. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/src/app.ts +0 -0
  45. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/src/server.ts +0 -0
  46. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/test/app.test.ts +0 -0
  47. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/vitest.config.ts +0 -0
  48. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/preset-source.json +0 -0
  49. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/.github/dependabot.yml +0 -0
  50. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/.github/workflows/check.yml +0 -0
  51. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/rust-toolchain.toml +0 -0
  52. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/rustfmt.toml +0 -0
  53. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/src/main.rs +0 -0
  54. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/browser-test.Dockerfile +0 -0
  55. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/node-pnpm.Dockerfile +0 -0
  56. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/rust.Dockerfile +0 -0
  57. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/editor-customization/capabilities.json +0 -0
  58. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/oxfmt.config.ts +0 -0
  59. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/.github/dependabot.yml +0 -0
  60. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/.github/workflows/check.yml +0 -0
  61. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/src/index.ts +0 -0
  62. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/src/name-schema.ts +0 -0
  63. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/.github/dependabot.yml +0 -0
  64. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/.github/workflows/check.yml +0 -0
  65. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/env.d.ts +0 -0
  66. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/index.html +0 -0
  67. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/playwright.config.ts +0 -0
  68. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/playwright.package-addition.config.ts +0 -0
  69. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/App.vue +0 -0
  70. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/main.ts +0 -0
  71. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/stores/counter.ts +0 -0
  72. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/style.css +0 -0
  73. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/test/app.test.ts +0 -0
  74. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/test/e2e/app.spec.ts +0 -0
  75. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/vite.config.ts +0 -0
  76. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/vitest.config.ts +0 -0
  77. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/.github/dependabot.yml +0 -0
  78. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/.github/workflows/check.yml +0 -0
  79. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/index.ts +0 -0
  80. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/runtime.ts +0 -0
  81. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/server.ts +0 -0
  82. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/test/app.test.ts +0 -0
  83. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/vitest.config.ts +0 -0
  84. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/env.d.ts +0 -0
  85. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/index.html +0 -0
  86. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/playwright.config.ts +0 -0
  87. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/App.vue +0 -0
  88. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/api.ts +0 -0
  89. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/main.ts +0 -0
  90. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/stores/counter.ts +0 -0
  91. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/style.css +0 -0
  92. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/test/app.test.ts +0 -0
  93. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/test/e2e/app.spec.ts +0 -0
  94. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/vite.config.ts +0 -0
  95. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/vitest.config.ts +0 -0
  96. /package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.d.ts +0 -0
  97. /package/{dist/src → node_modules/@ykdz/template-core/dist}/devcontainer.d.ts +0 -0
  98. /package/{dist/src → node_modules/@ykdz/template-core/dist}/devcontainer.js +0 -0
  99. /package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.d.ts +0 -0
  100. /package/{dist/src → node_modules/@ykdz/template-core/dist}/generation-context.d.ts +0 -0
  101. /package/{dist/src → node_modules/@ykdz/template-core/dist}/generation-context.js +0 -0
  102. /package/{dist/src → node_modules/@ykdz/template-core/dist}/module-graph.d.ts +0 -0
  103. /package/{dist/src → node_modules/@ykdz/template-core/dist}/module-graph.js +0 -0
  104. /package/{dist/src → node_modules/@ykdz/template-core/dist}/next-step-instructions.d.ts +0 -0
  105. /package/{dist/src → node_modules/@ykdz/template-core/dist}/next-step-instructions.js +0 -0
  106. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition-support.d.ts +0 -0
  107. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition-support.js +0 -0
  108. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-linking.d.ts +0 -0
  109. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-linking.js +0 -0
  110. /package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.d.ts +0 -0
  111. /package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.js +0 -0
  112. /package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.d.ts +0 -0
  113. /package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.js +0 -0
  114. /package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.d.ts +0 -0
  115. /package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.d.ts +0 -0
  116. /package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.d.ts +0 -0
  117. /package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.js +0 -0
  118. /package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.d.ts +0 -0
@@ -0,0 +1,353 @@
1
+ import { existsSync } from "node:fs";
2
+ import { readFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
6
+ import { renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
7
+ import { PackageAdditionSupport } from "@ykdz/template-core/package-addition-support";
8
+ import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
9
+ import { renderNewProject, } from "@ykdz/template-core/renderer";
10
+ export const vueAppPresetMetadata = {
11
+ name: "vue-app",
12
+ title: "Vue app",
13
+ description: "Vue app workspace with Vite, Tailwind, Pinia, and test tooling.",
14
+ generation: "supported",
15
+ supportedPackageManagers: ["pnpm"],
16
+ supportedProjectKinds: ["multi-package"],
17
+ packageAdditionSupport: PackageAdditionSupport.Supported,
18
+ features: [
19
+ "pnpm-catalog",
20
+ "oxc-format-lint",
21
+ "strict-typescript",
22
+ "root-check",
23
+ "fix-command",
24
+ "devcontainer",
25
+ "github-actions",
26
+ "dependabot",
27
+ ],
28
+ };
29
+ const webPackageBoundary = {
30
+ kind: "package-boundary",
31
+ path: ".",
32
+ };
33
+ function planVueAppPackageChecks() {
34
+ return {
35
+ components: [
36
+ { kind: "oxc-format-check", owner: webPackageBoundary },
37
+ { kind: "oxc-lint", owner: webPackageBoundary },
38
+ { kind: "typescript-typecheck", owner: webPackageBoundary },
39
+ { kind: "build", owner: webPackageBoundary },
40
+ { kind: "unit-test", owner: webPackageBoundary },
41
+ { kind: "e2e-test", owner: webPackageBoundary },
42
+ ],
43
+ environmentNeeds: [],
44
+ };
45
+ }
46
+ function planVueAppPackageFixes() {
47
+ return {
48
+ components: [
49
+ { kind: "oxc-format-write", owner: webPackageBoundary },
50
+ { kind: "oxc-lint-fix", owner: webPackageBoundary },
51
+ ],
52
+ };
53
+ }
54
+ function projectNameFromDir(targetDir) {
55
+ return path.basename(path.resolve(targetDir));
56
+ }
57
+ function packageScopeFromOptions(options) {
58
+ return options.scope ?? projectNameFromDir(options.targetDir);
59
+ }
60
+ function scopedPackageName(packageScope) {
61
+ return `@${packageScope}/web`;
62
+ }
63
+ export function vueAppBlueprint(options = { targetDir: process.cwd() }) {
64
+ const packageScope = packageScopeFromOptions(options);
65
+ return {
66
+ schemaVersion: 1,
67
+ preset: "vue-app",
68
+ packageManager: "pnpm",
69
+ projectKind: "multi-package",
70
+ features: [...vueAppPresetMetadata.features],
71
+ packages: [{ name: scopedPackageName(packageScope), path: "apps/web" }],
72
+ };
73
+ }
74
+ export function projectVueAppPackageScripts() {
75
+ return {
76
+ build: "vite build",
77
+ check: renderRootCheckCommand(planVueAppPackageChecks()),
78
+ dev: "vite",
79
+ fix: renderFixCommand(planVueAppPackageFixes()),
80
+ "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
81
+ "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
82
+ lint: "oxlint --config ../../oxlint.config.ts . --deny-warnings",
83
+ "lint:fix": "oxlint --config ../../oxlint.config.ts . --fix --deny-warnings",
84
+ preview: "vite preview",
85
+ test: "vitest run",
86
+ "test:e2e": "pnpm run build && playwright test",
87
+ typecheck: "vue-tsc --build --noEmit",
88
+ };
89
+ }
90
+ function isNodeError(error) {
91
+ return error instanceof Error && "code" in error;
92
+ }
93
+ function localPortsFromText(text) {
94
+ return [
95
+ ...text.matchAll(/port:\s*(\d+)/g),
96
+ ...text.matchAll(/--port\s+(\d+)/g),
97
+ ...text.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1):(\d+)/g),
98
+ ].map((match) => Number(match[1]));
99
+ }
100
+ async function usedPlaywrightPorts(root, blueprint) {
101
+ const ports = new Set();
102
+ for (const projectPackage of blueprint.packages ?? []) {
103
+ try {
104
+ const configText = await readFile(path.join(root, projectPackage.path, "playwright.config.ts"), "utf8");
105
+ for (const port of localPortsFromText(configText)) {
106
+ ports.add(port);
107
+ }
108
+ }
109
+ catch (error) {
110
+ if (!isNodeError(error) || error.code !== "ENOENT") {
111
+ throw error;
112
+ }
113
+ }
114
+ }
115
+ return ports;
116
+ }
117
+ async function nextVuePreviewPort(root, blueprint) {
118
+ const usedPorts = await usedPlaywrightPorts(root, blueprint);
119
+ let port = 4173;
120
+ while (usedPorts.has(port)) {
121
+ port += 1;
122
+ }
123
+ return port;
124
+ }
125
+ function vueAppPlaywrightConfig(previewPort) {
126
+ return `import { defineConfig, devices } from "@playwright/test";
127
+
128
+ const previewUrl = "http://127.0.0.1:${previewPort}";
129
+
130
+ export default defineConfig({
131
+ testDir: "./test/e2e",
132
+ use: {
133
+ baseURL: previewUrl,
134
+ trace: "on-first-retry"
135
+ },
136
+ webServer: {
137
+ command: "pnpm run preview --host 127.0.0.1 --port ${previewPort}",
138
+ reuseExistingServer: !process.env.CI,
139
+ url: previewUrl
140
+ },
141
+ projects: [
142
+ {
143
+ name: "chromium",
144
+ use: { ...devices["Desktop Chrome"] }
145
+ }
146
+ ]
147
+ });
148
+ `;
149
+ }
150
+ function packageAdditionOperations(packagePath, packageNameValue, nodeVersion) {
151
+ return [
152
+ {
153
+ kind: "writeJson",
154
+ to: `${packagePath}/package.json`,
155
+ value: {
156
+ name: packageNameValue,
157
+ version: "0.0.0",
158
+ private: true,
159
+ type: "module",
160
+ imports: {
161
+ "#/*": {
162
+ default: "./src/*.ts",
163
+ types: "./src/*.ts",
164
+ },
165
+ },
166
+ scripts: projectVueAppPackageScripts(),
167
+ dependencies: {
168
+ "@vueuse/core": "catalog:",
169
+ pinia: "catalog:",
170
+ vue: "catalog:",
171
+ },
172
+ devDependencies: {
173
+ "@playwright/test": "catalog:",
174
+ "@tailwindcss/vite": "catalog:",
175
+ "@types/node": "catalog:",
176
+ "@types/web-bluetooth": "catalog:",
177
+ "@vitejs/plugin-vue": "catalog:",
178
+ "@vue/tsconfig": "catalog:",
179
+ oxfmt: "catalog:",
180
+ oxlint: "catalog:",
181
+ tailwindcss: "catalog:",
182
+ typescript: "catalog:",
183
+ vite: "catalog:",
184
+ vitest: "catalog:",
185
+ "vue-tsc": "catalog:",
186
+ },
187
+ engines: {
188
+ node: nodeVersion,
189
+ },
190
+ },
191
+ },
192
+ {
193
+ kind: "writeJson",
194
+ to: `${packagePath}/tsconfig.json`,
195
+ value: {
196
+ files: [],
197
+ references: [
198
+ { path: "./tsconfig.app.json" },
199
+ { path: "./tsconfig.test.json" },
200
+ { path: "./tsconfig.node.json" },
201
+ ],
202
+ },
203
+ },
204
+ {
205
+ kind: "writeJson",
206
+ to: `${packagePath}/tsconfig.app.json`,
207
+ value: {
208
+ extends: "@vue/tsconfig/tsconfig.dom.json",
209
+ compilerOptions: {
210
+ composite: true,
211
+ module: "ESNext",
212
+ moduleResolution: "Bundler",
213
+ noEmitOnError: true,
214
+ skipLibCheck: false,
215
+ strict: true,
216
+ target: "ES2022",
217
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
218
+ types: ["web-bluetooth"],
219
+ },
220
+ include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue"],
221
+ },
222
+ },
223
+ {
224
+ kind: "writeJson",
225
+ to: `${packagePath}/tsconfig.test.json`,
226
+ value: {
227
+ extends: "./tsconfig.app.json",
228
+ compilerOptions: {
229
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
230
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
231
+ types: ["node", "vitest/globals", "web-bluetooth"],
232
+ },
233
+ include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue", "test/**/*.ts"],
234
+ },
235
+ },
236
+ {
237
+ kind: "writeJson",
238
+ to: `${packagePath}/tsconfig.node.json`,
239
+ value: {
240
+ compilerOptions: {
241
+ composite: true,
242
+ module: "ESNext",
243
+ moduleResolution: "Bundler",
244
+ noEmitOnError: true,
245
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
246
+ skipLibCheck: false,
247
+ strict: true,
248
+ target: "ES2022",
249
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
250
+ types: ["node"],
251
+ },
252
+ include: ["playwright.config.ts", "vite.config.ts", "vitest.config.ts"],
253
+ },
254
+ },
255
+ { kind: "copyFile", from: "env.d.ts", to: `${packagePath}/env.d.ts` },
256
+ { kind: "copyFile", from: "index.html", to: `${packagePath}/index.html` },
257
+ {
258
+ kind: "copyFile",
259
+ from: "playwright.config.ts",
260
+ to: `${packagePath}/playwright.config.ts`,
261
+ },
262
+ {
263
+ kind: "copyFile",
264
+ from: "vite.config.ts",
265
+ to: `${packagePath}/vite.config.ts`,
266
+ },
267
+ {
268
+ kind: "copyFile",
269
+ from: "vitest.config.ts",
270
+ to: `${packagePath}/vitest.config.ts`,
271
+ },
272
+ { kind: "copyFile", from: "src/App.vue", to: `${packagePath}/src/App.vue` },
273
+ { kind: "copyFile", from: "src/main.ts", to: `${packagePath}/src/main.ts` },
274
+ {
275
+ kind: "copyFile",
276
+ from: "src/style.css",
277
+ to: `${packagePath}/src/style.css`,
278
+ },
279
+ {
280
+ kind: "copyFile",
281
+ from: "src/stores/counter.ts",
282
+ to: `${packagePath}/src/stores/counter.ts`,
283
+ },
284
+ {
285
+ kind: "copyFile",
286
+ from: "test/app.test.ts",
287
+ to: `${packagePath}/test/app.test.ts`,
288
+ },
289
+ {
290
+ kind: "copyFile",
291
+ from: "test/e2e/app.spec.ts",
292
+ to: `${packagePath}/test/e2e/app.spec.ts`,
293
+ },
294
+ ];
295
+ }
296
+ async function packageAdditionPlan({ root, blueprint, packageName: packageNameValue, packagePath, nodeVersion, }) {
297
+ const [workspaceCollection] = packagePath.split("/");
298
+ const previewPort = await nextVuePreviewPort(root, blueprint);
299
+ return {
300
+ packagePath,
301
+ workspacePackageGlob: `${workspaceCollection}/*`,
302
+ packageRole: "runtime-service",
303
+ packageSourcePreset: "vue-app",
304
+ sourceRoot: templateSourceRoot(),
305
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
306
+ operations: packageAdditionOperations(packagePath, packageNameValue, nodeVersion),
307
+ textFiles: [
308
+ {
309
+ path: `${packagePath}/playwright.config.ts`,
310
+ text: vueAppPlaywrightConfig(previewPort),
311
+ },
312
+ ],
313
+ };
314
+ }
315
+ function templateSourceRoot() {
316
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
317
+ const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "vue-app");
318
+ return existsSync(path.join(publishedTemplateRoot, "src", "App.vue"))
319
+ ? publishedTemplateRoot
320
+ : projectionDir;
321
+ }
322
+ function sharedOxcSourceRoot() {
323
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
324
+ const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "oxc");
325
+ return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
326
+ ? publishedSharedRoot
327
+ : path.join(projectionDir, "..", "shared", "oxc");
328
+ }
329
+ export const vueAppPresetProjection = {
330
+ metadata: vueAppPresetMetadata,
331
+ capabilities: {
332
+ packageAddition: {
333
+ planPackageAddition: packageAdditionPlan,
334
+ },
335
+ },
336
+ blueprint: vueAppBlueprint,
337
+ project(context) {
338
+ return interpretPresetProjectionDeclaration({
339
+ preset: vueAppPresetMetadata,
340
+ declaration: loadBuiltInPresetProjectionDeclaration("vue-app"),
341
+ context,
342
+ sourceRoots: builtInPresetProjectionSourceRoots(),
343
+ });
344
+ },
345
+ async render({ targetDir, plan }) {
346
+ await renderNewProject({
347
+ sourceRoot: plan.sourceRoot,
348
+ sourceRoots: plan.sourceRoots,
349
+ targetRoot: targetDir,
350
+ operations: [...plan.operations],
351
+ });
352
+ },
353
+ };
@@ -0,0 +1,8 @@
1
+ import type { BuiltInPreset, ProjectBlueprint } from "@ykdz/template-core/declarations";
2
+ import type { PresetBlueprintOptions, PresetProjection } from "@ykdz/template-core/preset-projection";
3
+ export declare const vueHonoAppPresetMetadata: BuiltInPreset;
4
+ export declare function vueHonoAppBlueprint(options: PresetBlueprintOptions): ProjectBlueprint;
5
+ export declare function projectVueHonoRootPackageScripts(): Record<string, string>;
6
+ export declare function projectVueHonoApiPackageScripts(): Record<string, string>;
7
+ export declare function projectVueHonoWebPackageScripts(): Record<string, string>;
8
+ export declare const vueHonoAppPresetProjection: PresetProjection;
@@ -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
+ }
@@ -6,4 +6,7 @@ export default defineConfig({
6
6
  suspicious: "error",
7
7
  },
8
8
  plugins: ["typescript", "oxc"],
9
+ rules: {
10
+ "no-unused-vars": "error",
11
+ },
9
12
  });
@@ -6,4 +6,7 @@ export default defineConfig({
6
6
  suspicious: "error",
7
7
  },
8
8
  plugins: ["typescript", "oxc", "vue"],
9
+ rules: {
10
+ "no-unused-vars": "error",
11
+ },
9
12
  });
@@ -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 declare function validatePresetFile(input: unknown): ValidationResult<PresetFile>;
199
- export declare function findBuiltInPreset(name: string): BuiltInPreset | undefined;
200
- export declare function validateProjectBlueprint(input: unknown): ValidationResult<ProjectBlueprint>;
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>;