@ykdz/template 0.0.2 → 0.0.3

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