@ykdz/template 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/{cli.js → src/cli.js} +77 -56
- 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/{devcontainer.d.ts → src/devcontainer.d.ts} +1 -0
- package/dist/src/devcontainer.d.ts.map +1 -0
- package/dist/{devcontainer.js → src/devcontainer.js} +1 -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/{generation-context.d.ts → src/generation-context.d.ts} +2 -2
- package/dist/src/generation-context.d.ts.map +1 -0
- package/dist/{module-graph.d.ts → src/module-graph.d.ts} +0 -14
- package/dist/src/module-graph.d.ts.map +1 -0
- package/dist/src/module-graph.js +48 -0
- package/dist/{next-step-instructions.d.ts → src/next-step-instructions.d.ts} +2 -3
- package/dist/src/next-step-instructions.d.ts.map +1 -0
- package/dist/{next-step-instructions.js → src/next-step-instructions.js} +14 -24
- 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/{project-github.d.ts → src/project-github.d.ts} +0 -7
- package/dist/src/project-github.d.ts.map +1 -0
- package/dist/{project-github.js → src/project-github.js} +3 -36
- package/dist/src/renderer.d.ts.map +1 -0
- 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.map +1 -0
- package/dist/{toolchain-resolution.js → src/toolchain-resolution.js} +1 -1
- 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/{vue-hono-app.js → templates/vue-hono-app/projection.js} +250 -101
- package/package.json +29 -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/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/devcontainer.d.ts.map +0 -1
- package/dist/generation-context.d.ts.map +0 -1
- package/dist/hono-api.d.ts +0 -3
- package/dist/hono-api.d.ts.map +0 -1
- package/dist/hono-api.js +0 -210
- package/dist/module-graph.d.ts.map +0 -1
- package/dist/module-graph.js +0 -187
- package/dist/next-step-instructions.d.ts.map +0 -1
- package/dist/package-addition.d.ts.map +0 -1
- package/dist/package-addition.js +0 -560
- package/dist/project-github.d.ts.map +0 -1
- package/dist/renderer.d.ts.map +0 -1
- package/dist/rust-bin.d.ts +0 -8
- package/dist/rust-bin.d.ts.map +0 -1
- package/dist/rust-bin.js +0 -208
- package/dist/toolchain-resolution.d.ts.map +0 -1
- package/dist/ts-lib.d.ts +0 -8
- package/dist/ts-lib.d.ts.map +0 -1
- package/dist/ts-lib.js +0 -214
- package/dist/vue-app.d.ts +0 -3
- package/dist/vue-app.d.ts.map +0 -1
- package/dist/vue-app.js +0 -301
- package/dist/vue-hono-app.d.ts +0 -7
- package/dist/vue-hono-app.d.ts.map +0 -1
- 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/{generation-context.js → src/generation-context.js} +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
- /package/dist/{renderer.js → src/renderer.js} +0 -0
- /package/dist/{toolchain-resolution.d.ts → src/toolchain-resolution.d.ts} +0 -0
|
@@ -0,0 +1,377 @@
|
|
|
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 hono-api",
|
|
15
|
+
};
|
|
16
|
+
export const honoApiPresetMetadata = {
|
|
17
|
+
name: "hono-api",
|
|
18
|
+
title: "Hono API",
|
|
19
|
+
description: "Single-package Hono Node API with strict TypeScript tooling.",
|
|
20
|
+
generation: "supported",
|
|
21
|
+
supportedPackageManagers: ["pnpm"],
|
|
22
|
+
supportedProjectKinds: ["single-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
|
+
export function honoApiBlueprint() {
|
|
39
|
+
return {
|
|
40
|
+
schemaVersion: 1,
|
|
41
|
+
preset: "hono-api",
|
|
42
|
+
packageManager: "pnpm",
|
|
43
|
+
projectKind: "single-package",
|
|
44
|
+
features: [...honoApiPresetMetadata.features],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function projectHonoApiPackageScripts() {
|
|
48
|
+
return {
|
|
49
|
+
build: "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
50
|
+
check: renderRootCheckCommand(planNodeChecks("hono-api")),
|
|
51
|
+
fix: renderFixCommand(planNodeFixes("hono-api")),
|
|
52
|
+
"format:check": "oxfmt --check .",
|
|
53
|
+
"format:write": "oxfmt --write .",
|
|
54
|
+
lint: "oxlint . --deny-warnings",
|
|
55
|
+
"lint:fix": "oxlint . --fix --deny-warnings",
|
|
56
|
+
start: "node dist/server.js",
|
|
57
|
+
test: "vitest run",
|
|
58
|
+
typecheck: "tsc -p tsconfig.json --noEmit",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function packageJson(context, packageScripts) {
|
|
62
|
+
return {
|
|
63
|
+
name: context.projectName.value,
|
|
64
|
+
version: "0.0.0",
|
|
65
|
+
private: true,
|
|
66
|
+
type: "module",
|
|
67
|
+
scripts: packageScripts,
|
|
68
|
+
dependencies: {
|
|
69
|
+
"@hono/node-server": "catalog:",
|
|
70
|
+
hono: "catalog:",
|
|
71
|
+
},
|
|
72
|
+
devDependencies: {
|
|
73
|
+
"@types/node": "catalog:",
|
|
74
|
+
oxfmt: "catalog:",
|
|
75
|
+
oxlint: "catalog:",
|
|
76
|
+
"tsc-alias": "catalog:",
|
|
77
|
+
typescript: "catalog:",
|
|
78
|
+
vitest: "catalog:",
|
|
79
|
+
},
|
|
80
|
+
engines: {
|
|
81
|
+
node: context.toolchain.nodeLtsMajor.value,
|
|
82
|
+
},
|
|
83
|
+
packageManager: context.toolchain.packageManagerPin.value,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function generationRecord(context) {
|
|
87
|
+
return {
|
|
88
|
+
...generatedBy,
|
|
89
|
+
toolchain: {
|
|
90
|
+
nodeLtsMajor: context.toolchain.nodeLtsMajor.value,
|
|
91
|
+
packageManagerPin: context.toolchain.packageManagerPin.value,
|
|
92
|
+
source: context.toolchain.source,
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function operationsForHonoApi(context, packageScripts, checkPlan) {
|
|
97
|
+
const editorCustomization = editorCustomizationForCapabilities([
|
|
98
|
+
"oxc-format-lint",
|
|
99
|
+
"vitest",
|
|
100
|
+
]);
|
|
101
|
+
return [
|
|
102
|
+
{
|
|
103
|
+
kind: "writeJson",
|
|
104
|
+
to: "package.json",
|
|
105
|
+
value: packageJson(context, packageScripts),
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
kind: "writeText",
|
|
109
|
+
to: "pnpm-workspace.yaml",
|
|
110
|
+
text: renderGeneratedPnpmWorkspaceYaml({
|
|
111
|
+
dependencies: [
|
|
112
|
+
"@hono/node-server",
|
|
113
|
+
"@types/node",
|
|
114
|
+
"hono",
|
|
115
|
+
"oxfmt",
|
|
116
|
+
"oxlint",
|
|
117
|
+
"tsc-alias",
|
|
118
|
+
"typescript",
|
|
119
|
+
"vitest",
|
|
120
|
+
],
|
|
121
|
+
}),
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
kind: "writeJson",
|
|
125
|
+
to: "tsconfig.json",
|
|
126
|
+
value: {
|
|
127
|
+
compilerOptions: {
|
|
128
|
+
module: "NodeNext",
|
|
129
|
+
moduleResolution: "NodeNext",
|
|
130
|
+
noEmitOnError: true,
|
|
131
|
+
paths: {
|
|
132
|
+
"@/*": ["./src/*"],
|
|
133
|
+
},
|
|
134
|
+
skipLibCheck: false,
|
|
135
|
+
strict: true,
|
|
136
|
+
target: "ES2022",
|
|
137
|
+
types: ["node", "vitest/globals"],
|
|
138
|
+
},
|
|
139
|
+
include: ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
kind: "writeJson",
|
|
144
|
+
to: "tsconfig.build.json",
|
|
145
|
+
value: {
|
|
146
|
+
extends: "./tsconfig.json",
|
|
147
|
+
compilerOptions: {
|
|
148
|
+
outDir: "dist",
|
|
149
|
+
rootDir: "src",
|
|
150
|
+
types: ["node"],
|
|
151
|
+
},
|
|
152
|
+
include: ["src/**/*.ts"],
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
kind: "copyFile",
|
|
157
|
+
sourceRoot: "sharedOxc",
|
|
158
|
+
from: "node/oxlint.config.ts",
|
|
159
|
+
to: "oxlint.config.ts",
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
kind: "copyFile",
|
|
163
|
+
sourceRoot: "sharedOxc",
|
|
164
|
+
from: "oxfmt.config.ts",
|
|
165
|
+
to: "oxfmt.config.ts",
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
kind: "writeText",
|
|
169
|
+
to: ".gitignore",
|
|
170
|
+
text: ["node_modules", "dist", ".env", ""].join("\n"),
|
|
171
|
+
},
|
|
172
|
+
{ kind: "copyFile", from: "src/app.ts", to: "src/app.ts" },
|
|
173
|
+
{ kind: "copyFile", from: "src/server.ts", to: "src/server.ts" },
|
|
174
|
+
{ kind: "copyFile", from: "test/app.test.ts", to: "test/app.test.ts" },
|
|
175
|
+
{ kind: "copyFile", from: "vitest.config.ts", to: "vitest.config.ts" },
|
|
176
|
+
{
|
|
177
|
+
kind: "writeJson",
|
|
178
|
+
to: ".project-kit/blueprint.json",
|
|
179
|
+
value: honoApiBlueprint(),
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
kind: "writeJson",
|
|
183
|
+
to: ".project-kit/generated-by.json",
|
|
184
|
+
value: generationRecord(context),
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
kind: "writeJson",
|
|
188
|
+
to: ".devcontainer/devcontainer.json",
|
|
189
|
+
value: nodePnpmDevcontainer({
|
|
190
|
+
name: `${context.projectName.value} API development`,
|
|
191
|
+
nodeVersion: context.toolchain.nodeLtsMajor.value,
|
|
192
|
+
packageManagerPin: context.toolchain.packageManagerPin.value,
|
|
193
|
+
extensions: editorCustomization.extensions,
|
|
194
|
+
settings: editorCustomization.settings,
|
|
195
|
+
}),
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
kind: "writeJson",
|
|
199
|
+
to: ".vscode/extensions.json",
|
|
200
|
+
value: {
|
|
201
|
+
recommendations: editorCustomization.extensions,
|
|
202
|
+
},
|
|
203
|
+
multilineArrays: ["recommendations"],
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
kind: "writeJson",
|
|
207
|
+
to: ".vscode/settings.json",
|
|
208
|
+
value: editorCustomization.settings,
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
kind: "writeText",
|
|
212
|
+
to: ".github/workflows/check.yml",
|
|
213
|
+
text: projectCheckWorkflow({ checkPlan }),
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
kind: "writeText",
|
|
217
|
+
to: ".github/dependabot.yml",
|
|
218
|
+
text: projectDependabotConfig(dependencyMaintenancePolicy),
|
|
219
|
+
},
|
|
220
|
+
];
|
|
221
|
+
}
|
|
222
|
+
function packageAdditionOperations(packagePath, packageName, nodeVersion) {
|
|
223
|
+
return [
|
|
224
|
+
{
|
|
225
|
+
kind: "writeJson",
|
|
226
|
+
to: `${packagePath}/package.json`,
|
|
227
|
+
value: {
|
|
228
|
+
name: packageName,
|
|
229
|
+
version: "0.0.0",
|
|
230
|
+
private: true,
|
|
231
|
+
type: "module",
|
|
232
|
+
scripts: projectHonoApiPackageScripts(),
|
|
233
|
+
dependencies: {
|
|
234
|
+
"@hono/node-server": "catalog:",
|
|
235
|
+
hono: "catalog:",
|
|
236
|
+
},
|
|
237
|
+
devDependencies: {
|
|
238
|
+
"@types/node": "catalog:",
|
|
239
|
+
oxfmt: "catalog:",
|
|
240
|
+
oxlint: "catalog:",
|
|
241
|
+
"tsc-alias": "catalog:",
|
|
242
|
+
typescript: "catalog:",
|
|
243
|
+
vitest: "catalog:",
|
|
244
|
+
},
|
|
245
|
+
engines: {
|
|
246
|
+
node: nodeVersion,
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
kind: "writeJson",
|
|
252
|
+
to: `${packagePath}/tsconfig.json`,
|
|
253
|
+
value: {
|
|
254
|
+
compilerOptions: {
|
|
255
|
+
composite: true,
|
|
256
|
+
module: "NodeNext",
|
|
257
|
+
moduleResolution: "NodeNext",
|
|
258
|
+
noEmitOnError: true,
|
|
259
|
+
paths: {
|
|
260
|
+
"@/*": ["./src/*"],
|
|
261
|
+
},
|
|
262
|
+
skipLibCheck: false,
|
|
263
|
+
strict: true,
|
|
264
|
+
target: "ES2022",
|
|
265
|
+
types: ["node", "vitest/globals"],
|
|
266
|
+
},
|
|
267
|
+
include: ["src/**/*.ts", "test/**/*.ts", "vitest.config.ts"],
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
kind: "writeJson",
|
|
272
|
+
to: `${packagePath}/tsconfig.build.json`,
|
|
273
|
+
value: {
|
|
274
|
+
extends: "./tsconfig.json",
|
|
275
|
+
compilerOptions: {
|
|
276
|
+
outDir: "dist",
|
|
277
|
+
rootDir: "src",
|
|
278
|
+
types: ["node"],
|
|
279
|
+
},
|
|
280
|
+
include: ["src/**/*.ts"],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
kind: "copyFile",
|
|
285
|
+
sourceRoot: "sharedOxc",
|
|
286
|
+
from: "node/oxlint.config.ts",
|
|
287
|
+
to: `${packagePath}/oxlint.config.ts`,
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
kind: "copyFile",
|
|
291
|
+
sourceRoot: "sharedOxc",
|
|
292
|
+
from: "oxfmt.config.ts",
|
|
293
|
+
to: `${packagePath}/oxfmt.config.ts`,
|
|
294
|
+
},
|
|
295
|
+
{ kind: "copyFile", from: "src/app.ts", to: `${packagePath}/src/app.ts` },
|
|
296
|
+
{
|
|
297
|
+
kind: "copyFile",
|
|
298
|
+
from: "src/server.ts",
|
|
299
|
+
to: `${packagePath}/src/server.ts`,
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
kind: "copyFile",
|
|
303
|
+
from: "test/app.test.ts",
|
|
304
|
+
to: `${packagePath}/test/app.test.ts`,
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
kind: "copyFile",
|
|
308
|
+
from: "vitest.config.ts",
|
|
309
|
+
to: `${packagePath}/vitest.config.ts`,
|
|
310
|
+
},
|
|
311
|
+
];
|
|
312
|
+
}
|
|
313
|
+
function packageAdditionPlan(packageLeafName, packageName, nodeVersion) {
|
|
314
|
+
const packagePath = `apps/${packageLeafName}`;
|
|
315
|
+
return {
|
|
316
|
+
packagePath,
|
|
317
|
+
workspacePackageGlob: "apps/*",
|
|
318
|
+
rootTsconfigReferences: [`./${packagePath}/tsconfig.json`],
|
|
319
|
+
sourceRoot: templateSourceRoot(),
|
|
320
|
+
sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
|
|
321
|
+
operations: packageAdditionOperations(packagePath, packageName, nodeVersion),
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
function templateSourceRoot() {
|
|
325
|
+
const projectionDir = path.dirname(fileURLToPath(import.meta.url));
|
|
326
|
+
const publishedTemplateRoot = path.join(projectionDir, "..", "..", "..", "templates", "hono-api");
|
|
327
|
+
return existsSync(path.join(publishedTemplateRoot, "src", "app.ts"))
|
|
328
|
+
? publishedTemplateRoot
|
|
329
|
+
: projectionDir;
|
|
330
|
+
}
|
|
331
|
+
function sharedOxcSourceRoot() {
|
|
332
|
+
const projectionDir = path.dirname(fileURLToPath(import.meta.url));
|
|
333
|
+
const publishedSharedRoot = path.join(projectionDir, "..", "..", "..", "templates", "shared", "oxc");
|
|
334
|
+
return existsSync(path.join(publishedSharedRoot, "oxfmt.config.ts"))
|
|
335
|
+
? publishedSharedRoot
|
|
336
|
+
: path.join(projectionDir, "..", "shared", "oxc");
|
|
337
|
+
}
|
|
338
|
+
export const honoApiPresetProjection = {
|
|
339
|
+
metadata: honoApiPresetMetadata,
|
|
340
|
+
capabilities: {
|
|
341
|
+
packageAddition: {
|
|
342
|
+
planPackageAddition({ packageLeafName, packageName, nodeVersion, }) {
|
|
343
|
+
return packageAdditionPlan(packageLeafName, packageName, nodeVersion);
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
},
|
|
347
|
+
blueprint: honoApiBlueprint,
|
|
348
|
+
project(context) {
|
|
349
|
+
const checkPlan = planNodeChecks("hono-api");
|
|
350
|
+
const fixPlan = planNodeFixes("hono-api");
|
|
351
|
+
const packageScripts = projectHonoApiPackageScripts();
|
|
352
|
+
return {
|
|
353
|
+
sourceRoot: templateSourceRoot(),
|
|
354
|
+
sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
|
|
355
|
+
operations: operationsForHonoApi(context, packageScripts, checkPlan),
|
|
356
|
+
checkPlan,
|
|
357
|
+
fixPlan,
|
|
358
|
+
dependencyMaintenancePolicy,
|
|
359
|
+
packageScripts,
|
|
360
|
+
capabilities: {
|
|
361
|
+
rootCheck: true,
|
|
362
|
+
fixCommand: true,
|
|
363
|
+
githubActions: true,
|
|
364
|
+
dependabot: true,
|
|
365
|
+
devcontainer: true,
|
|
366
|
+
},
|
|
367
|
+
};
|
|
368
|
+
},
|
|
369
|
+
async render({ targetDir, plan }) {
|
|
370
|
+
await renderNewProject({
|
|
371
|
+
sourceRoot: plan.sourceRoot,
|
|
372
|
+
sourceRoots: plan.sourceRoots,
|
|
373
|
+
targetRoot: targetDir,
|
|
374
|
+
operations: [...plan.operations],
|
|
375
|
+
});
|
|
376
|
+
},
|
|
377
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CheckComponent, CheckPlan, FixComponent, FixPlan } from "../src/module-graph.js";
|
|
2
|
+
export type NodeCheckPlanTarget = "hono-api" | "vue-app" | "vue-hono-root" | "vue-hono-api" | "vue-hono-web";
|
|
3
|
+
export type NodeFixPlanTarget = "hono-api" | "vue-app" | "vue-hono-root" | "vue-hono-api" | "vue-hono-web";
|
|
4
|
+
export declare function selectNodeCheckComponents(target: NodeCheckPlanTarget): CheckComponent[];
|
|
5
|
+
export declare function selectNodeFixComponents(target: NodeFixPlanTarget): FixComponent[];
|
|
6
|
+
export declare function planNodeChecks(target: NodeCheckPlanTarget): CheckPlan;
|
|
7
|
+
export declare function planNodeFixes(target: NodeFixPlanTarget): FixPlan;
|
|
8
|
+
//# sourceMappingURL=projection-plans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection-plans.d.ts","sourceRoot":"","sources":["../../templates/projection-plans.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,SAAS,EAET,YAAY,EACZ,OAAO,EACR,MAAM,wBAAwB,CAAC;AAiBhC,MAAM,MAAM,mBAAmB,GAC3B,UAAU,GACV,SAAS,GACT,eAAe,GACf,cAAc,GACd,cAAc,CAAC;AAEnB,MAAM,MAAM,iBAAiB,GACzB,UAAU,GACV,SAAS,GACT,eAAe,GACf,cAAc,GACd,cAAc,CAAC;AA8BnB,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,mBAAmB,GAC1B,cAAc,EAAE,CAalB;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,iBAAiB,GACxB,YAAY,EAAE,CAYhB;AA4BD,wBAAgB,cAAc,CAAC,MAAM,EAAE,mBAAmB,GAAG,SAAS,CAKrE;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAEhE"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
const rootPackageBoundary = {
|
|
2
|
+
kind: "package-boundary",
|
|
3
|
+
path: ".",
|
|
4
|
+
};
|
|
5
|
+
const apiPackageBoundary = {
|
|
6
|
+
kind: "package-boundary",
|
|
7
|
+
path: "apps/api",
|
|
8
|
+
};
|
|
9
|
+
const webPackageBoundary = {
|
|
10
|
+
kind: "package-boundary",
|
|
11
|
+
path: "apps/web",
|
|
12
|
+
};
|
|
13
|
+
function honoApiCheckComponents(owner) {
|
|
14
|
+
return [
|
|
15
|
+
{ kind: "oxc-format-check", owner },
|
|
16
|
+
{ kind: "oxc-lint", owner },
|
|
17
|
+
{ kind: "typescript-typecheck", owner },
|
|
18
|
+
{ kind: "build", owner },
|
|
19
|
+
{ kind: "unit-test", owner },
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
function vueAppCheckComponents(owner) {
|
|
23
|
+
return [
|
|
24
|
+
{ kind: "oxc-format-check", owner },
|
|
25
|
+
{ kind: "oxc-lint", owner },
|
|
26
|
+
{ kind: "typescript-typecheck", owner },
|
|
27
|
+
{ kind: "build", owner },
|
|
28
|
+
{ kind: "unit-test", owner },
|
|
29
|
+
{ kind: "e2e-test", owner },
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
function nodeFixComponents(owner) {
|
|
33
|
+
return [
|
|
34
|
+
{ kind: "oxc-format-write", owner },
|
|
35
|
+
{ kind: "oxc-lint-fix", owner },
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
export function selectNodeCheckComponents(target) {
|
|
39
|
+
switch (target) {
|
|
40
|
+
case "hono-api":
|
|
41
|
+
return honoApiCheckComponents(rootPackageBoundary);
|
|
42
|
+
case "vue-app":
|
|
43
|
+
return vueAppCheckComponents(rootPackageBoundary);
|
|
44
|
+
case "vue-hono-root":
|
|
45
|
+
return [{ kind: "turbo-check", owner: rootPackageBoundary }];
|
|
46
|
+
case "vue-hono-api":
|
|
47
|
+
return honoApiCheckComponents(apiPackageBoundary);
|
|
48
|
+
case "vue-hono-web":
|
|
49
|
+
return vueAppCheckComponents(webPackageBoundary);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function selectNodeFixComponents(target) {
|
|
53
|
+
switch (target) {
|
|
54
|
+
case "hono-api":
|
|
55
|
+
case "vue-app":
|
|
56
|
+
return nodeFixComponents(rootPackageBoundary);
|
|
57
|
+
case "vue-hono-root":
|
|
58
|
+
return [{ kind: "turbo-fix", owner: rootPackageBoundary }];
|
|
59
|
+
case "vue-hono-api":
|
|
60
|
+
return nodeFixComponents(apiPackageBoundary);
|
|
61
|
+
case "vue-hono-web":
|
|
62
|
+
return nodeFixComponents(webPackageBoundary);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function checkEnvironmentNeeds(target) {
|
|
66
|
+
if (target === "vue-app") {
|
|
67
|
+
return [
|
|
68
|
+
{
|
|
69
|
+
kind: "playwright-browser-assets",
|
|
70
|
+
browser: "chromium",
|
|
71
|
+
owner: rootPackageBoundary,
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
}
|
|
75
|
+
if (target === "vue-hono-root" || target === "vue-hono-web") {
|
|
76
|
+
return [
|
|
77
|
+
{
|
|
78
|
+
kind: "playwright-browser-assets",
|
|
79
|
+
browser: "chromium",
|
|
80
|
+
owner: webPackageBoundary,
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
export function planNodeChecks(target) {
|
|
87
|
+
return {
|
|
88
|
+
components: selectNodeCheckComponents(target),
|
|
89
|
+
environmentNeeds: checkEnvironmentNeeds(target),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
export function planNodeFixes(target) {
|
|
93
|
+
return { components: selectNodeFixComponents(target) };
|
|
94
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BuiltInPreset } from "../src/declarations.js";
|
|
2
|
+
import type { GenerationContext } from "../src/generation-context.js";
|
|
3
|
+
import type { PresetProjection, PresetProjectionPlan } from "../src/preset-projection.js";
|
|
4
|
+
export declare const builtInPresetProjections: readonly PresetProjection[];
|
|
5
|
+
export declare const builtInPresetMetadata: readonly BuiltInPreset[];
|
|
6
|
+
export declare function findBuiltInPresetProjection(name: string): PresetProjection | undefined;
|
|
7
|
+
export declare function projectPresetThroughRegistry(context: GenerationContext): PresetProjectionPlan | undefined;
|
|
8
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../templates/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,KAAK,EACV,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,6BAA6B,CAAC;AA4BrC,eAAO,MAAM,wBAAwB,EAAE,SAAS,gBAAgB,EAM/D,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,SAAS,aAAa,EAGzD,CAAC;AAEF,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,GACX,gBAAgB,GAAG,SAAS,CAI9B;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,iBAAiB,GACzB,oBAAoB,GAAG,SAAS,CAElC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { honoApiPresetProjection } from "./hono-api/projection.js";
|
|
2
|
+
import { rustBinPresetProjection } from "./rust-bin/projection.js";
|
|
3
|
+
import { tsLibPresetProjection } from "./ts-lib/projection.js";
|
|
4
|
+
import { vueAppPresetProjection } from "./vue-app/projection.js";
|
|
5
|
+
import { vueHonoAppPresetProjection } from "./vue-hono-app/projection.js";
|
|
6
|
+
const futurePresetMetadata = [
|
|
7
|
+
{
|
|
8
|
+
name: "ts-app",
|
|
9
|
+
title: "TypeScript application",
|
|
10
|
+
description: "Future application preset metadata.",
|
|
11
|
+
generation: "future",
|
|
12
|
+
supportedPackageManagers: ["pnpm"],
|
|
13
|
+
supportedProjectKinds: ["single-package"],
|
|
14
|
+
features: [],
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "node-cli",
|
|
18
|
+
title: "Node.js CLI",
|
|
19
|
+
description: "Future command-line preset metadata.",
|
|
20
|
+
generation: "future",
|
|
21
|
+
supportedPackageManagers: ["pnpm"],
|
|
22
|
+
supportedProjectKinds: ["single-package"],
|
|
23
|
+
features: [],
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
export const builtInPresetProjections = [
|
|
27
|
+
tsLibPresetProjection,
|
|
28
|
+
honoApiPresetProjection,
|
|
29
|
+
vueAppPresetProjection,
|
|
30
|
+
vueHonoAppPresetProjection,
|
|
31
|
+
rustBinPresetProjection,
|
|
32
|
+
];
|
|
33
|
+
export const builtInPresetMetadata = [
|
|
34
|
+
...builtInPresetProjections.map((projection) => projection.metadata),
|
|
35
|
+
...futurePresetMetadata,
|
|
36
|
+
];
|
|
37
|
+
export function findBuiltInPresetProjection(name) {
|
|
38
|
+
return builtInPresetProjections.find((projection) => projection.metadata.name === name);
|
|
39
|
+
}
|
|
40
|
+
export function projectPresetThroughRegistry(context) {
|
|
41
|
+
return findBuiltInPresetProjection(context.preset)?.project(context);
|
|
42
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BuiltInPreset, ProjectBlueprint } from "../../src/declarations.js";
|
|
2
|
+
import { type CheckPlan, type FixPlan } from "../../src/module-graph.js";
|
|
3
|
+
import type { PresetProjection } from "../../src/preset-projection.js";
|
|
4
|
+
export declare const rustBinPresetMetadata: BuiltInPreset;
|
|
5
|
+
export declare function planRustBinChecks(): CheckPlan;
|
|
6
|
+
export declare function planRustBinFixes(): FixPlan;
|
|
7
|
+
export declare function rustBinBlueprint(): ProjectBlueprint;
|
|
8
|
+
export declare function projectRustBinPackageScripts(): Record<string, string>;
|
|
9
|
+
export declare const rustBinPresetProjection: PresetProjection;
|
|
10
|
+
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../templates/rust-bin/projection.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AAInC,OAAO,EACL,KAAK,SAAS,EAEd,KAAK,OAAO,EAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,gBAAgB,EAEjB,MAAM,gCAAgC,CAAC;AAcxC,eAAO,MAAM,qBAAqB,EAAE,aAiBnC,CAAC;AAuBF,wBAAgB,iBAAiB,IAAI,SAAS,CAS7C;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAI1C;AAED,wBAAgB,gBAAgB,IAAI,gBAAgB,CAQnD;AAED,wBAAgB,4BAA4B,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKrE;AAsMD,eAAO,MAAM,uBAAuB,EAAE,gBAwCrC,CAAC"}
|