@ykdz/template 0.0.1 → 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 (101) hide show
  1. package/dist/src/cli.d.ts.map +1 -0
  2. package/dist/{cli.js → src/cli.js} +126 -128
  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/src/devcontainer.d.ts +18 -0
  10. package/dist/src/devcontainer.d.ts.map +1 -0
  11. package/dist/src/devcontainer.js +24 -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/src/generation-context.d.ts +24 -0
  16. package/dist/src/generation-context.d.ts.map +1 -0
  17. package/dist/src/generation-context.js +12 -0
  18. package/dist/src/module-graph.d.ts +31 -0
  19. package/dist/src/module-graph.d.ts.map +1 -0
  20. package/dist/src/module-graph.js +48 -0
  21. package/dist/src/next-step-instructions.d.ts +21 -0
  22. package/dist/src/next-step-instructions.d.ts.map +1 -0
  23. package/dist/src/next-step-instructions.js +89 -0
  24. package/dist/src/package-addition.d.ts.map +1 -0
  25. package/dist/src/package-addition.js +188 -0
  26. package/dist/src/preset-projection.d.ts +66 -0
  27. package/dist/src/preset-projection.d.ts.map +1 -0
  28. package/dist/src/preset-projection.js +7 -0
  29. package/dist/src/project-github.d.ts +29 -0
  30. package/dist/src/project-github.d.ts.map +1 -0
  31. package/dist/src/project-github.js +63 -0
  32. package/dist/src/renderer.d.ts.map +1 -0
  33. package/dist/{renderer.js → src/renderer.js} +0 -3
  34. package/dist/src/runtime-paths.d.ts +2 -0
  35. package/dist/src/runtime-paths.d.ts.map +1 -0
  36. package/dist/src/runtime-paths.js +11 -0
  37. package/dist/src/toolchain-resolution.d.ts +35 -0
  38. package/dist/src/toolchain-resolution.d.ts.map +1 -0
  39. package/dist/src/toolchain-resolution.js +192 -0
  40. package/dist/templates/hono-api/projection.d.ts +7 -0
  41. package/dist/templates/hono-api/projection.d.ts.map +1 -0
  42. package/dist/templates/hono-api/projection.js +377 -0
  43. package/dist/templates/projection-plans.d.ts +8 -0
  44. package/dist/templates/projection-plans.d.ts.map +1 -0
  45. package/dist/templates/projection-plans.js +94 -0
  46. package/dist/templates/registry.d.ts +8 -0
  47. package/dist/templates/registry.d.ts.map +1 -0
  48. package/dist/templates/registry.js +42 -0
  49. package/dist/templates/rust-bin/projection.d.ts +10 -0
  50. package/dist/templates/rust-bin/projection.d.ts.map +1 -0
  51. package/dist/templates/rust-bin/projection.js +282 -0
  52. package/dist/templates/ts-lib/projection.d.ts +7 -0
  53. package/dist/templates/ts-lib/projection.d.ts.map +1 -0
  54. package/dist/templates/ts-lib/projection.js +372 -0
  55. package/dist/templates/vue-app/projection.d.ts +7 -0
  56. package/dist/templates/vue-app/projection.d.ts.map +1 -0
  57. package/dist/templates/vue-app/projection.js +594 -0
  58. package/dist/templates/vue-hono-app/projection.d.ts +9 -0
  59. package/dist/templates/vue-hono-app/projection.d.ts.map +1 -0
  60. package/dist/templates/vue-hono-app/projection.js +589 -0
  61. package/package.json +30 -24
  62. package/pnpm-workspace.yaml +34 -0
  63. package/templates/hono-api/projection.ts +453 -0
  64. package/templates/projection-plans.ts +135 -0
  65. package/templates/registry.ts +59 -0
  66. package/templates/rust-bin/.github/dependabot.yml +4 -0
  67. package/templates/rust-bin/.github/workflows/check.yml +6 -1
  68. package/templates/rust-bin/projection.ts +346 -0
  69. package/templates/ts-lib/projection.ts +454 -0
  70. package/templates/vue-app/projection.ts +687 -0
  71. package/templates/vue-app/test/e2e/app.spec.ts +4 -1
  72. package/templates/vue-hono-app/projection.ts +669 -0
  73. package/templates/vue-hono-app/web/test/e2e/app.spec.ts +4 -1
  74. package/dist/cli.d.ts.map +0 -1
  75. package/dist/declarations.d.ts.map +0 -1
  76. package/dist/hono-api.d.ts +0 -2
  77. package/dist/hono-api.d.ts.map +0 -1
  78. package/dist/hono-api.js +0 -208
  79. package/dist/package-addition.d.ts.map +0 -1
  80. package/dist/package-addition.js +0 -560
  81. package/dist/post-commands.d.ts +0 -40
  82. package/dist/post-commands.d.ts.map +0 -1
  83. package/dist/post-commands.js +0 -154
  84. package/dist/renderer.d.ts.map +0 -1
  85. package/dist/rust-bin.d.ts +0 -2
  86. package/dist/rust-bin.d.ts.map +0 -1
  87. package/dist/rust-bin.js +0 -174
  88. package/dist/ts-lib.d.ts +0 -2
  89. package/dist/ts-lib.d.ts.map +0 -1
  90. package/dist/ts-lib.js +0 -181
  91. package/dist/vue-app.d.ts +0 -2
  92. package/dist/vue-app.d.ts.map +0 -1
  93. package/dist/vue-app.js +0 -299
  94. package/dist/vue-hono-app.d.ts +0 -4
  95. package/dist/vue-hono-app.d.ts.map +0 -1
  96. package/dist/vue-hono-app.js +0 -436
  97. package/templates/shared/oxc/package.json +0 -18
  98. package/templates/shared/oxc/tsconfig.json +0 -11
  99. /package/dist/{cli.d.ts → src/cli.d.ts} +0 -0
  100. /package/dist/{package-addition.d.ts → src/package-addition.d.ts} +0 -0
  101. /package/dist/{renderer.d.ts → src/renderer.d.ts} +0 -0
@@ -0,0 +1,34 @@
1
+ packages:
2
+ - .
3
+
4
+ catalog:
5
+ "@hono/node-server": ^2.0.6
6
+ "@playwright/test": ^1.61.1
7
+ "@tailwindcss/vite": ^4.3.2
8
+ "@types/node": ^24.0.0
9
+ "@types/web-bluetooth": ^0.0.21
10
+ "@vitejs/plugin-vue": ^6.0.7
11
+ "@vue/tsconfig": ^0.9.1
12
+ "@vueuse/core": ^14.3.0
13
+ hono: ^4.12.27
14
+ oxfmt: ^0.57.0
15
+ oxlint: ^1.72.0
16
+ pinia: ^3.0.4
17
+ tailwindcss: ^4.3.2
18
+ tsc-alias: ^1.8.17
19
+ tsx: ^4.22.4
20
+ turbo: ^2.10.2
21
+ typescript: ^6.0.3
22
+ vite: ^8.1.2
23
+ vitest: ^4.1.9
24
+ vue: ^3.5.39
25
+ vue-tsc: ^3.3.6
26
+
27
+ allowBuilds:
28
+ esbuild: true
29
+
30
+ minimumReleaseAgeExclude:
31
+ - valibot@1.4.2
32
+
33
+ onlyBuiltDependencies:
34
+ - esbuild
@@ -0,0 +1,453 @@
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
+ PresetPackageAdditionOptions,
20
+ PresetPackageAdditionPlan,
21
+ PresetProjection,
22
+ PresetProjectionPlan,
23
+ } from "../../src/preset-projection.js";
24
+ import {
25
+ projectCheckWorkflow,
26
+ projectDependabotConfig,
27
+ type DependencyMaintenancePolicy,
28
+ } from "../../src/project-github.js";
29
+ import { renderNewProject, type RenderOperation } from "../../src/renderer.js";
30
+ import { planNodeChecks, planNodeFixes } from "../projection-plans.js";
31
+
32
+ const generatedBy = {
33
+ packageName: "@ykdz/template",
34
+ version: "0.0.0",
35
+ command: "template init --preset hono-api",
36
+ };
37
+
38
+ export const honoApiPresetMetadata: BuiltInPreset = {
39
+ name: "hono-api",
40
+ title: "Hono API",
41
+ description: "Single-package Hono Node API with strict TypeScript tooling.",
42
+ generation: "supported",
43
+ supportedPackageManagers: ["pnpm"],
44
+ supportedProjectKinds: ["single-package"],
45
+ features: [
46
+ "pnpm-catalog",
47
+ "oxc-format-lint",
48
+ "strict-typescript",
49
+ "root-check",
50
+ "fix-command",
51
+ "devcontainer",
52
+ "github-actions",
53
+ "dependabot",
54
+ ],
55
+ };
56
+
57
+ const dependencyMaintenancePolicy: DependencyMaintenancePolicy = {
58
+ ecosystems: ["npm", "github-actions"],
59
+ interval: "weekly",
60
+ };
61
+
62
+ export function honoApiBlueprint(): ProjectBlueprint {
63
+ return {
64
+ schemaVersion: 1,
65
+ preset: "hono-api",
66
+ packageManager: "pnpm",
67
+ projectKind: "single-package",
68
+ features: [...honoApiPresetMetadata.features],
69
+ };
70
+ }
71
+
72
+ export function projectHonoApiPackageScripts(): Record<string, string> {
73
+ return {
74
+ build: "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
75
+ check: renderRootCheckCommand(planNodeChecks("hono-api")),
76
+ fix: renderFixCommand(planNodeFixes("hono-api")),
77
+ "format:check": "oxfmt --check .",
78
+ "format:write": "oxfmt --write .",
79
+ lint: "oxlint . --deny-warnings",
80
+ "lint:fix": "oxlint . --fix --deny-warnings",
81
+ start: "node dist/server.js",
82
+ test: "vitest run",
83
+ typecheck: "tsc -p tsconfig.json --noEmit",
84
+ };
85
+ }
86
+
87
+ function packageJson(
88
+ context: GenerationContext,
89
+ packageScripts: Record<string, string>,
90
+ ): Record<string, unknown> {
91
+ return {
92
+ name: context.projectName.value,
93
+ version: "0.0.0",
94
+ private: true,
95
+ type: "module",
96
+ scripts: packageScripts,
97
+ dependencies: {
98
+ "@hono/node-server": "catalog:",
99
+ hono: "catalog:",
100
+ },
101
+ devDependencies: {
102
+ "@types/node": "catalog:",
103
+ oxfmt: "catalog:",
104
+ oxlint: "catalog:",
105
+ "tsc-alias": "catalog:",
106
+ typescript: "catalog:",
107
+ vitest: "catalog:",
108
+ },
109
+ engines: {
110
+ node: context.toolchain.nodeLtsMajor.value,
111
+ },
112
+ packageManager: context.toolchain.packageManagerPin.value,
113
+ };
114
+ }
115
+
116
+ function generationRecord(context: GenerationContext): Record<string, unknown> {
117
+ return {
118
+ ...generatedBy,
119
+ toolchain: {
120
+ nodeLtsMajor: context.toolchain.nodeLtsMajor.value,
121
+ packageManagerPin: context.toolchain.packageManagerPin.value,
122
+ source: context.toolchain.source,
123
+ },
124
+ };
125
+ }
126
+
127
+ function operationsForHonoApi(
128
+ context: GenerationContext,
129
+ packageScripts: Record<string, string>,
130
+ checkPlan: CheckPlan,
131
+ ): RenderOperation[] {
132
+ const editorCustomization = editorCustomizationForCapabilities([
133
+ "oxc-format-lint",
134
+ "vitest",
135
+ ]);
136
+
137
+ return [
138
+ {
139
+ kind: "writeJson",
140
+ to: "package.json",
141
+ value: packageJson(context, packageScripts),
142
+ },
143
+ {
144
+ kind: "writeText",
145
+ to: "pnpm-workspace.yaml",
146
+ text: renderGeneratedPnpmWorkspaceYaml({
147
+ dependencies: [
148
+ "@hono/node-server",
149
+ "@types/node",
150
+ "hono",
151
+ "oxfmt",
152
+ "oxlint",
153
+ "tsc-alias",
154
+ "typescript",
155
+ "vitest",
156
+ ],
157
+ }),
158
+ },
159
+ {
160
+ kind: "writeJson",
161
+ to: "tsconfig.json",
162
+ value: {
163
+ compilerOptions: {
164
+ module: "NodeNext",
165
+ moduleResolution: "NodeNext",
166
+ noEmitOnError: true,
167
+ paths: {
168
+ "@/*": ["./src/*"],
169
+ },
170
+ skipLibCheck: false,
171
+ strict: true,
172
+ target: "ES2022",
173
+ types: ["node", "vitest/globals"],
174
+ },
175
+ include: ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
176
+ },
177
+ },
178
+ {
179
+ kind: "writeJson",
180
+ to: "tsconfig.build.json",
181
+ value: {
182
+ extends: "./tsconfig.json",
183
+ compilerOptions: {
184
+ outDir: "dist",
185
+ rootDir: "src",
186
+ types: ["node"],
187
+ },
188
+ include: ["src/**/*.ts"],
189
+ },
190
+ },
191
+ {
192
+ kind: "copyFile",
193
+ sourceRoot: "sharedOxc",
194
+ from: "node/oxlint.config.ts",
195
+ to: "oxlint.config.ts",
196
+ },
197
+ {
198
+ kind: "copyFile",
199
+ sourceRoot: "sharedOxc",
200
+ from: "oxfmt.config.ts",
201
+ to: "oxfmt.config.ts",
202
+ },
203
+ {
204
+ kind: "writeText",
205
+ to: ".gitignore",
206
+ text: ["node_modules", "dist", ".env", ""].join("\n"),
207
+ },
208
+ { kind: "copyFile", from: "src/app.ts", to: "src/app.ts" },
209
+ { kind: "copyFile", from: "src/server.ts", to: "src/server.ts" },
210
+ { kind: "copyFile", from: "test/app.test.ts", to: "test/app.test.ts" },
211
+ { kind: "copyFile", from: "vitest.config.ts", to: "vitest.config.ts" },
212
+ {
213
+ kind: "writeJson",
214
+ to: ".project-kit/blueprint.json",
215
+ value: honoApiBlueprint(),
216
+ },
217
+ {
218
+ kind: "writeJson",
219
+ to: ".project-kit/generated-by.json",
220
+ value: generationRecord(context),
221
+ },
222
+ {
223
+ kind: "writeJson",
224
+ to: ".devcontainer/devcontainer.json",
225
+ value: nodePnpmDevcontainer({
226
+ name: `${context.projectName.value} API development`,
227
+ nodeVersion: context.toolchain.nodeLtsMajor.value,
228
+ packageManagerPin: context.toolchain.packageManagerPin.value,
229
+ extensions: editorCustomization.extensions,
230
+ settings: editorCustomization.settings,
231
+ }),
232
+ },
233
+ {
234
+ kind: "writeJson",
235
+ to: ".vscode/extensions.json",
236
+ value: {
237
+ recommendations: editorCustomization.extensions,
238
+ },
239
+ multilineArrays: ["recommendations"],
240
+ },
241
+ {
242
+ kind: "writeJson",
243
+ to: ".vscode/settings.json",
244
+ value: editorCustomization.settings,
245
+ },
246
+ {
247
+ kind: "writeText",
248
+ to: ".github/workflows/check.yml",
249
+ text: projectCheckWorkflow({ checkPlan }),
250
+ },
251
+ {
252
+ kind: "writeText",
253
+ to: ".github/dependabot.yml",
254
+ text: projectDependabotConfig(dependencyMaintenancePolicy),
255
+ },
256
+ ];
257
+ }
258
+
259
+ function packageAdditionOperations(
260
+ packagePath: string,
261
+ packageName: string,
262
+ nodeVersion: string,
263
+ ): RenderOperation[] {
264
+ return [
265
+ {
266
+ kind: "writeJson",
267
+ to: `${packagePath}/package.json`,
268
+ value: {
269
+ name: packageName,
270
+ version: "0.0.0",
271
+ private: true,
272
+ type: "module",
273
+ scripts: projectHonoApiPackageScripts(),
274
+ dependencies: {
275
+ "@hono/node-server": "catalog:",
276
+ hono: "catalog:",
277
+ },
278
+ devDependencies: {
279
+ "@types/node": "catalog:",
280
+ oxfmt: "catalog:",
281
+ oxlint: "catalog:",
282
+ "tsc-alias": "catalog:",
283
+ typescript: "catalog:",
284
+ vitest: "catalog:",
285
+ },
286
+ engines: {
287
+ node: nodeVersion,
288
+ },
289
+ },
290
+ },
291
+ {
292
+ kind: "writeJson",
293
+ to: `${packagePath}/tsconfig.json`,
294
+ value: {
295
+ compilerOptions: {
296
+ composite: true,
297
+ module: "NodeNext",
298
+ moduleResolution: "NodeNext",
299
+ noEmitOnError: true,
300
+ paths: {
301
+ "@/*": ["./src/*"],
302
+ },
303
+ skipLibCheck: false,
304
+ strict: true,
305
+ target: "ES2022",
306
+ types: ["node", "vitest/globals"],
307
+ },
308
+ include: ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
309
+ },
310
+ },
311
+ {
312
+ kind: "writeJson",
313
+ to: `${packagePath}/tsconfig.build.json`,
314
+ value: {
315
+ extends: "./tsconfig.json",
316
+ compilerOptions: {
317
+ outDir: "dist",
318
+ rootDir: "src",
319
+ types: ["node"],
320
+ },
321
+ include: ["src/**/*.ts"],
322
+ },
323
+ },
324
+ {
325
+ kind: "copyFile",
326
+ sourceRoot: "sharedOxc",
327
+ from: "node/oxlint.config.ts",
328
+ to: `${packagePath}/oxlint.config.ts`,
329
+ },
330
+ {
331
+ kind: "copyFile",
332
+ sourceRoot: "sharedOxc",
333
+ from: "oxfmt.config.ts",
334
+ to: `${packagePath}/oxfmt.config.ts`,
335
+ },
336
+ { kind: "copyFile", from: "src/app.ts", to: `${packagePath}/src/app.ts` },
337
+ {
338
+ kind: "copyFile",
339
+ from: "src/server.ts",
340
+ to: `${packagePath}/src/server.ts`,
341
+ },
342
+ {
343
+ kind: "copyFile",
344
+ from: "test/app.test.ts",
345
+ to: `${packagePath}/test/app.test.ts`,
346
+ },
347
+ {
348
+ kind: "copyFile",
349
+ from: "vitest.config.ts",
350
+ to: `${packagePath}/vitest.config.ts`,
351
+ },
352
+ ];
353
+ }
354
+
355
+ function packageAdditionPlan(
356
+ packageLeafName: string,
357
+ packageName: string,
358
+ nodeVersion: string,
359
+ ): PresetPackageAdditionPlan {
360
+ const packagePath = `apps/${packageLeafName}`;
361
+
362
+ return {
363
+ packagePath,
364
+ workspacePackageGlob: "apps/*",
365
+ rootTsconfigReferences: [`./${packagePath}/tsconfig.json`],
366
+ sourceRoot: templateSourceRoot(),
367
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
368
+ operations: packageAdditionOperations(
369
+ packagePath,
370
+ packageName,
371
+ nodeVersion,
372
+ ),
373
+ };
374
+ }
375
+
376
+ function templateSourceRoot(): string {
377
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
378
+ const publishedTemplateRoot = path.join(
379
+ projectionDir,
380
+ "..",
381
+ "..",
382
+ "..",
383
+ "templates",
384
+ "hono-api",
385
+ );
386
+
387
+ return existsSync(path.join(publishedTemplateRoot, "src", "app.ts"))
388
+ ? publishedTemplateRoot
389
+ : projectionDir;
390
+ }
391
+
392
+ function sharedOxcSourceRoot(): string {
393
+ const projectionDir = path.dirname(fileURLToPath(import.meta.url));
394
+ const publishedSharedRoot = path.join(
395
+ projectionDir,
396
+ "..",
397
+ "..",
398
+ "..",
399
+ "templates",
400
+ "shared",
401
+ "oxc",
402
+ );
403
+
404
+ return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
405
+ ? publishedSharedRoot
406
+ : path.join(projectionDir, "..", "shared", "oxc");
407
+ }
408
+
409
+ export const honoApiPresetProjection: PresetProjection = {
410
+ metadata: honoApiPresetMetadata,
411
+ capabilities: {
412
+ packageAddition: {
413
+ planPackageAddition({
414
+ packageLeafName,
415
+ packageName,
416
+ nodeVersion,
417
+ }: PresetPackageAdditionOptions) {
418
+ return packageAdditionPlan(packageLeafName, packageName, nodeVersion);
419
+ },
420
+ },
421
+ },
422
+ blueprint: honoApiBlueprint,
423
+ project(context: GenerationContext): PresetProjectionPlan {
424
+ const checkPlan = planNodeChecks("hono-api");
425
+ const fixPlan = planNodeFixes("hono-api");
426
+ const packageScripts = projectHonoApiPackageScripts();
427
+
428
+ return {
429
+ sourceRoot: templateSourceRoot(),
430
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
431
+ operations: operationsForHonoApi(context, packageScripts, checkPlan),
432
+ checkPlan,
433
+ fixPlan,
434
+ dependencyMaintenancePolicy,
435
+ packageScripts,
436
+ capabilities: {
437
+ rootCheck: true,
438
+ fixCommand: true,
439
+ githubActions: true,
440
+ dependabot: true,
441
+ devcontainer: true,
442
+ },
443
+ };
444
+ },
445
+ async render({ targetDir, plan }): Promise<void> {
446
+ await renderNewProject({
447
+ sourceRoot: plan.sourceRoot,
448
+ sourceRoots: plan.sourceRoots,
449
+ targetRoot: targetDir,
450
+ operations: [...plan.operations],
451
+ });
452
+ },
453
+ };
@@ -0,0 +1,135 @@
1
+ import type {
2
+ CheckComponent,
3
+ CheckEnvironmentNeed,
4
+ CheckPlan,
5
+ ComponentOwner,
6
+ FixComponent,
7
+ FixPlan,
8
+ } from "../src/module-graph.js";
9
+
10
+ const rootPackageBoundary: ComponentOwner = {
11
+ kind: "package-boundary",
12
+ path: ".",
13
+ };
14
+
15
+ const apiPackageBoundary: ComponentOwner = {
16
+ kind: "package-boundary",
17
+ path: "apps/api",
18
+ };
19
+
20
+ const webPackageBoundary: ComponentOwner = {
21
+ kind: "package-boundary",
22
+ path: "apps/web",
23
+ };
24
+
25
+ export type NodeCheckPlanTarget =
26
+ | "hono-api"
27
+ | "vue-app"
28
+ | "vue-hono-root"
29
+ | "vue-hono-api"
30
+ | "vue-hono-web";
31
+
32
+ export type NodeFixPlanTarget =
33
+ | "hono-api"
34
+ | "vue-app"
35
+ | "vue-hono-root"
36
+ | "vue-hono-api"
37
+ | "vue-hono-web";
38
+
39
+ function honoApiCheckComponents(owner: ComponentOwner): CheckComponent[] {
40
+ return [
41
+ { kind: "oxc-format-check", owner },
42
+ { kind: "oxc-lint", owner },
43
+ { kind: "typescript-typecheck", owner },
44
+ { kind: "build", owner },
45
+ { kind: "unit-test", owner },
46
+ ];
47
+ }
48
+
49
+ function vueAppCheckComponents(owner: ComponentOwner): CheckComponent[] {
50
+ return [
51
+ { kind: "oxc-format-check", owner },
52
+ { kind: "oxc-lint", owner },
53
+ { kind: "typescript-typecheck", owner },
54
+ { kind: "build", owner },
55
+ { kind: "unit-test", owner },
56
+ { kind: "e2e-test", owner },
57
+ ];
58
+ }
59
+
60
+ function nodeFixComponents(owner: ComponentOwner): FixComponent[] {
61
+ return [
62
+ { kind: "oxc-format-write", owner },
63
+ { kind: "oxc-lint-fix", owner },
64
+ ];
65
+ }
66
+
67
+ export function selectNodeCheckComponents(
68
+ target: NodeCheckPlanTarget,
69
+ ): CheckComponent[] {
70
+ switch (target) {
71
+ case "hono-api":
72
+ return honoApiCheckComponents(rootPackageBoundary);
73
+ case "vue-app":
74
+ return vueAppCheckComponents(rootPackageBoundary);
75
+ case "vue-hono-root":
76
+ return [{ kind: "turbo-check", owner: rootPackageBoundary }];
77
+ case "vue-hono-api":
78
+ return honoApiCheckComponents(apiPackageBoundary);
79
+ case "vue-hono-web":
80
+ return vueAppCheckComponents(webPackageBoundary);
81
+ }
82
+ }
83
+
84
+ export function selectNodeFixComponents(
85
+ target: NodeFixPlanTarget,
86
+ ): FixComponent[] {
87
+ switch (target) {
88
+ case "hono-api":
89
+ case "vue-app":
90
+ return nodeFixComponents(rootPackageBoundary);
91
+ case "vue-hono-root":
92
+ return [{ kind: "turbo-fix", owner: rootPackageBoundary }];
93
+ case "vue-hono-api":
94
+ return nodeFixComponents(apiPackageBoundary);
95
+ case "vue-hono-web":
96
+ return nodeFixComponents(webPackageBoundary);
97
+ }
98
+ }
99
+
100
+ function checkEnvironmentNeeds(
101
+ target: NodeCheckPlanTarget,
102
+ ): CheckEnvironmentNeed[] {
103
+ if (target === "vue-app") {
104
+ return [
105
+ {
106
+ kind: "playwright-browser-assets",
107
+ browser: "chromium",
108
+ owner: rootPackageBoundary,
109
+ },
110
+ ];
111
+ }
112
+
113
+ if (target === "vue-hono-root" || target === "vue-hono-web") {
114
+ return [
115
+ {
116
+ kind: "playwright-browser-assets",
117
+ browser: "chromium",
118
+ owner: webPackageBoundary,
119
+ },
120
+ ];
121
+ }
122
+
123
+ return [];
124
+ }
125
+
126
+ export function planNodeChecks(target: NodeCheckPlanTarget): CheckPlan {
127
+ return {
128
+ components: selectNodeCheckComponents(target),
129
+ environmentNeeds: checkEnvironmentNeeds(target),
130
+ };
131
+ }
132
+
133
+ export function planNodeFixes(target: NodeFixPlanTarget): FixPlan {
134
+ return { components: selectNodeFixComponents(target) };
135
+ }
@@ -0,0 +1,59 @@
1
+ import type { BuiltInPreset } from "../src/declarations.js";
2
+ import type { GenerationContext } from "../src/generation-context.js";
3
+ import type {
4
+ PresetProjection,
5
+ PresetProjectionPlan,
6
+ } from "../src/preset-projection.js";
7
+ import { honoApiPresetProjection } from "./hono-api/projection.js";
8
+ import { rustBinPresetProjection } from "./rust-bin/projection.js";
9
+ import { tsLibPresetProjection } from "./ts-lib/projection.js";
10
+ import { vueAppPresetProjection } from "./vue-app/projection.js";
11
+ import { vueHonoAppPresetProjection } from "./vue-hono-app/projection.js";
12
+
13
+ const futurePresetMetadata = [
14
+ {
15
+ name: "ts-app",
16
+ title: "TypeScript application",
17
+ description: "Future application preset metadata.",
18
+ generation: "future",
19
+ supportedPackageManagers: ["pnpm"],
20
+ supportedProjectKinds: ["single-package"],
21
+ features: [],
22
+ },
23
+ {
24
+ name: "node-cli",
25
+ title: "Node.js CLI",
26
+ description: "Future command-line preset metadata.",
27
+ generation: "future",
28
+ supportedPackageManagers: ["pnpm"],
29
+ supportedProjectKinds: ["single-package"],
30
+ features: [],
31
+ },
32
+ ] satisfies readonly BuiltInPreset[];
33
+
34
+ export const builtInPresetProjections: readonly PresetProjection[] = [
35
+ tsLibPresetProjection,
36
+ honoApiPresetProjection,
37
+ vueAppPresetProjection,
38
+ vueHonoAppPresetProjection,
39
+ rustBinPresetProjection,
40
+ ];
41
+
42
+ export const builtInPresetMetadata: readonly BuiltInPreset[] = [
43
+ ...builtInPresetProjections.map((projection) => projection.metadata),
44
+ ...futurePresetMetadata,
45
+ ];
46
+
47
+ export function findBuiltInPresetProjection(
48
+ name: string,
49
+ ): PresetProjection | undefined {
50
+ return builtInPresetProjections.find(
51
+ (projection) => projection.metadata.name === name,
52
+ );
53
+ }
54
+
55
+ export function projectPresetThroughRegistry(
56
+ context: GenerationContext,
57
+ ): PresetProjectionPlan | undefined {
58
+ return findBuiltInPresetProjection(context.preset)?.project(context);
59
+ }
@@ -1,5 +1,9 @@
1
1
  version: 2
2
2
  updates:
3
+ - package-ecosystem: npm
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
3
7
  - package-ecosystem: cargo
4
8
  directory: /
5
9
  schedule:
@@ -11,8 +11,13 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
13
  - uses: actions/checkout@v6
14
+ - uses: actions/setup-node@v6
15
+ with:
16
+ node-version-file: package.json
17
+ - run: corepack enable
14
18
  - uses: dtolnay/rust-toolchain@stable
15
19
  with:
16
20
  components: rustfmt, clippy
17
21
  - uses: Swatinem/rust-cache@v2
18
- - run: ./scripts/check
22
+ - run: pnpm install
23
+ - run: pnpm run check