@ykdz/template 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/dist/{src/cli.js → cli.js} +33 -21
  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 +96 -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 +240 -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 +224 -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 +372 -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 +59 -0
  19. package/{templates → node_modules/@ykdz/template-builtin-source/templates}/preset-source.json +14 -2
  20. package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/node/oxlint.config.ts +34 -0
  21. package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/tsconfig.config.json +20 -0
  22. package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/vue/oxlint.config.ts +36 -0
  23. package/node_modules/@ykdz/template-builtin-source/templates/vue-app/env.d.ts +8 -0
  24. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/env.d.ts +16 -0
  25. package/{dist/src → node_modules/@ykdz/template-core/dist}/declarations.d.ts +7 -4
  26. package/{dist/src → node_modules/@ykdz/template-core/dist}/declarations.js +45 -14
  27. package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.js +13 -6
  28. package/{dist/src → node_modules/@ykdz/template-core/dist}/devcontainer.d.ts +5 -5
  29. package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.js +23 -30
  30. package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.d.ts +6 -4
  31. package/{dist/src → node_modules/@ykdz/template-core/dist}/generated-scenarios.js +45 -14
  32. package/{dist/src → node_modules/@ykdz/template-core/dist}/generation-context.js +8 -3
  33. package/{dist/src → node_modules/@ykdz/template-core/dist}/next-step-instructions.js +3 -0
  34. package/node_modules/@ykdz/template-core/dist/package-addition.d.ts +12 -0
  35. package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition.js +33 -18
  36. package/{pnpm-workspace.yaml → node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml} +4 -1
  37. package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.d.ts +3 -3
  38. package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-projection.js +1 -0
  39. package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-source.d.ts +1 -3
  40. package/{dist/src → node_modules/@ykdz/template-core/dist}/preset-source.js +73 -74
  41. package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.d.ts +3 -3
  42. package/{dist/src → node_modules/@ykdz/template-core/dist}/project-github.js +1 -0
  43. package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.d.ts +17 -5
  44. package/{dist/src → node_modules/@ykdz/template-core/dist}/projection-capabilities.js +209 -169
  45. package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.d.ts +2 -2
  46. package/{dist/src → node_modules/@ykdz/template-core/dist}/renderer.js +14 -6
  47. package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.js +2 -0
  48. package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.d.ts +1 -1
  49. package/{dist/src → node_modules/@ykdz/template-core/dist}/template-boundary-check.js +8 -10
  50. package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.d.ts +5 -5
  51. package/{dist/src → node_modules/@ykdz/template-core/dist}/toolchain-resolution.js +10 -11
  52. package/node_modules/@ykdz/template-core/package.json +34 -0
  53. package/package.json +18 -31
  54. package/README.md +0 -35
  55. package/dist/src/package-addition.d.ts +0 -8
  56. package/templates/shared/oxc/node/oxlint.config.ts +0 -9
  57. package/templates/shared/oxc/vue/oxlint.config.ts +0 -9
  58. package/templates/vue-app/env.d.ts +0 -1
  59. package/templates/vue-hono-app/web/env.d.ts +0 -9
  60. /package/dist/{src/cli.d.ts → cli.d.ts} +0 -0
  61. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/.github/dependabot.yml +0 -0
  62. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/.github/workflows/check.yml +0 -0
  63. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/src/app.ts +0 -0
  64. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/src/server.ts +0 -0
  65. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/test/app.test.ts +0 -0
  66. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/hono-api/vitest.config.ts +0 -0
  67. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/.github/dependabot.yml +0 -0
  68. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/.github/workflows/check.yml +0 -0
  69. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/rust-toolchain.toml +0 -0
  70. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/rustfmt.toml +0 -0
  71. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/rust-bin/src/main.rs +0 -0
  72. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/browser-test.Dockerfile +0 -0
  73. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/node-pnpm.Dockerfile +0 -0
  74. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/devcontainer/rust.Dockerfile +0 -0
  75. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/editor-customization/capabilities.json +0 -0
  76. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/shared/oxc/oxfmt.config.ts +0 -0
  77. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/.github/dependabot.yml +0 -0
  78. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/.github/workflows/check.yml +0 -0
  79. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/src/index.ts +0 -0
  80. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/ts-lib/src/name-schema.ts +0 -0
  81. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/.github/dependabot.yml +0 -0
  82. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/.github/workflows/check.yml +0 -0
  83. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/index.html +0 -0
  84. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/playwright.config.ts +0 -0
  85. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/playwright.package-addition.config.ts +0 -0
  86. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/App.vue +0 -0
  87. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/main.ts +0 -0
  88. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/stores/counter.ts +0 -0
  89. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/src/style.css +0 -0
  90. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/test/app.test.ts +0 -0
  91. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/test/e2e/app.spec.ts +0 -0
  92. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/vite.config.ts +0 -0
  93. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-app/vitest.config.ts +0 -0
  94. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/.github/dependabot.yml +0 -0
  95. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/.github/workflows/check.yml +0 -0
  96. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/index.ts +0 -0
  97. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/runtime.ts +0 -0
  98. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/src/server.ts +0 -0
  99. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/test/app.test.ts +0 -0
  100. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/api/vitest.config.ts +0 -0
  101. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/index.html +0 -0
  102. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/playwright.config.ts +0 -0
  103. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/App.vue +0 -0
  104. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/api.ts +0 -0
  105. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/main.ts +0 -0
  106. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/stores/counter.ts +0 -0
  107. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/src/style.css +0 -0
  108. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/test/app.test.ts +0 -0
  109. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/test/e2e/app.spec.ts +0 -0
  110. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/vite.config.ts +0 -0
  111. /package/{templates → node_modules/@ykdz/template-builtin-source/templates}/vue-hono-app/web/vitest.config.ts +0 -0
  112. /package/{dist/src → node_modules/@ykdz/template-core/dist}/dependency-catalog.d.ts +0 -0
  113. /package/{dist/src → node_modules/@ykdz/template-core/dist}/devcontainer.js +0 -0
  114. /package/{dist/src → node_modules/@ykdz/template-core/dist}/editor-customization.d.ts +0 -0
  115. /package/{dist/src → node_modules/@ykdz/template-core/dist}/generation-context.d.ts +0 -0
  116. /package/{dist/src → node_modules/@ykdz/template-core/dist}/module-graph.d.ts +0 -0
  117. /package/{dist/src → node_modules/@ykdz/template-core/dist}/module-graph.js +0 -0
  118. /package/{dist/src → node_modules/@ykdz/template-core/dist}/next-step-instructions.d.ts +0 -0
  119. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition-support.d.ts +0 -0
  120. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-addition-support.js +0 -0
  121. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-linking.d.ts +0 -0
  122. /package/{dist/src → node_modules/@ykdz/template-core/dist}/package-linking.js +0 -0
  123. /package/{dist/src → node_modules/@ykdz/template-core/dist}/runtime-paths.d.ts +0 -0
@@ -0,0 +1,372 @@
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 .",
83
+ "lint:fix": "oxlint --config ../../oxlint.config.ts . --fix",
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
+ "oxlint-tsgolint": "catalog:",
182
+ tailwindcss: "catalog:",
183
+ typescript: "catalog:",
184
+ vite: "catalog:",
185
+ vitest: "catalog:",
186
+ "vue-tsc": "catalog:",
187
+ },
188
+ engines: {
189
+ node: nodeVersion,
190
+ },
191
+ },
192
+ },
193
+ {
194
+ kind: "writeJson",
195
+ to: `${packagePath}/tsconfig.json`,
196
+ value: {
197
+ files: [],
198
+ references: [
199
+ { path: "./tsconfig.app.json" },
200
+ { path: "./tsconfig.test.json" },
201
+ { path: "./tsconfig.node.json" },
202
+ ],
203
+ },
204
+ },
205
+ {
206
+ kind: "writeJson",
207
+ to: `${packagePath}/tsconfig.app.json`,
208
+ value: {
209
+ extends: "@vue/tsconfig/tsconfig.dom.json",
210
+ compilerOptions: {
211
+ composite: true,
212
+ erasableSyntaxOnly: true,
213
+ exactOptionalPropertyTypes: true,
214
+ forceConsistentCasingInFileNames: true,
215
+ isolatedModules: true,
216
+ module: "ESNext",
217
+ moduleResolution: "Bundler",
218
+ noEmitOnError: true,
219
+ noFallthroughCasesInSwitch: true,
220
+ noImplicitOverride: true,
221
+ noImplicitReturns: true,
222
+ noUncheckedIndexedAccess: true,
223
+ skipLibCheck: false,
224
+ strict: true,
225
+ target: "es2023",
226
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
227
+ types: ["web-bluetooth"],
228
+ verbatimModuleSyntax: true,
229
+ },
230
+ include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue"],
231
+ },
232
+ },
233
+ {
234
+ kind: "writeJson",
235
+ to: `${packagePath}/tsconfig.test.json`,
236
+ value: {
237
+ extends: "./tsconfig.app.json",
238
+ compilerOptions: {
239
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
240
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
241
+ types: ["node", "vitest/globals", "web-bluetooth"],
242
+ },
243
+ include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue", "test/**/*.ts"],
244
+ },
245
+ },
246
+ {
247
+ kind: "writeJson",
248
+ to: `${packagePath}/tsconfig.node.json`,
249
+ value: {
250
+ compilerOptions: {
251
+ composite: true,
252
+ erasableSyntaxOnly: true,
253
+ exactOptionalPropertyTypes: true,
254
+ forceConsistentCasingInFileNames: true,
255
+ isolatedModules: true,
256
+ module: "ESNext",
257
+ moduleResolution: "Bundler",
258
+ noEmitOnError: true,
259
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
260
+ noFallthroughCasesInSwitch: true,
261
+ noImplicitOverride: true,
262
+ noImplicitReturns: true,
263
+ noUncheckedIndexedAccess: true,
264
+ skipLibCheck: false,
265
+ strict: true,
266
+ target: "es2023",
267
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
268
+ types: ["node"],
269
+ verbatimModuleSyntax: true,
270
+ },
271
+ include: ["playwright.config.ts", "vite.config.ts", "vitest.config.ts"],
272
+ },
273
+ },
274
+ { kind: "copyFile", from: "env.d.ts", to: `${packagePath}/env.d.ts` },
275
+ { kind: "copyFile", from: "index.html", to: `${packagePath}/index.html` },
276
+ {
277
+ kind: "copyFile",
278
+ from: "playwright.config.ts",
279
+ to: `${packagePath}/playwright.config.ts`,
280
+ },
281
+ {
282
+ kind: "copyFile",
283
+ from: "vite.config.ts",
284
+ to: `${packagePath}/vite.config.ts`,
285
+ },
286
+ {
287
+ kind: "copyFile",
288
+ from: "vitest.config.ts",
289
+ to: `${packagePath}/vitest.config.ts`,
290
+ },
291
+ { kind: "copyFile", from: "src/App.vue", to: `${packagePath}/src/App.vue` },
292
+ { kind: "copyFile", from: "src/main.ts", to: `${packagePath}/src/main.ts` },
293
+ {
294
+ kind: "copyFile",
295
+ from: "src/style.css",
296
+ to: `${packagePath}/src/style.css`,
297
+ },
298
+ {
299
+ kind: "copyFile",
300
+ from: "src/stores/counter.ts",
301
+ to: `${packagePath}/src/stores/counter.ts`,
302
+ },
303
+ {
304
+ kind: "copyFile",
305
+ from: "test/app.test.ts",
306
+ to: `${packagePath}/test/app.test.ts`,
307
+ },
308
+ {
309
+ kind: "copyFile",
310
+ from: "test/e2e/app.spec.ts",
311
+ to: `${packagePath}/test/e2e/app.spec.ts`,
312
+ },
313
+ ];
314
+ }
315
+ async function packageAdditionPlan({ root, blueprint, packageName: packageNameValue, packagePath, nodeVersion, }) {
316
+ const [workspaceCollection] = packagePath.split("/");
317
+ const previewPort = await nextVuePreviewPort(root, blueprint);
318
+ return {
319
+ packagePath,
320
+ workspacePackageGlob: `${workspaceCollection}/*`,
321
+ packageRole: "runtime-service",
322
+ packageSourcePreset: "vue-app",
323
+ sourceRoot: templateSourceRoot(),
324
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
325
+ operations: packageAdditionOperations(packagePath, packageNameValue, nodeVersion),
326
+ textFiles: [
327
+ {
328
+ path: `${packagePath}/playwright.config.ts`,
329
+ text: vueAppPlaywrightConfig(previewPort),
330
+ },
331
+ ],
332
+ };
333
+ }
334
+ function templateSourceRoot() {
335
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
336
+ const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "vue-app");
337
+ return existsSync(path.join(publishedTemplateRoot, "src", "App.vue"))
338
+ ? publishedTemplateRoot
339
+ : projectionDir;
340
+ }
341
+ function sharedOxcSourceRoot() {
342
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
343
+ const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "oxc");
344
+ return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
345
+ ? publishedSharedRoot
346
+ : path.join(projectionDir, "..", "shared", "oxc");
347
+ }
348
+ export const vueAppPresetProjection = {
349
+ metadata: vueAppPresetMetadata,
350
+ capabilities: {
351
+ packageAddition: {
352
+ planPackageAddition: packageAdditionPlan,
353
+ },
354
+ },
355
+ blueprint: vueAppBlueprint,
356
+ project(context) {
357
+ return interpretPresetProjectionDeclaration({
358
+ preset: vueAppPresetMetadata,
359
+ declaration: loadBuiltInPresetProjectionDeclaration("vue-app"),
360
+ context,
361
+ sourceRoots: builtInPresetProjectionSourceRoots(),
362
+ });
363
+ },
364
+ async render({ targetDir, plan }) {
365
+ await renderNewProject({
366
+ sourceRoot: plan.sourceRoot,
367
+ sourceRoots: plan.sourceRoots,
368
+ targetRoot: targetDir,
369
+ operations: [...plan.operations],
370
+ });
371
+ },
372
+ };
@@ -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",
149
+ "lint:fix": "oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts --fix",
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 .",
162
+ "lint:fix": "oxlint --config ../../oxlint.config.ts . --fix",
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 .",
177
+ "lint:fix": "oxlint --config ../../oxlint.config.ts . --fix",
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,59 @@
1
+ {
2
+ "name": "@ykdz/template-builtin-source",
3
+ "version": "0.0.9",
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
+ "check:templates": "pnpm run check:templates:shared-oxc && pnpm run check:templates:static-source",
37
+ "check:templates:shared-oxc": "pnpm run check:templates:shared-oxc:format && pnpm run check:templates:shared-oxc:lint && pnpm run check:templates:shared-oxc:typecheck",
38
+ "check:templates:shared-oxc:format": "oxfmt --check templates/shared/oxc",
39
+ "check:templates:shared-oxc:lint": "oxlint --config templates/shared/oxc/node/oxlint.config.ts templates/shared/oxc",
40
+ "check:templates:shared-oxc:typecheck": "tsc -p templates/shared/oxc/tsconfig.json --noEmit",
41
+ "check:templates:static-source": "rustup run stable rustfmt --check templates/rust-bin/src/main.rs",
42
+ "format:check": "oxfmt --check --config ../../oxfmt.config.ts --ignore-path ../../.oxfmtignore .",
43
+ "format:write": "oxfmt --write --config ../../oxfmt.config.ts --ignore-path ../../.oxfmtignore .",
44
+ "lint": "oxlint --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts",
45
+ "lint:fix": "oxlint --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts --fix",
46
+ "typecheck": "tsc -p tsconfig.json --noEmit"
47
+ },
48
+ "dependencies": {
49
+ "@ykdz/template-core": "workspace:*",
50
+ "typescript": "catalog:",
51
+ "valibot": "catalog:"
52
+ },
53
+ "devDependencies": {
54
+ "@types/node": "catalog:",
55
+ "oxfmt": "catalog:",
56
+ "oxlint": "catalog:",
57
+ "oxlint-tsgolint": "catalog:"
58
+ }
59
+ }