@ykdz/template 0.0.0 → 0.0.1

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 (54) hide show
  1. package/dist/cli.js +101 -28
  2. package/dist/hono-api.d.ts.map +1 -1
  3. package/dist/hono-api.js +17 -56
  4. package/dist/package-addition.d.ts.map +1 -1
  5. package/dist/package-addition.js +31 -51
  6. package/dist/post-commands.d.ts +40 -0
  7. package/dist/post-commands.d.ts.map +1 -0
  8. package/dist/post-commands.js +154 -0
  9. package/dist/renderer.d.ts +2 -0
  10. package/dist/renderer.d.ts.map +1 -1
  11. package/dist/renderer.js +7 -1
  12. package/dist/rust-bin.d.ts.map +1 -1
  13. package/dist/rust-bin.js +4 -36
  14. package/dist/ts-lib.d.ts.map +1 -1
  15. package/dist/ts-lib.js +17 -56
  16. package/dist/vue-app.d.ts.map +1 -1
  17. package/dist/vue-app.js +17 -57
  18. package/dist/vue-hono-app.d.ts.map +1 -1
  19. package/dist/vue-hono-app.js +28 -76
  20. package/package.json +23 -16
  21. package/templates/hono-api/.github/dependabot.yml +10 -0
  22. package/templates/hono-api/.github/workflows/check.yml +19 -0
  23. package/templates/hono-api/src/server.ts +3 -2
  24. package/templates/hono-api/vitest.config.ts +5 -4
  25. package/templates/rust-bin/.github/dependabot.yml +10 -0
  26. package/templates/rust-bin/.github/workflows/check.yml +18 -0
  27. package/templates/shared/oxc/node/oxlint.config.ts +9 -0
  28. package/templates/shared/oxc/oxfmt.config.ts +8 -0
  29. package/templates/shared/oxc/package.json +18 -0
  30. package/templates/shared/oxc/tsconfig.json +11 -0
  31. package/templates/shared/oxc/vue/oxlint.config.ts +9 -0
  32. package/templates/ts-lib/.github/dependabot.yml +10 -0
  33. package/templates/ts-lib/.github/workflows/check.yml +19 -0
  34. package/templates/vue-app/.github/dependabot.yml +10 -0
  35. package/templates/vue-app/.github/workflows/check.yml +20 -0
  36. package/templates/vue-app/playwright.config.ts +5 -5
  37. package/templates/vue-app/src/App.vue +15 -5
  38. package/templates/vue-app/src/main.ts +2 -0
  39. package/templates/vue-app/test/app.test.ts +1 -0
  40. package/templates/vue-app/test/e2e/app.spec.ts +3 -1
  41. package/templates/vue-app/vite.config.ts +6 -5
  42. package/templates/vue-app/vitest.config.ts +5 -4
  43. package/templates/vue-hono-app/.github/dependabot.yml +10 -0
  44. package/templates/vue-hono-app/.github/workflows/check.yml +20 -0
  45. package/templates/vue-hono-app/api/src/server.ts +3 -2
  46. package/templates/vue-hono-app/api/vitest.config.ts +2 -2
  47. package/templates/vue-hono-app/web/playwright.config.ts +9 -7
  48. package/templates/vue-hono-app/web/src/App.vue +12 -4
  49. package/templates/vue-hono-app/web/src/api.ts +1 -1
  50. package/templates/vue-hono-app/web/src/main.ts +2 -0
  51. package/templates/vue-hono-app/web/test/app.test.ts +1 -0
  52. package/templates/vue-hono-app/web/test/e2e/app.spec.ts +3 -1
  53. package/templates/vue-hono-app/web/vite.config.ts +13 -10
  54. package/templates/vue-hono-app/web/vitest.config.ts +6 -5
@@ -3,6 +3,7 @@ export type CopyFileOperation = {
3
3
  kind: "copyFile";
4
4
  from: string;
5
5
  to: string;
6
+ sourceRoot?: string;
6
7
  };
7
8
  export type WriteJsonOperation = {
8
9
  kind: "writeJson";
@@ -34,6 +35,7 @@ export type ReplaceAnchorsOperation = {
34
35
  export type RenderOperation = CopyFileOperation | WriteJsonOperation | MergeJsonOperation | WriteTextOperation | SetExecutableOperation | ReplaceAnchorsOperation;
35
36
  export type RenderProjectOptions = {
36
37
  sourceRoot: string;
38
+ sourceRoots?: Record<string, string>;
37
39
  targetRoot: string;
38
40
  variables?: RenderVariables;
39
41
  operations: RenderOperation[];
@@ -1 +1 @@
1
- {"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../src/renderer.ts"],"names":[],"mappings":"AAgBA,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG;IAC9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AAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,sBAAsB,GACtB,uBAAuB,CAAC;AAE5B,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B,CAAC;AAufF,wBAAsB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkChF;AAiCD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBnF"}
package/dist/renderer.js CHANGED
@@ -30,7 +30,13 @@ function expandOperationPath(relativePath, options) {
30
30
  }
31
31
  async function renderCopyFile(operation, options) {
32
32
  const variables = options.variables ?? {};
33
- const from = resolveContainedPath(options.sourceRoot, expandTemplatePath(operation.from, variables));
33
+ const sourceRoot = operation.sourceRoot === undefined
34
+ ? options.sourceRoot
35
+ : options.sourceRoots?.[operation.sourceRoot];
36
+ if (sourceRoot === undefined) {
37
+ throw new Error(`Unknown renderer source root: ${operation.sourceRoot}`);
38
+ }
39
+ const from = resolveContainedPath(sourceRoot, expandTemplatePath(operation.from, variables));
34
40
  const to = resolveContainedPath(options.targetRoot, expandTemplatePath(operation.to, variables));
35
41
  const sourceMode = (await stat(from)).mode;
36
42
  await mkdir(path.dirname(to), { recursive: true });
@@ -1 +1 @@
1
- {"version":3,"file":"rust-bin.d.ts","sourceRoot":"","sources":["../src/rust-bin.ts"],"names":[],"mappings":"AAgNA,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzE"}
1
+ {"version":3,"file":"rust-bin.d.ts","sourceRoot":"","sources":["../src/rust-bin.ts"],"names":[],"mappings":"AAgLA,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMzE"}
package/dist/rust-bin.js CHANGED
@@ -151,46 +151,14 @@ function operationsForRustBin(projectName) {
151
151
  }
152
152
  },
153
153
  {
154
- kind: "writeText",
154
+ kind: "copyFile",
155
+ from: ".github/workflows/check.yml",
155
156
  to: ".github/workflows/check.yml",
156
- text: [
157
- "name: Check",
158
- "",
159
- "on:",
160
- " pull_request:",
161
- " push:",
162
- " branches:",
163
- " - main",
164
- "",
165
- "jobs:",
166
- " check:",
167
- " runs-on: ubuntu-latest",
168
- " steps:",
169
- " - uses: actions/checkout@v4",
170
- " - uses: dtolnay/rust-toolchain@stable",
171
- " with:",
172
- " components: rustfmt, clippy",
173
- " - uses: Swatinem/rust-cache@v2",
174
- " - run: ./scripts/check",
175
- ""
176
- ].join("\n")
177
157
  },
178
158
  {
179
- kind: "writeText",
159
+ kind: "copyFile",
160
+ from: ".github/dependabot.yml",
180
161
  to: ".github/dependabot.yml",
181
- text: [
182
- "version: 2",
183
- "updates:",
184
- " - package-ecosystem: cargo",
185
- " directory: /",
186
- " schedule:",
187
- " interval: weekly",
188
- " - package-ecosystem: github-actions",
189
- " directory: /",
190
- " schedule:",
191
- " interval: weekly",
192
- ""
193
- ].join("\n")
194
162
  }
195
163
  ];
196
164
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ts-lib.d.ts","sourceRoot":"","sources":["../src/ts-lib.ts"],"names":[],"mappings":"AA2NA,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMvE"}
1
+ {"version":3,"file":"ts-lib.d.ts","sourceRoot":"","sources":["../src/ts-lib.ts"],"names":[],"mappings":"AAoLA,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOvE"}
package/dist/ts-lib.js CHANGED
@@ -40,7 +40,7 @@ function packageJson(projectName) {
40
40
  typescript: "catalog:"
41
41
  },
42
42
  engines: {
43
- node: ">=22.0.0"
43
+ node: "22"
44
44
  },
45
45
  packageManager: "pnpm@10.0.0"
46
46
  };
@@ -93,24 +93,16 @@ function operationsForTsLib(projectName) {
93
93
  }
94
94
  },
95
95
  {
96
- kind: "writeJson",
97
- to: ".oxlintrc.json",
98
- value: {
99
- categories: {
100
- correctness: "error",
101
- suspicious: "error"
102
- },
103
- plugins: ["typescript", "oxc"]
104
- }
96
+ kind: "copyFile",
97
+ sourceRoot: "sharedOxc",
98
+ from: "node/oxlint.config.ts",
99
+ to: "oxlint.config.ts"
105
100
  },
106
101
  {
107
- kind: "writeJson",
108
- to: ".oxfmtrc.json",
109
- value: {
110
- printWidth: 100,
111
- singleQuote: false,
112
- trailingComma: "none"
113
- }
102
+ kind: "copyFile",
103
+ sourceRoot: "sharedOxc",
104
+ from: "oxfmt.config.ts",
105
+ to: "oxfmt.config.ts"
114
106
  },
115
107
  {
116
108
  kind: "writeText",
@@ -162,58 +154,27 @@ function operationsForTsLib(projectName) {
162
154
  }
163
155
  },
164
156
  {
165
- kind: "writeText",
157
+ kind: "copyFile",
158
+ from: ".github/workflows/check.yml",
166
159
  to: ".github/workflows/check.yml",
167
- text: [
168
- "name: Check",
169
- "",
170
- "on:",
171
- " pull_request:",
172
- " push:",
173
- " branches:",
174
- " - main",
175
- "",
176
- "jobs:",
177
- " check:",
178
- " runs-on: ubuntu-latest",
179
- " steps:",
180
- " - uses: actions/checkout@v4",
181
- " - uses: pnpm/action-setup@v4",
182
- " with:",
183
- " version: 10.0.0",
184
- " - uses: actions/setup-node@v4",
185
- " with:",
186
- " node-version: 22",
187
- " - run: pnpm install",
188
- " - run: pnpm run check",
189
- ""
190
- ].join("\n")
191
160
  },
192
161
  {
193
- kind: "writeText",
162
+ kind: "copyFile",
163
+ from: ".github/dependabot.yml",
194
164
  to: ".github/dependabot.yml",
195
- text: [
196
- "version: 2",
197
- "updates:",
198
- " - package-ecosystem: npm",
199
- " directory: /",
200
- " schedule:",
201
- " interval: weekly",
202
- " - package-ecosystem: github-actions",
203
- " directory: /",
204
- " schedule:",
205
- " interval: weekly",
206
- ""
207
- ].join("\n")
208
165
  }
209
166
  ];
210
167
  }
211
168
  function templateSourceRoot() {
212
169
  return path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "templates", "ts-lib");
213
170
  }
171
+ function sharedOxcSourceRoot() {
172
+ return path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "templates", "shared", "oxc");
173
+ }
214
174
  export async function initTsLibProject(targetDir) {
215
175
  await renderNewProject({
216
176
  sourceRoot: templateSourceRoot(),
177
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
217
178
  targetRoot: targetDir,
218
179
  operations: operationsForTsLib(projectNameFromDir(targetDir))
219
180
  });
@@ -1 +1 @@
1
- {"version":3,"file":"vue-app.d.ts","sourceRoot":"","sources":["../src/vue-app.ts"],"names":[],"mappings":"AAoVA,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMxE"}
1
+ {"version":3,"file":"vue-app.d.ts","sourceRoot":"","sources":["../src/vue-app.ts"],"names":[],"mappings":"AA4SA,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAOxE"}
package/dist/vue-app.js CHANGED
@@ -60,7 +60,7 @@ function packageJson(projectName) {
60
60
  "vue-tsc": "catalog:"
61
61
  },
62
62
  engines: {
63
- node: ">=22.0.0"
63
+ node: "22"
64
64
  },
65
65
  packageManager: "pnpm@10.0.0"
66
66
  };
@@ -170,24 +170,16 @@ function operationsForVueApp(projectName) {
170
170
  }
171
171
  },
172
172
  {
173
- kind: "writeJson",
174
- to: ".oxlintrc.json",
175
- value: {
176
- categories: {
177
- correctness: "error",
178
- suspicious: "error"
179
- },
180
- plugins: ["typescript", "oxc", "vue"]
181
- }
173
+ kind: "copyFile",
174
+ sourceRoot: "sharedOxc",
175
+ from: "vue/oxlint.config.ts",
176
+ to: "oxlint.config.ts"
182
177
  },
183
178
  {
184
- kind: "writeJson",
185
- to: ".oxfmtrc.json",
186
- value: {
187
- printWidth: 100,
188
- singleQuote: false,
189
- trailingComma: "none"
190
- }
179
+ kind: "copyFile",
180
+ sourceRoot: "sharedOxc",
181
+ from: "oxfmt.config.ts",
182
+ to: "oxfmt.config.ts"
191
183
  },
192
184
  {
193
185
  kind: "writeText",
@@ -280,59 +272,27 @@ function operationsForVueApp(projectName) {
280
272
  }
281
273
  },
282
274
  {
283
- kind: "writeText",
275
+ kind: "copyFile",
276
+ from: ".github/workflows/check.yml",
284
277
  to: ".github/workflows/check.yml",
285
- text: [
286
- "name: Check",
287
- "",
288
- "on:",
289
- " pull_request:",
290
- " push:",
291
- " branches:",
292
- " - main",
293
- "",
294
- "jobs:",
295
- " check:",
296
- " runs-on: ubuntu-latest",
297
- " steps:",
298
- " - uses: actions/checkout@v4",
299
- " - uses: pnpm/action-setup@v4",
300
- " with:",
301
- " version: 10.0.0",
302
- " - uses: actions/setup-node@v4",
303
- " with:",
304
- " node-version: 22",
305
- " - run: pnpm install",
306
- " - run: pnpm exec playwright install --with-deps chromium",
307
- " - run: pnpm run check",
308
- ""
309
- ].join("\n")
310
278
  },
311
279
  {
312
- kind: "writeText",
280
+ kind: "copyFile",
281
+ from: ".github/dependabot.yml",
313
282
  to: ".github/dependabot.yml",
314
- text: [
315
- "version: 2",
316
- "updates:",
317
- " - package-ecosystem: npm",
318
- " directory: /",
319
- " schedule:",
320
- " interval: weekly",
321
- " - package-ecosystem: github-actions",
322
- " directory: /",
323
- " schedule:",
324
- " interval: weekly",
325
- ""
326
- ].join("\n")
327
283
  }
328
284
  ];
329
285
  }
330
286
  function templateSourceRoot() {
331
287
  return path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "templates", "vue-app");
332
288
  }
289
+ function sharedOxcSourceRoot() {
290
+ return path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "templates", "shared", "oxc");
291
+ }
333
292
  export async function initVueAppProject(targetDir) {
334
293
  await renderNewProject({
335
294
  sourceRoot: templateSourceRoot(),
295
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
336
296
  targetRoot: targetDir,
337
297
  operations: operationsForVueApp(projectNameFromDir(targetDir))
338
298
  });
@@ -1 +1 @@
1
- {"version":3,"file":"vue-hono-app.d.ts","sourceRoot":"","sources":["../src/vue-hono-app.ts"],"names":[],"mappings":"AA8eA,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,OAAO,CAAC,IAAI,CAAC,CAQf"}
1
+ {"version":3,"file":"vue-hono-app.d.ts","sourceRoot":"","sources":["../src/vue-hono-app.ts"],"names":[],"mappings":"AA8bA,wBAAsB,qBAAqB,CACzC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,OAAO,CAAC,IAAI,CAAC,CASf"}
@@ -40,7 +40,7 @@ function rootPackageJson(projectName) {
40
40
  turbo: "catalog:"
41
41
  },
42
42
  engines: {
43
- node: ">=22.0.0"
43
+ node: "22"
44
44
  },
45
45
  packageManager: "pnpm@10.0.0"
46
46
  };
@@ -82,7 +82,7 @@ function apiPackageJson(packageScope) {
82
82
  vitest: "catalog:"
83
83
  },
84
84
  engines: {
85
- node: ">=22.0.0"
85
+ node: "22"
86
86
  }
87
87
  };
88
88
  }
@@ -129,7 +129,7 @@ function webPackageJson(packageScope) {
129
129
  "vue-tsc": "catalog:"
130
130
  },
131
131
  engines: {
132
- node: ">=22.0.0"
132
+ node: "22"
133
133
  }
134
134
  };
135
135
  }
@@ -249,50 +249,14 @@ function operationsForVueHonoApp(projectName, packageScope) {
249
249
  text: ["node_modules", "dist", "playwright-report", "test-results", ".env", ""].join("\n")
250
250
  },
251
251
  {
252
- kind: "writeText",
252
+ kind: "copyFile",
253
+ from: ".github/workflows/check.yml",
253
254
  to: ".github/workflows/check.yml",
254
- text: [
255
- "name: Check",
256
- "",
257
- "on:",
258
- " pull_request:",
259
- " push:",
260
- " branches:",
261
- " - main",
262
- "",
263
- "jobs:",
264
- " check:",
265
- " runs-on: ubuntu-latest",
266
- " steps:",
267
- " - uses: actions/checkout@v4",
268
- " - uses: pnpm/action-setup@v4",
269
- " with:",
270
- " version: 10.0.0",
271
- " - uses: actions/setup-node@v4",
272
- " with:",
273
- " node-version: 22",
274
- " - run: pnpm install",
275
- ` - run: pnpm ${webFilter} exec playwright install --with-deps chromium`,
276
- " - run: pnpm run check",
277
- ""
278
- ].join("\n")
279
255
  },
280
256
  {
281
- kind: "writeText",
257
+ kind: "copyFile",
258
+ from: ".github/dependabot.yml",
282
259
  to: ".github/dependabot.yml",
283
- text: [
284
- "version: 2",
285
- "updates:",
286
- " - package-ecosystem: npm",
287
- " directory: /",
288
- " schedule:",
289
- " interval: weekly",
290
- " - package-ecosystem: github-actions",
291
- " directory: /",
292
- " schedule:",
293
- " interval: weekly",
294
- ""
295
- ].join("\n")
296
260
  },
297
261
  { kind: "writeJson", to: "apps/api/package.json", value: apiPackageJson(packageScope) },
298
262
  {
@@ -331,24 +295,16 @@ function operationsForVueHonoApp(projectName, packageScope) {
331
295
  }
332
296
  },
333
297
  {
334
- kind: "writeJson",
335
- to: "apps/api/.oxlintrc.json",
336
- value: {
337
- categories: {
338
- correctness: "error",
339
- suspicious: "error"
340
- },
341
- plugins: ["typescript", "oxc"]
342
- }
298
+ kind: "copyFile",
299
+ sourceRoot: "sharedOxc",
300
+ from: "node/oxlint.config.ts",
301
+ to: "apps/api/oxlint.config.ts"
343
302
  },
344
303
  {
345
- kind: "writeJson",
346
- to: "apps/api/.oxfmtrc.json",
347
- value: {
348
- printWidth: 100,
349
- singleQuote: false,
350
- trailingComma: "none"
351
- }
304
+ kind: "copyFile",
305
+ sourceRoot: "sharedOxc",
306
+ from: "oxfmt.config.ts",
307
+ to: "apps/api/oxfmt.config.ts"
352
308
  },
353
309
  { kind: "copyFile", from: "api/src/index.ts", to: "apps/api/src/index.ts" },
354
310
  { kind: "copyFile", from: "api/src/runtime.ts", to: "apps/api/src/runtime.ts" },
@@ -428,24 +384,16 @@ function operationsForVueHonoApp(projectName, packageScope) {
428
384
  }
429
385
  },
430
386
  {
431
- kind: "writeJson",
432
- to: "apps/web/.oxlintrc.json",
433
- value: {
434
- categories: {
435
- correctness: "error",
436
- suspicious: "error"
437
- },
438
- plugins: ["typescript", "oxc", "vue"]
439
- }
387
+ kind: "copyFile",
388
+ sourceRoot: "sharedOxc",
389
+ from: "vue/oxlint.config.ts",
390
+ to: "apps/web/oxlint.config.ts"
440
391
  },
441
392
  {
442
- kind: "writeJson",
443
- to: "apps/web/.oxfmtrc.json",
444
- value: {
445
- printWidth: 100,
446
- singleQuote: false,
447
- trailingComma: "none"
448
- }
393
+ kind: "copyFile",
394
+ sourceRoot: "sharedOxc",
395
+ from: "oxfmt.config.ts",
396
+ to: "apps/web/oxfmt.config.ts"
449
397
  },
450
398
  { kind: "copyFile", from: "web/env.d.ts", to: "apps/web/env.d.ts" },
451
399
  { kind: "copyFile", from: "web/index.html", to: "apps/web/index.html" },
@@ -458,7 +406,7 @@ function operationsForVueHonoApp(projectName, packageScope) {
458
406
  path: "apps/web/src/api.ts",
459
407
  language: "typescript",
460
408
  replacements: {
461
- "api-type-import-start": `import type { AppType } from "${apiName}";\n/*`,
409
+ "api-type-import-start": `import type { AppType } from "${apiName}";\nimport { hc } from "hono/client";\n/*`,
462
410
  "api-type-import-end": "*/"
463
411
  }
464
412
  },
@@ -473,11 +421,15 @@ function operationsForVueHonoApp(projectName, packageScope) {
473
421
  function templateSourceRoot() {
474
422
  return path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "templates", "vue-hono-app");
475
423
  }
424
+ function sharedOxcSourceRoot() {
425
+ return path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "templates", "shared", "oxc");
426
+ }
476
427
  export async function initVueHonoAppProject(targetDir, options = {}) {
477
428
  const projectName = projectNameFromDir(targetDir);
478
429
  const packageScope = options.scope ?? projectName;
479
430
  await renderNewProject({
480
431
  sourceRoot: templateSourceRoot(),
432
+ sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
481
433
  targetRoot: targetDir,
482
434
  operations: operationsForVueHonoApp(projectName, packageScope)
483
435
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ykdz/template",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "description": "Project template generator for YKDZ starter projects.",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -26,29 +26,36 @@
26
26
  ],
27
27
  "files": [
28
28
  "dist",
29
- "templates"
29
+ "templates",
30
+ "!templates/**/node_modules"
30
31
  ],
31
- "scripts": {
32
- "build": "tsc -p tsconfig.build.json",
33
- "prepack": "pnpm run build",
34
- "check": "pnpm run typecheck && pnpm run test && pnpm run check:fixtures",
35
- "check:fixtures": "tsx scripts/check-fixtures.ts",
36
- "fix": "pnpm run build",
37
- "typecheck": "tsc -p tsconfig.json --noEmit",
38
- "test": "vitest run"
32
+ "dependencies": {
33
+ "typescript": "^6.0.3",
34
+ "valibot": "^1.4.2"
39
35
  },
40
36
  "devDependencies": {
41
37
  "@types/node": "^24.0.0",
42
38
  "execa": "^9.6.0",
39
+ "oxfmt": "^0.56.0",
40
+ "oxlint": "^1.71.0",
41
+ "oxlint-tsgolint": "^0.23.0",
43
42
  "tsx": "^4.20.0",
44
- "vitest": "^3.2.0"
43
+ "vitest": "^4.1.9",
44
+ "yaml": "^2.9.0"
45
45
  },
46
46
  "engines": {
47
47
  "node": ">=22.0.0"
48
48
  },
49
- "packageManager": "pnpm@11.8.0",
50
- "dependencies": {
51
- "typescript": "^5.8.0",
52
- "valibot": "^1.4.2"
49
+ "scripts": {
50
+ "build": "tsc -p tsconfig.build.json",
51
+ "check": "pnpm run typecheck && pnpm run test && pnpm run check:templates && pnpm run check:fixtures",
52
+ "check:fixtures": "tsx scripts/check-fixtures.ts",
53
+ "check:templates": "pnpm run check:templates:shared-oxc && pnpm run check:templates:github-yaml && pnpm run check:templates:static-source",
54
+ "check:templates:github-yaml": "tsx scripts/check-template-github-yaml.ts",
55
+ "check:templates:shared-oxc": "pnpm --dir templates/shared/oxc run check",
56
+ "check:templates:static-source": "oxfmt --check --config templates/shared/oxc/oxfmt.config.ts templates && rustfmt --check templates/rust-bin/src/main.rs",
57
+ "fix": "pnpm run build",
58
+ "typecheck": "tsc -p tsconfig.json --noEmit",
59
+ "test": "vitest run"
53
60
  }
54
- }
61
+ }
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: github-actions
8
+ directory: /
9
+ schedule:
10
+ interval: weekly
@@ -0,0 +1,19 @@
1
+ name: Check
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ check:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v6
14
+ - uses: actions/setup-node@v6
15
+ with:
16
+ node-version-file: package.json
17
+ - run: corepack enable
18
+ - run: pnpm install
19
+ - run: pnpm run check
@@ -1,4 +1,5 @@
1
1
  import { serve } from "@hono/node-server";
2
+
2
3
  import { app } from "@/app.js";
3
4
 
4
5
  const port = Number.parseInt(process.env.PORT ?? "3000", 10);
@@ -6,9 +7,9 @@ const port = Number.parseInt(process.env.PORT ?? "3000", 10);
6
7
  serve(
7
8
  {
8
9
  fetch: app.fetch,
9
- port
10
+ port,
10
11
  },
11
12
  (info) => {
12
13
  console.log(`Hono API listening on http://localhost:${info.port}`);
13
- }
14
+ },
14
15
  );
@@ -1,13 +1,14 @@
1
1
  import { fileURLToPath, URL } from "node:url";
2
+
2
3
  import { defineConfig } from "vitest/config";
3
4
 
4
5
  export default defineConfig({
5
6
  resolve: {
6
7
  alias: {
7
- "@": fileURLToPath(new URL("./src", import.meta.url))
8
- }
8
+ "@": fileURLToPath(new URL("./src", import.meta.url)),
9
+ },
9
10
  },
10
11
  test: {
11
- globals: true
12
- }
12
+ globals: true,
13
+ },
13
14
  });
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: cargo
4
+ directory: /
5
+ schedule:
6
+ interval: weekly
7
+ - package-ecosystem: github-actions
8
+ directory: /
9
+ schedule:
10
+ interval: weekly
@@ -0,0 +1,18 @@
1
+ name: Check
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ check:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v6
14
+ - uses: dtolnay/rust-toolchain@stable
15
+ with:
16
+ components: rustfmt, clippy
17
+ - uses: Swatinem/rust-cache@v2
18
+ - run: ./scripts/check