@ykdz/template 0.0.0

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 (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +35 -0
  3. package/dist/cli.d.ts +3 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +353 -0
  6. package/dist/declarations.d.ts +166 -0
  7. package/dist/declarations.d.ts.map +1 -0
  8. package/dist/declarations.js +340 -0
  9. package/dist/hono-api.d.ts +2 -0
  10. package/dist/hono-api.d.ts.map +1 -0
  11. package/dist/hono-api.js +247 -0
  12. package/dist/package-addition.d.ts +7 -0
  13. package/dist/package-addition.d.ts.map +1 -0
  14. package/dist/package-addition.js +580 -0
  15. package/dist/renderer.d.ts +44 -0
  16. package/dist/renderer.d.ts.map +1 -0
  17. package/dist/renderer.js +379 -0
  18. package/dist/rust-bin.d.ts +2 -0
  19. package/dist/rust-bin.d.ts.map +1 -0
  20. package/dist/rust-bin.js +206 -0
  21. package/dist/ts-lib.d.ts +2 -0
  22. package/dist/ts-lib.d.ts.map +1 -0
  23. package/dist/ts-lib.js +220 -0
  24. package/dist/vue-app.d.ts +2 -0
  25. package/dist/vue-app.d.ts.map +1 -0
  26. package/dist/vue-app.js +339 -0
  27. package/dist/vue-hono-app.d.ts +4 -0
  28. package/dist/vue-hono-app.d.ts.map +1 -0
  29. package/dist/vue-hono-app.js +484 -0
  30. package/package.json +54 -0
  31. package/templates/hono-api/src/app.ts +5 -0
  32. package/templates/hono-api/src/server.ts +14 -0
  33. package/templates/hono-api/test/app.test.ts +10 -0
  34. package/templates/hono-api/vitest.config.ts +13 -0
  35. package/templates/rust-bin/src/main.rs +18 -0
  36. package/templates/ts-lib/src/index.ts +7 -0
  37. package/templates/vue-app/env.d.ts +1 -0
  38. package/templates/vue-app/index.html +12 -0
  39. package/templates/vue-app/playwright.config.ts +20 -0
  40. package/templates/vue-app/src/App.vue +33 -0
  41. package/templates/vue-app/src/main.ts +6 -0
  42. package/templates/vue-app/src/stores/counter.ts +12 -0
  43. package/templates/vue-app/src/style.css +1 -0
  44. package/templates/vue-app/test/app.test.ts +13 -0
  45. package/templates/vue-app/test/e2e/app.spec.ts +9 -0
  46. package/templates/vue-app/vite.config.ts +13 -0
  47. package/templates/vue-app/vitest.config.ts +14 -0
  48. package/templates/vue-hono-app/api/src/index.ts +3 -0
  49. package/templates/vue-hono-app/api/src/runtime.ts +5 -0
  50. package/templates/vue-hono-app/api/src/server.ts +14 -0
  51. package/templates/vue-hono-app/api/test/app.test.ts +10 -0
  52. package/templates/vue-hono-app/api/vitest.config.ts +7 -0
  53. package/templates/vue-hono-app/web/env.d.ts +9 -0
  54. package/templates/vue-hono-app/web/index.html +12 -0
  55. package/templates/vue-hono-app/web/playwright.config.ts +21 -0
  56. package/templates/vue-hono-app/web/src/App.vue +42 -0
  57. package/templates/vue-hono-app/web/src/api.ts +8 -0
  58. package/templates/vue-hono-app/web/src/main.ts +6 -0
  59. package/templates/vue-hono-app/web/src/stores/counter.ts +12 -0
  60. package/templates/vue-hono-app/web/src/style.css +1 -0
  61. package/templates/vue-hono-app/web/test/app.test.ts +13 -0
  62. package/templates/vue-hono-app/web/test/e2e/app.spec.ts +10 -0
  63. package/templates/vue-hono-app/web/vite.config.ts +29 -0
  64. package/templates/vue-hono-app/web/vitest.config.ts +16 -0
package/dist/ts-lib.js ADDED
@@ -0,0 +1,220 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { renderNewProject } from "./renderer.js";
4
+ const generatedBy = {
5
+ packageName: "@ykdz/template",
6
+ version: "0.0.0",
7
+ command: "template init --preset ts-lib"
8
+ };
9
+ function projectNameFromDir(targetDir) {
10
+ return path.basename(path.resolve(targetDir));
11
+ }
12
+ function packageJson(projectName) {
13
+ return {
14
+ name: projectName,
15
+ version: "0.0.0",
16
+ private: true,
17
+ files: ["dist"],
18
+ type: "module",
19
+ exports: {
20
+ ".": {
21
+ default: "./dist/index.js",
22
+ types: "./dist/index.d.ts"
23
+ }
24
+ },
25
+ scripts: {
26
+ build: "tsc -p tsconfig.json && tsc-alias -p tsconfig.json",
27
+ check: "pnpm run typecheck && pnpm run lint && pnpm run format:check",
28
+ fix: "pnpm run format:write && pnpm run lint:fix",
29
+ "format:check": "oxfmt --check .",
30
+ "format:write": "oxfmt --write .",
31
+ lint: "oxlint . --deny-warnings",
32
+ "lint:fix": "oxlint . --fix --deny-warnings",
33
+ typecheck: "tsc -p tsconfig.json --noEmit"
34
+ },
35
+ devDependencies: {
36
+ "@types/node": "catalog:",
37
+ oxfmt: "catalog:",
38
+ oxlint: "catalog:",
39
+ "tsc-alias": "catalog:",
40
+ typescript: "catalog:"
41
+ },
42
+ engines: {
43
+ node: ">=22.0.0"
44
+ },
45
+ packageManager: "pnpm@10.0.0"
46
+ };
47
+ }
48
+ function operationsForTsLib(projectName) {
49
+ return [
50
+ {
51
+ kind: "writeJson",
52
+ to: "package.json",
53
+ value: packageJson(projectName),
54
+ multilineArrays: ["files"]
55
+ },
56
+ {
57
+ kind: "writeText",
58
+ to: "pnpm-workspace.yaml",
59
+ text: [
60
+ "packages:",
61
+ " - .",
62
+ "",
63
+ "catalog:",
64
+ ' "@types/node": ^24.0.0',
65
+ " oxfmt: ^0.56.0",
66
+ " oxlint: ^1.71.0",
67
+ " tsc-alias: ^1.8.17",
68
+ " typescript: ^5.8.0",
69
+ ""
70
+ ].join("\n")
71
+ },
72
+ {
73
+ kind: "writeJson",
74
+ to: "tsconfig.json",
75
+ value: {
76
+ compilerOptions: {
77
+ declaration: true,
78
+ declarationMap: true,
79
+ module: "NodeNext",
80
+ moduleResolution: "NodeNext",
81
+ noEmitOnError: true,
82
+ outDir: "dist",
83
+ paths: {
84
+ "@/*": ["./src/*"]
85
+ },
86
+ rootDir: "src",
87
+ skipLibCheck: false,
88
+ strict: true,
89
+ target: "ES2022",
90
+ types: ["node"]
91
+ },
92
+ include: ["src/**/*.ts"]
93
+ }
94
+ },
95
+ {
96
+ kind: "writeJson",
97
+ to: ".oxlintrc.json",
98
+ value: {
99
+ categories: {
100
+ correctness: "error",
101
+ suspicious: "error"
102
+ },
103
+ plugins: ["typescript", "oxc"]
104
+ }
105
+ },
106
+ {
107
+ kind: "writeJson",
108
+ to: ".oxfmtrc.json",
109
+ value: {
110
+ printWidth: 100,
111
+ singleQuote: false,
112
+ trailingComma: "none"
113
+ }
114
+ },
115
+ {
116
+ kind: "writeText",
117
+ to: ".gitignore",
118
+ text: ["node_modules", "dist", ".env", ""].join("\n")
119
+ },
120
+ {
121
+ kind: "copyFile",
122
+ from: "src/index.ts",
123
+ to: "src/index.ts"
124
+ },
125
+ {
126
+ kind: "writeJson",
127
+ to: ".project-kit/blueprint.json",
128
+ value: {
129
+ schemaVersion: 1,
130
+ preset: "ts-lib",
131
+ packageManager: "pnpm",
132
+ projectKind: "single-package",
133
+ features: [
134
+ "pnpm-catalog",
135
+ "oxc-format-lint",
136
+ "strict-typescript",
137
+ "root-check",
138
+ "fix-command",
139
+ "devcontainer",
140
+ "github-actions",
141
+ "dependabot"
142
+ ]
143
+ }
144
+ },
145
+ {
146
+ kind: "writeJson",
147
+ to: ".project-kit/generated-by.json",
148
+ value: generatedBy
149
+ },
150
+ {
151
+ kind: "writeJson",
152
+ to: ".devcontainer/devcontainer.json",
153
+ value: {
154
+ name: `${projectName} development`,
155
+ image: "mcr.microsoft.com/devcontainers/typescript-node:22",
156
+ postCreateCommand: "corepack enable && pnpm install",
157
+ customizations: {
158
+ vscode: {
159
+ extensions: ["oxc.oxc-vscode"]
160
+ }
161
+ }
162
+ }
163
+ },
164
+ {
165
+ kind: "writeText",
166
+ 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
+ },
192
+ {
193
+ kind: "writeText",
194
+ 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
+ }
209
+ ];
210
+ }
211
+ function templateSourceRoot() {
212
+ return path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "templates", "ts-lib");
213
+ }
214
+ export async function initTsLibProject(targetDir) {
215
+ await renderNewProject({
216
+ sourceRoot: templateSourceRoot(),
217
+ targetRoot: targetDir,
218
+ operations: operationsForTsLib(projectNameFromDir(targetDir))
219
+ });
220
+ }
@@ -0,0 +1,2 @@
1
+ export declare function initVueAppProject(targetDir: string): Promise<void>;
2
+ //# sourceMappingURL=vue-app.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,339 @@
1
+ import path from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { renderNewProject } from "./renderer.js";
4
+ const features = [
5
+ "pnpm-catalog",
6
+ "oxc-format-lint",
7
+ "strict-typescript",
8
+ "root-check",
9
+ "fix-command",
10
+ "devcontainer",
11
+ "github-actions",
12
+ "dependabot"
13
+ ];
14
+ const generatedBy = {
15
+ packageName: "@ykdz/template",
16
+ version: "0.0.0",
17
+ command: "template init --preset vue-app"
18
+ };
19
+ function projectNameFromDir(targetDir) {
20
+ return path.basename(path.resolve(targetDir));
21
+ }
22
+ function packageJson(projectName) {
23
+ return {
24
+ name: projectName,
25
+ version: "0.0.0",
26
+ private: true,
27
+ type: "module",
28
+ scripts: {
29
+ build: "vite build",
30
+ check: "pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm run build && pnpm run test && pnpm run test:e2e",
31
+ dev: "vite",
32
+ fix: "pnpm run format:write && pnpm run lint:fix",
33
+ "format:check": "oxfmt --check .",
34
+ "format:write": "oxfmt --write .",
35
+ lint: "oxlint . --deny-warnings",
36
+ "lint:fix": "oxlint . --fix --deny-warnings",
37
+ preview: "vite preview",
38
+ test: "vitest run",
39
+ "test:e2e": "pnpm run build && playwright test",
40
+ typecheck: "vue-tsc --build --noEmit"
41
+ },
42
+ dependencies: {
43
+ "@vueuse/core": "catalog:",
44
+ pinia: "catalog:",
45
+ vue: "catalog:"
46
+ },
47
+ devDependencies: {
48
+ "@playwright/test": "catalog:",
49
+ "@tailwindcss/vite": "catalog:",
50
+ "@types/node": "catalog:",
51
+ "@types/web-bluetooth": "catalog:",
52
+ "@vitejs/plugin-vue": "catalog:",
53
+ "@vue/tsconfig": "catalog:",
54
+ oxfmt: "catalog:",
55
+ oxlint: "catalog:",
56
+ tailwindcss: "catalog:",
57
+ typescript: "catalog:",
58
+ vite: "catalog:",
59
+ vitest: "catalog:",
60
+ "vue-tsc": "catalog:"
61
+ },
62
+ engines: {
63
+ node: ">=22.0.0"
64
+ },
65
+ packageManager: "pnpm@10.0.0"
66
+ };
67
+ }
68
+ function operationsForVueApp(projectName) {
69
+ return [
70
+ {
71
+ kind: "writeJson",
72
+ to: "package.json",
73
+ value: packageJson(projectName)
74
+ },
75
+ {
76
+ kind: "writeText",
77
+ to: "pnpm-workspace.yaml",
78
+ text: [
79
+ "packages:",
80
+ " - .",
81
+ "",
82
+ "allowBuilds:",
83
+ " esbuild: true",
84
+ "",
85
+ "catalog:",
86
+ ' "@playwright/test": ^1.57.0',
87
+ ' "@tailwindcss/vite": ^4.1.18',
88
+ ' "@types/node": ^24.0.0',
89
+ ' "@types/web-bluetooth": ^0.0.21',
90
+ ' "@vitejs/plugin-vue": ^6.0.2',
91
+ ' "@vue/tsconfig": ^0.8.1',
92
+ ' "@vueuse/core": ^14.1.0',
93
+ " oxfmt: ^0.56.0",
94
+ " oxlint: ^1.71.0",
95
+ " pinia: ^3.0.4",
96
+ " tailwindcss: ^4.1.18",
97
+ " typescript: ^5.8.0",
98
+ " vite: ^7.3.0",
99
+ " vitest: ^4.1.9",
100
+ " vue: ^3.5.26",
101
+ " vue-tsc: ^3.1.8",
102
+ ""
103
+ ].join("\n")
104
+ },
105
+ {
106
+ kind: "writeJson",
107
+ to: "tsconfig.json",
108
+ value: {
109
+ files: [],
110
+ references: [
111
+ { path: "./tsconfig.app.json" },
112
+ { path: "./tsconfig.test.json" },
113
+ { path: "./tsconfig.node.json" }
114
+ ]
115
+ }
116
+ },
117
+ {
118
+ kind: "writeJson",
119
+ to: "tsconfig.app.json",
120
+ value: {
121
+ extends: "@vue/tsconfig/tsconfig.dom.json",
122
+ compilerOptions: {
123
+ baseUrl: ".",
124
+ composite: true,
125
+ module: "ESNext",
126
+ moduleResolution: "Bundler",
127
+ noEmitOnError: true,
128
+ paths: {
129
+ "@/*": ["./src/*"]
130
+ },
131
+ skipLibCheck: false,
132
+ strict: true,
133
+ target: "ES2022",
134
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
135
+ types: ["web-bluetooth"]
136
+ },
137
+ include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue"]
138
+ }
139
+ },
140
+ {
141
+ kind: "writeJson",
142
+ to: "tsconfig.test.json",
143
+ value: {
144
+ extends: "./tsconfig.app.json",
145
+ compilerOptions: {
146
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
147
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.test.tsbuildinfo",
148
+ types: ["node", "vitest/globals", "web-bluetooth"]
149
+ },
150
+ include: ["env.d.ts", "src/**/*.ts", "src/**/*.vue", "test/**/*.ts"]
151
+ }
152
+ },
153
+ {
154
+ kind: "writeJson",
155
+ to: "tsconfig.node.json",
156
+ value: {
157
+ compilerOptions: {
158
+ composite: true,
159
+ module: "ESNext",
160
+ moduleResolution: "Bundler",
161
+ noEmitOnError: true,
162
+ lib: ["ESNext", "DOM", "DOM.Iterable"],
163
+ skipLibCheck: false,
164
+ strict: true,
165
+ target: "ES2022",
166
+ tsBuildInfoFile: "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
167
+ types: ["node"]
168
+ },
169
+ include: ["playwright.config.ts", "vite.config.ts", "vitest.config.ts"]
170
+ }
171
+ },
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
+ }
182
+ },
183
+ {
184
+ kind: "writeJson",
185
+ to: ".oxfmtrc.json",
186
+ value: {
187
+ printWidth: 100,
188
+ singleQuote: false,
189
+ trailingComma: "none"
190
+ }
191
+ },
192
+ {
193
+ kind: "writeText",
194
+ to: ".gitignore",
195
+ text: ["node_modules", "dist", "playwright-report", "test-results", ".env", ""].join("\n")
196
+ },
197
+ {
198
+ kind: "copyFile",
199
+ from: "env.d.ts",
200
+ to: "env.d.ts"
201
+ },
202
+ {
203
+ kind: "copyFile",
204
+ from: "index.html",
205
+ to: "index.html"
206
+ },
207
+ {
208
+ kind: "copyFile",
209
+ from: "playwright.config.ts",
210
+ to: "playwright.config.ts"
211
+ },
212
+ {
213
+ kind: "copyFile",
214
+ from: "vite.config.ts",
215
+ to: "vite.config.ts"
216
+ },
217
+ {
218
+ kind: "copyFile",
219
+ from: "vitest.config.ts",
220
+ to: "vitest.config.ts"
221
+ },
222
+ {
223
+ kind: "copyFile",
224
+ from: "src/App.vue",
225
+ to: "src/App.vue"
226
+ },
227
+ {
228
+ kind: "copyFile",
229
+ from: "src/main.ts",
230
+ to: "src/main.ts"
231
+ },
232
+ {
233
+ kind: "copyFile",
234
+ from: "src/style.css",
235
+ to: "src/style.css"
236
+ },
237
+ {
238
+ kind: "copyFile",
239
+ from: "src/stores/counter.ts",
240
+ to: "src/stores/counter.ts"
241
+ },
242
+ {
243
+ kind: "copyFile",
244
+ from: "test/app.test.ts",
245
+ to: "test/app.test.ts"
246
+ },
247
+ {
248
+ kind: "copyFile",
249
+ from: "test/e2e/app.spec.ts",
250
+ to: "test/e2e/app.spec.ts"
251
+ },
252
+ {
253
+ kind: "writeJson",
254
+ to: ".project-kit/blueprint.json",
255
+ value: {
256
+ schemaVersion: 1,
257
+ preset: "vue-app",
258
+ packageManager: "pnpm",
259
+ projectKind: "single-package",
260
+ features
261
+ }
262
+ },
263
+ {
264
+ kind: "writeJson",
265
+ to: ".project-kit/generated-by.json",
266
+ value: generatedBy
267
+ },
268
+ {
269
+ kind: "writeJson",
270
+ to: ".devcontainer/devcontainer.json",
271
+ value: {
272
+ name: `${projectName} Vue development`,
273
+ image: "mcr.microsoft.com/devcontainers/typescript-node:22",
274
+ postCreateCommand: "corepack enable && pnpm install && pnpm exec playwright install chromium",
275
+ customizations: {
276
+ vscode: {
277
+ extensions: ["Vue.volar", "oxc.oxc-vscode"]
278
+ }
279
+ }
280
+ }
281
+ },
282
+ {
283
+ kind: "writeText",
284
+ 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
+ },
311
+ {
312
+ kind: "writeText",
313
+ 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
+ }
328
+ ];
329
+ }
330
+ function templateSourceRoot() {
331
+ return path.join(path.dirname(fileURLToPath(import.meta.url)), "..", "templates", "vue-app");
332
+ }
333
+ export async function initVueAppProject(targetDir) {
334
+ await renderNewProject({
335
+ sourceRoot: templateSourceRoot(),
336
+ targetRoot: targetDir,
337
+ operations: operationsForVueApp(projectNameFromDir(targetDir))
338
+ });
339
+ }
@@ -0,0 +1,4 @@
1
+ export declare function initVueHonoAppProject(targetDir: string, options?: {
2
+ scope?: string;
3
+ }): Promise<void>;
4
+ //# sourceMappingURL=vue-hono-app.d.ts.map
@@ -0,0 +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"}