@ykdz/template 0.0.2 → 0.0.4

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 (95) hide show
  1. package/README.md +1 -1
  2. package/dist/src/cli.d.ts +2 -0
  3. package/dist/{cli.js → src/cli.js} +91 -58
  4. package/dist/{declarations.d.ts → src/declarations.d.ts} +3 -5
  5. package/dist/{declarations.js → src/declarations.js} +48 -145
  6. package/dist/src/dependency-catalog.d.ts +18 -0
  7. package/dist/src/dependency-catalog.js +132 -0
  8. package/dist/src/devcontainer.d.ts +58 -0
  9. package/dist/src/devcontainer.js +202 -0
  10. package/dist/src/editor-customization.d.ts +12 -0
  11. package/dist/src/editor-customization.js +108 -0
  12. package/dist/{generation-context.d.ts → src/generation-context.d.ts} +2 -3
  13. package/dist/{generation-context.js → src/generation-context.js} +4 -1
  14. package/dist/src/module-graph.d.ts +34 -0
  15. package/dist/src/module-graph.js +58 -0
  16. package/dist/{next-step-instructions.d.ts → src/next-step-instructions.d.ts} +2 -4
  17. package/dist/{next-step-instructions.js → src/next-step-instructions.js} +49 -24
  18. package/dist/{package-addition.d.ts → src/package-addition.d.ts} +1 -1
  19. package/dist/src/package-addition.js +343 -0
  20. package/dist/src/preset-projection.d.ts +66 -0
  21. package/dist/src/preset-projection.js +7 -0
  22. package/dist/{project-github.d.ts → src/project-github.d.ts} +3 -9
  23. package/dist/{project-github.js → src/project-github.js} +27 -42
  24. package/dist/{renderer.d.ts → src/renderer.d.ts} +16 -2
  25. package/dist/{renderer.js → src/renderer.js} +95 -12
  26. package/dist/src/runtime-paths.d.ts +1 -0
  27. package/dist/src/runtime-paths.js +11 -0
  28. package/dist/src/template-boundary-check.d.ts +34 -0
  29. package/dist/src/template-boundary-check.js +448 -0
  30. package/dist/{toolchain-resolution.d.ts → src/toolchain-resolution.d.ts} +0 -1
  31. package/dist/{toolchain-resolution.js → src/toolchain-resolution.js} +1 -1
  32. package/dist/templates/hono-api/projection.d.ts +6 -0
  33. package/dist/templates/hono-api/projection.js +538 -0
  34. package/dist/templates/projection-plans.d.ts +7 -0
  35. package/dist/templates/projection-plans.js +94 -0
  36. package/dist/templates/registry.d.ts +7 -0
  37. package/dist/templates/registry.js +42 -0
  38. package/dist/templates/rust-bin/projection.d.ts +9 -0
  39. package/dist/templates/rust-bin/projection.js +390 -0
  40. package/dist/templates/ts-lib/projection.d.ts +6 -0
  41. package/dist/templates/ts-lib/projection.js +523 -0
  42. package/dist/templates/vue-app/projection.d.ts +6 -0
  43. package/dist/templates/vue-app/projection.js +757 -0
  44. package/dist/templates/vue-hono-app/projection.d.ts +8 -0
  45. package/dist/templates/vue-hono-app/projection.js +693 -0
  46. package/package.json +38 -28
  47. package/pnpm-workspace.yaml +35 -0
  48. package/templates/hono-api/.github/dependabot.yml +13 -0
  49. package/templates/rust-bin/.github/dependabot.yml +18 -1
  50. package/templates/rust-bin/rust-toolchain.toml +3 -0
  51. package/templates/rust-bin/rustfmt.toml +2 -0
  52. package/templates/shared/devcontainer/browser-test.Dockerfile +2 -0
  53. package/templates/shared/devcontainer/node-pnpm.Dockerfile +6 -0
  54. package/templates/shared/devcontainer/rust.Dockerfile +16 -0
  55. package/templates/shared/editor-customization/capabilities.json +56 -0
  56. package/templates/ts-lib/.github/dependabot.yml +13 -0
  57. package/templates/ts-lib/src/index.ts +5 -1
  58. package/templates/vue-app/.github/dependabot.yml +13 -0
  59. package/templates/vue-app/.github/workflows/check.yml +1 -1
  60. package/templates/vue-app/test/e2e/app.spec.ts +4 -1
  61. package/templates/vue-hono-app/.github/dependabot.yml +13 -0
  62. package/templates/vue-hono-app/web/test/e2e/app.spec.ts +4 -1
  63. package/dist/cli.d.ts +0 -3
  64. package/dist/cli.d.ts.map +0 -1
  65. package/dist/declarations.d.ts.map +0 -1
  66. package/dist/devcontainer.d.ts +0 -17
  67. package/dist/devcontainer.d.ts.map +0 -1
  68. package/dist/devcontainer.js +0 -23
  69. package/dist/generation-context.d.ts.map +0 -1
  70. package/dist/hono-api.d.ts +0 -3
  71. package/dist/hono-api.d.ts.map +0 -1
  72. package/dist/hono-api.js +0 -210
  73. package/dist/module-graph.d.ts +0 -45
  74. package/dist/module-graph.d.ts.map +0 -1
  75. package/dist/module-graph.js +0 -187
  76. package/dist/next-step-instructions.d.ts.map +0 -1
  77. package/dist/package-addition.d.ts.map +0 -1
  78. package/dist/package-addition.js +0 -560
  79. package/dist/project-github.d.ts.map +0 -1
  80. package/dist/renderer.d.ts.map +0 -1
  81. package/dist/rust-bin.d.ts +0 -8
  82. package/dist/rust-bin.d.ts.map +0 -1
  83. package/dist/rust-bin.js +0 -208
  84. package/dist/toolchain-resolution.d.ts.map +0 -1
  85. package/dist/ts-lib.d.ts +0 -8
  86. package/dist/ts-lib.d.ts.map +0 -1
  87. package/dist/ts-lib.js +0 -214
  88. package/dist/vue-app.d.ts +0 -3
  89. package/dist/vue-app.d.ts.map +0 -1
  90. package/dist/vue-app.js +0 -301
  91. package/dist/vue-hono-app.d.ts +0 -7
  92. package/dist/vue-hono-app.d.ts.map +0 -1
  93. package/dist/vue-hono-app.js +0 -440
  94. package/templates/shared/oxc/package.json +0 -18
  95. package/templates/shared/oxc/tsconfig.json +0 -11
@@ -0,0 +1,8 @@
1
+ import type { BuiltInPreset, ProjectBlueprint } from "../../src/declarations.js";
2
+ import type { PresetBlueprintOptions, PresetProjection } from "../../src/preset-projection.js";
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,693 @@
1
+ import { existsSync } from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { collectGeneratedManifestCatalogReferences, renderGeneratedPnpmWorkspaceYaml, } from "../../src/dependency-catalog.js";
5
+ import { browserTestToolLayer, checkedDockerfileFirstNodePnpmDevcontainer, nodePnpmToolLayer, } from "../../src/devcontainer.js";
6
+ import { editorCustomizationForCapabilities } from "../../src/editor-customization.js";
7
+ import { renderFixCommand, renderRootCheckCommand, } from "../../src/module-graph.js";
8
+ import { renderNewProject } from "../../src/renderer.js";
9
+ const generatedBy = {
10
+ packageName: "@ykdz/template",
11
+ version: "0.0.0",
12
+ command: "template init --preset vue-hono-app",
13
+ };
14
+ export const vueHonoAppPresetMetadata = {
15
+ name: "vue-hono-app",
16
+ title: "Vue Hono app",
17
+ description: "Full-stack Vue and Hono workspace with Hono RPC typing.",
18
+ generation: "supported",
19
+ supportedPackageManagers: ["pnpm"],
20
+ supportedProjectKinds: ["multi-package"],
21
+ features: [
22
+ "pnpm-catalog",
23
+ "oxc-format-lint",
24
+ "strict-typescript",
25
+ "root-check",
26
+ "fix-command",
27
+ "devcontainer",
28
+ "github-actions",
29
+ "dependabot",
30
+ ],
31
+ };
32
+ const dependencyMaintenancePolicy = {
33
+ ecosystems: ["npm", "github-actions", "docker"],
34
+ interval: "weekly",
35
+ };
36
+ const rootBoundary = {
37
+ kind: "workspace-orchestration",
38
+ path: ".",
39
+ };
40
+ const apiPackageBoundary = {
41
+ kind: "package-boundary",
42
+ path: ".",
43
+ };
44
+ const webPackageBoundary = {
45
+ kind: "package-boundary",
46
+ path: ".",
47
+ };
48
+ const workspacePackageBoundary = {
49
+ kind: "package-boundary",
50
+ path: "apps/*",
51
+ };
52
+ const webWorkspaceBoundary = {
53
+ kind: "package-boundary",
54
+ path: "apps/web",
55
+ };
56
+ function honoApiCheckComponents(owner) {
57
+ return [
58
+ { kind: "oxc-format-check", owner },
59
+ { kind: "oxc-lint", owner },
60
+ { kind: "typescript-typecheck", owner },
61
+ { kind: "build", owner },
62
+ { kind: "unit-test", owner },
63
+ ];
64
+ }
65
+ function vueWebCheckComponents(owner) {
66
+ return [
67
+ { kind: "oxc-format-check", owner },
68
+ { kind: "oxc-lint", owner },
69
+ { kind: "typescript-typecheck", owner },
70
+ { kind: "build", owner },
71
+ { kind: "unit-test", owner },
72
+ { kind: "e2e-test", owner },
73
+ ];
74
+ }
75
+ function nodeFixComponents(owner) {
76
+ return [
77
+ { kind: "oxc-format-write", owner },
78
+ { kind: "oxc-lint-fix", owner },
79
+ ];
80
+ }
81
+ function planVueHonoRootChecks() {
82
+ return {
83
+ components: [
84
+ { kind: "oxc-format-check", owner: rootBoundary },
85
+ { kind: "oxc-lint", owner: rootBoundary },
86
+ { kind: "typescript-typecheck", owner: rootBoundary },
87
+ { kind: "turbo-package-check", owner: workspacePackageBoundary },
88
+ ],
89
+ environmentNeeds: [
90
+ {
91
+ kind: "playwright-browser-assets",
92
+ browser: "chromium",
93
+ owner: webWorkspaceBoundary,
94
+ },
95
+ ],
96
+ };
97
+ }
98
+ function planVueHonoRootFixes() {
99
+ return {
100
+ components: [
101
+ { kind: "oxc-format-write", owner: rootBoundary },
102
+ { kind: "oxc-lint-fix", owner: rootBoundary },
103
+ { kind: "turbo-package-fix", owner: workspacePackageBoundary },
104
+ ],
105
+ };
106
+ }
107
+ function planVueHonoApiChecks() {
108
+ return {
109
+ components: [...honoApiCheckComponents(apiPackageBoundary)],
110
+ environmentNeeds: [],
111
+ };
112
+ }
113
+ function planVueHonoWebChecks() {
114
+ return {
115
+ components: [...vueWebCheckComponents(webPackageBoundary)],
116
+ environmentNeeds: [],
117
+ };
118
+ }
119
+ function planVueHonoPackageFixes(owner) {
120
+ return {
121
+ components: [...nodeFixComponents(owner)],
122
+ };
123
+ }
124
+ function projectNameFromDir(targetDir) {
125
+ return path.basename(path.resolve(targetDir));
126
+ }
127
+ function packageScopeFromOptions(options) {
128
+ return options.scope ?? projectNameFromDir(options.targetDir);
129
+ }
130
+ function packageName(packageScope, leaf) {
131
+ return `@${packageScope}/${leaf}`;
132
+ }
133
+ export function vueHonoAppBlueprint(options) {
134
+ const packageScope = packageScopeFromOptions(options);
135
+ return {
136
+ schemaVersion: 1,
137
+ preset: "vue-hono-app",
138
+ packageManager: "pnpm",
139
+ projectKind: "multi-package",
140
+ features: [...vueHonoAppPresetMetadata.features],
141
+ packages: [
142
+ { name: packageName(packageScope, "web"), path: "apps/web" },
143
+ { name: packageName(packageScope, "api"), path: "apps/api" },
144
+ ],
145
+ };
146
+ }
147
+ export function projectVueHonoRootPackageScripts() {
148
+ return {
149
+ check: renderRootCheckCommand(planVueHonoRootChecks()),
150
+ dev: "turbo run dev --parallel",
151
+ fix: renderFixCommand(planVueHonoRootFixes()),
152
+ "format:check": "oxfmt --check --config oxfmt.config.ts oxlint.config.ts oxfmt.config.ts",
153
+ "format:write": "oxfmt --write --config oxfmt.config.ts oxlint.config.ts oxfmt.config.ts",
154
+ lint: "oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts --deny-warnings",
155
+ "lint:fix": "oxlint --config oxlint.config.ts oxlint.config.ts oxfmt.config.ts --fix --deny-warnings",
156
+ typecheck: "tsc -p tsconfig.config.json --noEmit",
157
+ };
158
+ }
159
+ export function projectVueHonoApiPackageScripts() {
160
+ return {
161
+ build: "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
162
+ check: renderRootCheckCommand(planVueHonoApiChecks()),
163
+ dev: "tsx watch src/server.ts",
164
+ fix: renderFixCommand(planVueHonoPackageFixes(apiPackageBoundary)),
165
+ "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
166
+ "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
167
+ lint: "oxlint --config ../../oxlint.config.ts . --deny-warnings",
168
+ "lint:fix": "oxlint --config ../../oxlint.config.ts . --fix --deny-warnings",
169
+ start: "node dist/server.js",
170
+ test: "vitest run",
171
+ typecheck: "tsc -p tsconfig.json --noEmit",
172
+ };
173
+ }
174
+ export function projectVueHonoWebPackageScripts() {
175
+ return {
176
+ build: "vite build",
177
+ check: renderRootCheckCommand(planVueHonoWebChecks()),
178
+ dev: "vite",
179
+ fix: renderFixCommand(planVueHonoPackageFixes(webPackageBoundary)),
180
+ "format:check": "oxfmt --check --config ../../oxfmt.config.ts .",
181
+ "format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
182
+ lint: "oxlint --config ../../oxlint.config.ts . --deny-warnings",
183
+ "lint:fix": "oxlint --config ../../oxlint.config.ts . --fix --deny-warnings",
184
+ preview: "vite preview",
185
+ test: "vitest run",
186
+ "test:e2e": "pnpm run build && playwright test",
187
+ typecheck: "vue-tsc --build",
188
+ };
189
+ }
190
+ function rootPackageJson(context, packageScripts) {
191
+ return {
192
+ name: context.projectName.value,
193
+ version: "0.0.0",
194
+ private: true,
195
+ type: "module",
196
+ scripts: packageScripts,
197
+ devDependencies: {
198
+ oxfmt: "catalog:",
199
+ oxlint: "catalog:",
200
+ turbo: "catalog:",
201
+ typescript: "catalog:",
202
+ },
203
+ engines: {
204
+ node: context.toolchain.nodeLtsMajor.value,
205
+ },
206
+ packageManager: context.toolchain.packageManagerPin.value,
207
+ };
208
+ }
209
+ function apiPackageJson(context, packageScope) {
210
+ return {
211
+ name: packageName(packageScope, "api"),
212
+ version: "0.0.0",
213
+ private: true,
214
+ type: "module",
215
+ types: "./dist/index.d.ts",
216
+ exports: {
217
+ ".": "./dist/index.js",
218
+ },
219
+ scripts: projectVueHonoApiPackageScripts(),
220
+ dependencies: {
221
+ "@hono/node-server": "catalog:",
222
+ hono: "catalog:",
223
+ },
224
+ devDependencies: {
225
+ "@types/node": "catalog:",
226
+ oxfmt: "catalog:",
227
+ oxlint: "catalog:",
228
+ "tsc-alias": "catalog:",
229
+ tsx: "catalog:",
230
+ typescript: "catalog:",
231
+ vitest: "catalog:",
232
+ },
233
+ engines: {
234
+ node: context.toolchain.nodeLtsMajor.value,
235
+ },
236
+ };
237
+ }
238
+ function webPackageJson(context, packageScope) {
239
+ return {
240
+ name: packageName(packageScope, "web"),
241
+ version: "0.0.0",
242
+ private: true,
243
+ type: "module",
244
+ scripts: projectVueHonoWebPackageScripts(),
245
+ dependencies: {
246
+ [packageName(packageScope, "api")]: "workspace:*",
247
+ "@vueuse/core": "catalog:",
248
+ hono: "catalog:",
249
+ pinia: "catalog:",
250
+ vue: "catalog:",
251
+ },
252
+ devDependencies: {
253
+ "@playwright/test": "catalog:",
254
+ "@tailwindcss/vite": "catalog:",
255
+ "@types/node": "catalog:",
256
+ "@types/web-bluetooth": "catalog:",
257
+ "@vitejs/plugin-vue": "catalog:",
258
+ "@vue/tsconfig": "catalog:",
259
+ oxfmt: "catalog:",
260
+ oxlint: "catalog:",
261
+ tailwindcss: "catalog:",
262
+ typescript: "catalog:",
263
+ vite: "catalog:",
264
+ vitest: "catalog:",
265
+ "vue-tsc": "catalog:",
266
+ },
267
+ engines: {
268
+ node: context.toolchain.nodeLtsMajor.value,
269
+ },
270
+ };
271
+ }
272
+ function generationRecord(context) {
273
+ return {
274
+ ...generatedBy,
275
+ toolchain: {
276
+ nodeLtsMajor: context.toolchain.nodeLtsMajor.value,
277
+ packageManagerPin: context.toolchain.packageManagerPin.value,
278
+ source: context.toolchain.source,
279
+ },
280
+ };
281
+ }
282
+ function packageScopeFromBlueprint(context) {
283
+ const apiPackage = context.blueprint.packages?.find((pkg) => pkg.path === "apps/api");
284
+ if (apiPackage?.name.startsWith("@") && apiPackage.name.endsWith("/api")) {
285
+ return apiPackage.name.slice(1, -"/api".length);
286
+ }
287
+ return context.projectName.value;
288
+ }
289
+ function operationsForVueHonoApp(context, packageScripts, checkPlan) {
290
+ const packageScope = packageScopeFromBlueprint(context);
291
+ const apiName = packageName(packageScope, "api");
292
+ const webName = packageName(packageScope, "web");
293
+ const editorCustomization = editorCustomizationForCapabilities([
294
+ "oxc-format-lint",
295
+ "vue",
296
+ "tailwind",
297
+ "vitest",
298
+ ]);
299
+ const developmentContainer = checkedDockerfileFirstNodePnpmDevcontainer({
300
+ name: context.projectName.value,
301
+ layer: nodePnpmToolLayer({
302
+ nodeVersion: context.toolchain.nodeLtsMajor.value,
303
+ packageManagerPin: context.toolchain.packageManagerPin.value,
304
+ }),
305
+ additionalLayers: [browserTestToolLayer()],
306
+ extensions: editorCustomization.extensions,
307
+ settings: editorCustomization.settings,
308
+ });
309
+ const rootManifest = rootPackageJson(context, packageScripts);
310
+ const apiManifest = apiPackageJson(context, packageScope);
311
+ const webManifest = webPackageJson(context, packageScope);
312
+ return [
313
+ {
314
+ kind: "writeJson",
315
+ to: "package.json",
316
+ value: rootManifest,
317
+ },
318
+ {
319
+ kind: "writeText",
320
+ to: "pnpm-workspace.yaml",
321
+ text: renderGeneratedPnpmWorkspaceYaml({
322
+ packages: ["apps/*"],
323
+ dependencies: collectGeneratedManifestCatalogReferences([
324
+ rootManifest,
325
+ apiManifest,
326
+ webManifest,
327
+ ]),
328
+ allowBuilds: {
329
+ esbuild: true,
330
+ },
331
+ }),
332
+ },
333
+ {
334
+ kind: "writeJson",
335
+ to: "turbo.json",
336
+ value: {
337
+ tasks: {
338
+ build: {
339
+ dependsOn: ["^build"],
340
+ outputs: ["dist/**"],
341
+ },
342
+ check: {
343
+ dependsOn: ["^build"],
344
+ },
345
+ dev: {
346
+ cache: false,
347
+ persistent: true,
348
+ },
349
+ fix: {
350
+ cache: false,
351
+ },
352
+ },
353
+ },
354
+ },
355
+ {
356
+ kind: "writeJson",
357
+ to: "tsconfig.json",
358
+ value: {
359
+ files: [],
360
+ references: [
361
+ { path: "./apps/api/tsconfig.json" },
362
+ { path: "./apps/web/tsconfig.app.json" },
363
+ { path: "./apps/web/tsconfig.test.json" },
364
+ { path: "./apps/web/tsconfig.node.json" },
365
+ ],
366
+ },
367
+ },
368
+ {
369
+ kind: "writeJson",
370
+ to: "tsconfig.config.json",
371
+ value: {
372
+ compilerOptions: {
373
+ module: "NodeNext",
374
+ moduleResolution: "NodeNext",
375
+ noEmitOnError: true,
376
+ skipLibCheck: false,
377
+ strict: true,
378
+ target: "ES2022",
379
+ },
380
+ include: ["oxlint.config.ts", "oxfmt.config.ts"],
381
+ },
382
+ },
383
+ {
384
+ kind: "copyFile",
385
+ sourceRoot: "sharedOxc",
386
+ from: "vue/oxlint.config.ts",
387
+ to: "oxlint.config.ts",
388
+ },
389
+ {
390
+ kind: "copyFile",
391
+ sourceRoot: "sharedOxc",
392
+ from: "oxfmt.config.ts",
393
+ to: "oxfmt.config.ts",
394
+ },
395
+ {
396
+ kind: "writeJson",
397
+ to: ".template/blueprint.json",
398
+ value: context.blueprint,
399
+ },
400
+ {
401
+ kind: "writeJson",
402
+ to: ".template/generated-by.json",
403
+ value: generationRecord(context),
404
+ },
405
+ {
406
+ kind: "writeJson",
407
+ to: ".devcontainer/devcontainer.json",
408
+ value: developmentContainer.devcontainer,
409
+ },
410
+ {
411
+ ...developmentContainer.dockerfileOperation,
412
+ },
413
+ {
414
+ kind: "writeJson",
415
+ to: ".vscode/extensions.json",
416
+ value: {
417
+ recommendations: editorCustomization.extensions,
418
+ },
419
+ multilineArrays: ["recommendations"],
420
+ },
421
+ {
422
+ kind: "writeJson",
423
+ to: ".vscode/settings.json",
424
+ value: editorCustomization.settings,
425
+ },
426
+ {
427
+ kind: "writeText",
428
+ to: ".gitignore",
429
+ text: [
430
+ "node_modules",
431
+ "dist",
432
+ "playwright-report",
433
+ "test-results",
434
+ ".env",
435
+ ".template/",
436
+ ".pnpm-store/",
437
+ "",
438
+ ].join("\n"),
439
+ },
440
+ {
441
+ kind: "copyFile",
442
+ from: ".github/workflows/check.yml",
443
+ to: ".github/workflows/check.yml",
444
+ },
445
+ {
446
+ kind: "copyFile",
447
+ from: ".github/dependabot.yml",
448
+ to: ".github/dependabot.yml",
449
+ },
450
+ {
451
+ kind: "writeJson",
452
+ to: "apps/api/package.json",
453
+ value: apiManifest,
454
+ },
455
+ {
456
+ kind: "writeJson",
457
+ to: "apps/api/tsconfig.json",
458
+ value: {
459
+ compilerOptions: {
460
+ composite: true,
461
+ declaration: true,
462
+ declarationMap: true,
463
+ module: "NodeNext",
464
+ moduleResolution: "NodeNext",
465
+ noEmitOnError: true,
466
+ paths: {
467
+ "@/*": ["./src/*"],
468
+ },
469
+ skipLibCheck: false,
470
+ strict: true,
471
+ target: "ES2022",
472
+ types: ["node", "vitest/globals"],
473
+ },
474
+ include: ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
475
+ },
476
+ },
477
+ {
478
+ kind: "writeJson",
479
+ to: "apps/api/tsconfig.build.json",
480
+ value: {
481
+ extends: "./tsconfig.json",
482
+ compilerOptions: {
483
+ outDir: "dist",
484
+ rootDir: "src",
485
+ types: ["node"],
486
+ },
487
+ include: ["src/**/*.ts"],
488
+ },
489
+ },
490
+ { kind: "copyFile", from: "api/src/index.ts", to: "apps/api/src/index.ts" },
491
+ {
492
+ kind: "copyFile",
493
+ from: "api/src/runtime.ts",
494
+ to: "apps/api/src/runtime.ts",
495
+ },
496
+ {
497
+ kind: "copyFile",
498
+ from: "api/src/server.ts",
499
+ to: "apps/api/src/server.ts",
500
+ },
501
+ {
502
+ kind: "copyFile",
503
+ from: "api/test/app.test.ts",
504
+ to: "apps/api/test/app.test.ts",
505
+ },
506
+ {
507
+ kind: "copyFile",
508
+ from: "api/vitest.config.ts",
509
+ to: "apps/api/vitest.config.ts",
510
+ },
511
+ {
512
+ kind: "writeJson",
513
+ to: "apps/web/package.json",
514
+ value: webManifest,
515
+ },
516
+ {
517
+ kind: "writeJson",
518
+ to: "apps/web/tsconfig.json",
519
+ value: {
520
+ files: [],
521
+ references: [
522
+ { path: "./tsconfig.app.json" },
523
+ { path: "./tsconfig.test.json" },
524
+ { path: "./tsconfig.node.json" },
525
+ ],
526
+ },
527
+ },
528
+ {
529
+ kind: "writeJson",
530
+ to: "apps/web/tsconfig.app.json",
531
+ value: {
532
+ extends: "@vue/tsconfig/tsconfig.dom.json",
533
+ compilerOptions: {
534
+ composite: true,
535
+ module: "ESNext",
536
+ moduleResolution: "Bundler",
537
+ noEmitOnError: true,
538
+ paths: {
539
+ "@/*": ["./src/*"],
540
+ [apiName]: ["../api/src/index.ts"],
541
+ },
542
+ skipLibCheck: false,
543
+ strict: true,
544
+ target: "ES2022",
545
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
546
+ types: ["web-bluetooth"],
547
+ },
548
+ include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue"],
549
+ references: [{ path: "../api/tsconfig.build.json" }],
550
+ },
551
+ },
552
+ {
553
+ kind: "writeJson",
554
+ to: "apps/web/tsconfig.test.json",
555
+ value: {
556
+ extends: "./tsconfig.app.json",
557
+ compilerOptions: {
558
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
559
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
560
+ types: ["node", "vitest/globals", "web-bluetooth"],
561
+ },
562
+ include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue", "test/**/*.ts"],
563
+ references: [{ path: "../api/tsconfig.build.json" }],
564
+ },
565
+ },
566
+ {
567
+ kind: "writeJson",
568
+ to: "apps/web/tsconfig.node.json",
569
+ value: {
570
+ compilerOptions: {
571
+ composite: true,
572
+ module: "ESNext",
573
+ moduleResolution: "Bundler",
574
+ noEmitOnError: true,
575
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
576
+ outDir: "./node_modules/.tmp/tsconfig.node",
577
+ skipLibCheck: false,
578
+ strict: true,
579
+ target: "ES2022",
580
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
581
+ types: ["node"],
582
+ },
583
+ include: ["playwright.config.ts", "vite.config.ts", "vitest.config.ts"],
584
+ },
585
+ },
586
+ { kind: "copyFile", from: "web/env.d.ts", to: "apps/web/env.d.ts" },
587
+ { kind: "copyFile", from: "web/index.html", to: "apps/web/index.html" },
588
+ {
589
+ kind: "copyFile",
590
+ from: "web/playwright.config.ts",
591
+ to: "apps/web/playwright.config.ts",
592
+ },
593
+ {
594
+ kind: "copyFile",
595
+ from: "web/vite.config.ts",
596
+ to: "apps/web/vite.config.ts",
597
+ },
598
+ {
599
+ kind: "copyFile",
600
+ from: "web/vitest.config.ts",
601
+ to: "apps/web/vitest.config.ts",
602
+ },
603
+ { kind: "copyFile", from: "web/src/api.ts", to: "apps/web/src/api.ts" },
604
+ {
605
+ kind: "replaceAnchors",
606
+ path: "apps/web/src/api.ts",
607
+ language: "typescript",
608
+ replacements: {
609
+ "api-type-import-start": `import type { AppType } from "${apiName}";\nimport { hc } from "hono/client";\n/*`,
610
+ "api-type-import-end": "*/",
611
+ },
612
+ },
613
+ { kind: "copyFile", from: "web/src/App.vue", to: "apps/web/src/App.vue" },
614
+ { kind: "copyFile", from: "web/src/main.ts", to: "apps/web/src/main.ts" },
615
+ {
616
+ kind: "copyFile",
617
+ from: "web/src/style.css",
618
+ to: "apps/web/src/style.css",
619
+ },
620
+ {
621
+ kind: "copyFile",
622
+ from: "web/src/stores/counter.ts",
623
+ to: "apps/web/src/stores/counter.ts",
624
+ },
625
+ {
626
+ kind: "copyFile",
627
+ from: "web/test/app.test.ts",
628
+ to: "apps/web/test/app.test.ts",
629
+ },
630
+ {
631
+ kind: "copyFile",
632
+ from: "web/test/e2e/app.spec.ts",
633
+ to: "apps/web/test/e2e/app.spec.ts",
634
+ },
635
+ ];
636
+ }
637
+ function templateSourceRoot() {
638
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
639
+ const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "vue-hono-app");
640
+ return existsSync(path.join(publishedTemplateRoot, "web", "src", "App.vue"))
641
+ ? publishedTemplateRoot
642
+ : projectionDir;
643
+ }
644
+ function sharedOxcSourceRoot() {
645
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
646
+ const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "oxc");
647
+ return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
648
+ ? publishedSharedRoot
649
+ : path.join(projectionDir, "..", "shared", "oxc");
650
+ }
651
+ function sharedDevcontainerSourceRoot() {
652
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
653
+ const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "devcontainer");
654
+ return existsSync(path.join(publishedSharedRoot, "node-pnpm.Dockerfile"))
655
+ ? publishedSharedRoot
656
+ : path.join(projectionDir, "..", "shared", "devcontainer");
657
+ }
658
+ export const vueHonoAppPresetProjection = {
659
+ metadata: vueHonoAppPresetMetadata,
660
+ blueprint: vueHonoAppBlueprint,
661
+ project(context) {
662
+ const checkPlan = planVueHonoRootChecks();
663
+ const fixPlan = planVueHonoRootFixes();
664
+ const packageScripts = projectVueHonoRootPackageScripts();
665
+ return {
666
+ sourceRoot: templateSourceRoot(),
667
+ sourceRoots: {
668
+ sharedDevcontainer: sharedDevcontainerSourceRoot(),
669
+ sharedOxc: sharedOxcSourceRoot(),
670
+ },
671
+ operations: operationsForVueHonoApp(context, packageScripts, checkPlan),
672
+ checkPlan,
673
+ fixPlan,
674
+ dependencyMaintenancePolicy,
675
+ packageScripts,
676
+ capabilities: {
677
+ rootCheck: true,
678
+ fixCommand: true,
679
+ githubActions: true,
680
+ dependabot: true,
681
+ devcontainer: true,
682
+ },
683
+ };
684
+ },
685
+ async render({ targetDir, plan }) {
686
+ await renderNewProject({
687
+ sourceRoot: plan.sourceRoot,
688
+ sourceRoots: plan.sourceRoots,
689
+ targetRoot: targetDir,
690
+ operations: [...plan.operations],
691
+ });
692
+ },
693
+ };