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