@ykdz/template 0.0.17 → 0.0.19
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/cli.js +61 -24
- package/node_modules/@ykdz/template-builtin-source/dist/templates/registry.js +0 -2
- package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +4 -4
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.js +13 -2
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +6 -74
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +23 -22
- package/node_modules/@ykdz/template-builtin-source/package.json +41 -8
- package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +69 -282
- package/node_modules/@ykdz/template-builtin-source/templates/rust-bin/src/main.rs +5 -2
- package/node_modules/@ykdz/template-builtin-source/templates/rust-bin/turbo.json +2 -1
- package/node_modules/@ykdz/template-builtin-source/templates/ts-lib/turbo.json +2 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{drizzle.config.ts → db/drizzle.config.ts} +2 -2
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{database → db/src}/db.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/db/src/index.ts +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{database → db/src}/queries/todos.ts +4 -8
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{test → db/test}/todos.test.ts +2 -2
- package/node_modules/@ykdz/template-builtin-source/templates/{hono-api → vike-app/db}/turbo.json +2 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/index/+Page.telefunc.ts +3 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/index/+Page.vue +1 -2
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/playwright.config.ts +43 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/scripts/run-playwright.ts +62 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{server → web/server}/app.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{test → web/test}/e2e/app.spec.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/web/turbo.json +12 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{types → web/types}/global.d.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{vite.config.ts → web/vite.config.ts} +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/playwright.config.ts +16 -3
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/scripts/run-playwright.ts +38 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/turbo.json +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/api/turbo.json +1 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/playwright.config.ts +7 -9
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/scripts/run-playwright.ts +79 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/App.vue +4 -5
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/src/api.ts +9 -3
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/test/e2e/app.spec.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/turbo.json +1 -0
- package/node_modules/@ykdz/template-core/dist/Cargo.lock +16 -0
- package/node_modules/@ykdz/template-core/dist/Cargo.toml +12 -0
- package/node_modules/@ykdz/template-core/dist/dependency-catalog.d.ts +8 -0
- package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +63 -2
- package/node_modules/@ykdz/template-core/dist/generated-scenarios.d.ts +1 -1
- package/node_modules/@ykdz/template-core/dist/generated-scenarios.js +104 -26
- package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +1 -0
- package/node_modules/@ykdz/template-core/dist/module-graph.js +19 -12
- package/node_modules/@ykdz/template-core/dist/next-step-instructions.d.ts +8 -0
- package/node_modules/@ykdz/template-core/dist/next-step-instructions.js +65 -0
- package/node_modules/@ykdz/template-core/dist/package-addition.js +6 -12
- package/node_modules/@ykdz/template-core/dist/package-linking.d.ts +24 -0
- package/node_modules/@ykdz/template-core/dist/package-linking.js +35 -0
- package/node_modules/@ykdz/template-core/dist/preset-source.d.ts +2 -2
- package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +240 -153
- package/node_modules/@ykdz/template-core/dist/template-boundary-check.js +46 -10
- package/node_modules/@ykdz/template-core/package.json +9 -5
- package/node_modules/@ykdz/template-shared/dist/index.d.ts +3 -152
- package/node_modules/@ykdz/template-shared/dist/index.js +49 -305
- package/node_modules/@ykdz/template-shared/package.json +8 -4
- package/package.json +5 -5
- package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.d.ts +0 -6
- package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +0 -213
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/.github/dependabot.yml +0 -23
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/.github/workflows/check.yml +0 -19
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/src/app.ts +0 -5
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/src/server.ts +0 -15
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/test/app.test.ts +0 -10
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/vitest.config.ts +0 -15
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/playwright.config.ts +0 -23
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/playwright.package-addition.config.ts +0 -22
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{database → db/src}/schema.ts +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{+server.ts → web/+server.ts} +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{.env.example → web/.env.example} +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{assets → web/assets}/logo.svg +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{components → web/components}/CounterButton.vue +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{components → web/components}/PageShell.vue +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/+Head.vue +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/+Layout.vue +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/+config.ts +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{pages → web/pages}/tailwind.css +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{server → web/server}/api.ts +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{types → web/types}/env.d.ts +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{vitest.config.ts → web/vitest.config.ts} +0 -0
package/dist/cli.js
CHANGED
|
@@ -4,8 +4,8 @@ import path from "node:path";
|
|
|
4
4
|
import { createInterface } from "node:readline/promises";
|
|
5
5
|
import { builtInPresetProjectionSourceRoots, builtInPresets, findBuiltInPresetSourceManifestPreset, loadBuiltInPresetSourceManifest, projectBuiltInPresetSourcePreset, } from "@ykdz/template-builtin-source";
|
|
6
6
|
import { assembleGenerationContext, } from "@ykdz/template-core/generation-context";
|
|
7
|
+
import { formatNextStepInstructionsForCli, generatedFollowUpDocumentOperation, planNextStepInstructions, } from "@ykdz/template-core/next-step-instructions";
|
|
7
8
|
import { addPackage } from "@ykdz/template-core/package-addition";
|
|
8
|
-
import { planNextStepInstructionsForProjection, } from "@ykdz/template-core/preset-projection";
|
|
9
9
|
import { validateBuiltInPresetSourceManifest, validatePresetSourceManifest, } from "@ykdz/template-core/preset-source";
|
|
10
10
|
import { blueprintForPresetSourcePreset } from "@ykdz/template-core/projection-capabilities";
|
|
11
11
|
import { renderNewProject } from "@ykdz/template-core/renderer";
|
|
@@ -35,6 +35,7 @@ function usage() {
|
|
|
35
35
|
" --yes Accept defaults for non-interactive generation",
|
|
36
36
|
" --dry-run Print the planned generation without writing files",
|
|
37
37
|
" --json Print machine-readable output",
|
|
38
|
+
" --no-todo Do not write the generated follow-up TODO.md document",
|
|
38
39
|
"",
|
|
39
40
|
"Add package options:",
|
|
40
41
|
" --preset <name> Package preset to add",
|
|
@@ -87,6 +88,7 @@ function parseInitOptions(args) {
|
|
|
87
88
|
let yes = false;
|
|
88
89
|
let dryRun = false;
|
|
89
90
|
let json = false;
|
|
91
|
+
let todo = true;
|
|
90
92
|
let scope;
|
|
91
93
|
for (let index = 2; index < args.length; index += 1) {
|
|
92
94
|
const arg = args[index];
|
|
@@ -102,6 +104,10 @@ function parseInitOptions(args) {
|
|
|
102
104
|
json = true;
|
|
103
105
|
continue;
|
|
104
106
|
}
|
|
107
|
+
if (arg === "--no-todo") {
|
|
108
|
+
todo = false;
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
105
111
|
if (arg === "--scope") {
|
|
106
112
|
const value = args[index + 1];
|
|
107
113
|
if (!value) {
|
|
@@ -125,7 +131,7 @@ function parseInitOptions(args) {
|
|
|
125
131
|
if (!dir) {
|
|
126
132
|
throw new Error("init requires a target directory");
|
|
127
133
|
}
|
|
128
|
-
return { dir, preset, yes, dryRun, json, scope };
|
|
134
|
+
return { dir, preset, yes, dryRun, json, todo, scope };
|
|
129
135
|
}
|
|
130
136
|
function normalizeNpmScope(value) {
|
|
131
137
|
if (value !== value.trim() || /\s/.test(value)) {
|
|
@@ -188,19 +194,36 @@ function formatBlueprintSummary(targetDir, blueprint) {
|
|
|
188
194
|
...blueprint.features.map((feature) => ` - ${feature}`),
|
|
189
195
|
].join("\n");
|
|
190
196
|
}
|
|
191
|
-
function
|
|
192
|
-
|
|
197
|
+
function planProjectionNextSteps(targetDir, projectionPlan) {
|
|
198
|
+
return planNextStepInstructions({
|
|
193
199
|
targetDir,
|
|
194
|
-
|
|
200
|
+
projectionPlan,
|
|
195
201
|
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
202
|
+
}
|
|
203
|
+
function followUpDocumentPlan(options) {
|
|
204
|
+
return options.todo ? { enabled: true, path: "TODO.md" } : { enabled: false };
|
|
205
|
+
}
|
|
206
|
+
function displayPathFromCwd(filePath) {
|
|
207
|
+
const absolutePath = path.resolve(filePath);
|
|
208
|
+
const relativePath = path.relative(process.cwd(), absolutePath);
|
|
209
|
+
if (relativePath &&
|
|
210
|
+
!relativePath.startsWith("..") &&
|
|
211
|
+
!path.isAbsolute(relativePath)) {
|
|
212
|
+
return relativePath;
|
|
213
|
+
}
|
|
214
|
+
return absolutePath;
|
|
215
|
+
}
|
|
216
|
+
function followUpDocumentDisplayPath(options) {
|
|
217
|
+
return displayPathFromCwd(path.join(options.dir, "TODO.md"));
|
|
218
|
+
}
|
|
219
|
+
function formatFollowUpDocumentReport(options) {
|
|
220
|
+
const rows = [
|
|
221
|
+
["Enabled", options.todo ? "yes" : "no"],
|
|
222
|
+
];
|
|
223
|
+
if (options.todo) {
|
|
224
|
+
rows.push(["Path", followUpDocumentDisplayPath(options)]);
|
|
225
|
+
}
|
|
226
|
+
return ["Generated Follow-Up Document:", "", ...formatFieldRows(rows)].join("\n");
|
|
204
227
|
}
|
|
205
228
|
function toolchainReport(toolchain) {
|
|
206
229
|
return {
|
|
@@ -256,11 +279,15 @@ async function generateInitProject(options, generationContext) {
|
|
|
256
279
|
preset,
|
|
257
280
|
context: generationContext,
|
|
258
281
|
});
|
|
282
|
+
const nextStepPlan = planProjectionNextSteps(options.dir, plan);
|
|
283
|
+
const operations = options.todo
|
|
284
|
+
? [...plan.operations, generatedFollowUpDocumentOperation(nextStepPlan)]
|
|
285
|
+
: [...plan.operations];
|
|
259
286
|
await renderNewProject({
|
|
260
287
|
sourceRoot: plan.sourceRoot,
|
|
261
288
|
sourceRoots: plan.sourceRoots,
|
|
262
289
|
targetRoot: options.dir,
|
|
263
|
-
operations
|
|
290
|
+
operations,
|
|
264
291
|
});
|
|
265
292
|
}
|
|
266
293
|
function printInitComplete(options, blueprint, generationContext) {
|
|
@@ -271,10 +298,9 @@ function printInitComplete(options, blueprint, generationContext) {
|
|
|
271
298
|
if (!projectionPlan) {
|
|
272
299
|
throw new Error(`Missing Preset Projection plan: ${blueprint.preset}`);
|
|
273
300
|
}
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
});
|
|
301
|
+
const nextStepPlan = planProjectionNextSteps(options.dir, projectionPlan);
|
|
302
|
+
const nextSteps = nextStepPlan.steps;
|
|
303
|
+
const followUpDocument = followUpDocumentPlan(options);
|
|
278
304
|
if (options.json) {
|
|
279
305
|
printJson({
|
|
280
306
|
command: "init",
|
|
@@ -285,6 +311,7 @@ function printInitComplete(options, blueprint, generationContext) {
|
|
|
285
311
|
? { toolchain: toolchainReport(generationContext.toolchain) }
|
|
286
312
|
: {}),
|
|
287
313
|
nextSteps,
|
|
314
|
+
followUpDocument,
|
|
288
315
|
});
|
|
289
316
|
return;
|
|
290
317
|
}
|
|
@@ -301,7 +328,12 @@ function printInitComplete(options, blueprint, generationContext) {
|
|
|
301
328
|
console.log(formatToolchainReport(generationContext.toolchain));
|
|
302
329
|
}
|
|
303
330
|
console.log("");
|
|
304
|
-
|
|
331
|
+
if (options.todo) {
|
|
332
|
+
console.log(`Follow-up checklist written to ${followUpDocumentDisplayPath(options)}`);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
console.log(formatNextStepInstructionsForCli(nextStepPlan));
|
|
336
|
+
}
|
|
305
337
|
}
|
|
306
338
|
function isInteractiveTerminal() {
|
|
307
339
|
return process.stdin.isTTY && process.stdout.isTTY;
|
|
@@ -467,10 +499,9 @@ async function main(args) {
|
|
|
467
499
|
if (!projectionPlan) {
|
|
468
500
|
throw new Error(`Missing Preset Projection plan: ${blueprint.preset}`);
|
|
469
501
|
}
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
});
|
|
502
|
+
const nextStepPlan = planProjectionNextSteps(options.dir, projectionPlan);
|
|
503
|
+
const nextSteps = nextStepPlan.steps;
|
|
504
|
+
const followUpDocument = followUpDocumentPlan(options);
|
|
474
505
|
if (options.json) {
|
|
475
506
|
printJson({
|
|
476
507
|
command: "init",
|
|
@@ -481,6 +512,7 @@ async function main(args) {
|
|
|
481
512
|
? { toolchain: toolchainReport(generationContext.toolchain) }
|
|
482
513
|
: {}),
|
|
483
514
|
nextSteps,
|
|
515
|
+
followUpDocument,
|
|
484
516
|
});
|
|
485
517
|
return;
|
|
486
518
|
}
|
|
@@ -490,7 +522,12 @@ async function main(args) {
|
|
|
490
522
|
console.log(formatToolchainReport(generationContext.toolchain));
|
|
491
523
|
}
|
|
492
524
|
console.log("");
|
|
493
|
-
|
|
525
|
+
if (options.todo) {
|
|
526
|
+
console.log(formatFollowUpDocumentReport(options));
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
console.log(formatNextStepInstructionsForCli(nextStepPlan));
|
|
530
|
+
}
|
|
494
531
|
return;
|
|
495
532
|
}
|
|
496
533
|
if (!options.yes && (options.json || !isInteractiveTerminal())) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { honoApiPresetProjection } from "./hono-api/projection.js";
|
|
2
1
|
import { rustBinPresetProjection } from "./rust-bin/projection.js";
|
|
3
2
|
import { tsLibPresetProjection } from "./ts-lib/projection.js";
|
|
4
3
|
import { vikeAppPresetProjection } from "./vike-app/projection.js";
|
|
@@ -6,7 +5,6 @@ import { vueAppPresetProjection } from "./vue-app/projection.js";
|
|
|
6
5
|
import { vueHonoAppPresetProjection } from "./vue-hono-app/projection.js";
|
|
7
6
|
const testOnlyPresetProjections = [
|
|
8
7
|
tsLibPresetProjection,
|
|
9
|
-
honoApiPresetProjection,
|
|
10
8
|
vueAppPresetProjection,
|
|
11
9
|
vikeAppPresetProjection,
|
|
12
10
|
vueHonoAppPresetProjection,
|
|
@@ -53,11 +53,11 @@ export function tsLibBlueprint(options = { targetDir: process.cwd() }) {
|
|
|
53
53
|
}
|
|
54
54
|
export function projectTsLibPackageScripts() {
|
|
55
55
|
return {
|
|
56
|
-
"format:check:run": "oxfmt --
|
|
56
|
+
"format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
57
57
|
"format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
58
|
-
"lint:run": "oxlint --config ../../oxlint.config.ts .",
|
|
59
|
-
"lint:fix:run": "oxlint --config ../../oxlint.config.ts . --fix",
|
|
60
|
-
"typecheck:run": "tsc -p tsconfig.json --noEmit",
|
|
58
|
+
"lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
|
|
59
|
+
"lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
|
|
60
|
+
"typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
function packageAdditionOperations(packagePath, packageNameValue, nodeVersion) {
|
|
@@ -5,7 +5,7 @@ import { PackageAdditionSupport, } from "@ykdz/template-shared";
|
|
|
5
5
|
export const vikeAppPresetMetadata = {
|
|
6
6
|
name: "vike-app",
|
|
7
7
|
title: "Vike app",
|
|
8
|
-
description: "
|
|
8
|
+
description: "Vike, Hono, Telefunc, Drizzle, and Vue workspace with a separate database package.",
|
|
9
9
|
generation: "supported",
|
|
10
10
|
supportedPackageManagers: ["pnpm"],
|
|
11
11
|
supportedProjectKinds: ["multi-package"],
|
|
@@ -27,6 +27,9 @@ function projectNameFromDir(targetDir) {
|
|
|
27
27
|
function scopedPackageName(packageScope) {
|
|
28
28
|
return `@${packageScope}/web`;
|
|
29
29
|
}
|
|
30
|
+
function scopedDbPackageName(packageScope) {
|
|
31
|
+
return `@${packageScope}/db`;
|
|
32
|
+
}
|
|
30
33
|
export function vikeAppBlueprint(options = { targetDir: process.cwd() }) {
|
|
31
34
|
const projectName = projectNameFromDir(options.targetDir);
|
|
32
35
|
return {
|
|
@@ -35,7 +38,15 @@ export function vikeAppBlueprint(options = { targetDir: process.cwd() }) {
|
|
|
35
38
|
packageManager: "pnpm",
|
|
36
39
|
projectKind: "multi-package",
|
|
37
40
|
features: [...vikeAppPresetMetadata.features],
|
|
38
|
-
packages: [
|
|
41
|
+
packages: [
|
|
42
|
+
{ name: scopedPackageName(projectName), path: "apps/web" },
|
|
43
|
+
{
|
|
44
|
+
name: scopedDbPackageName(projectName),
|
|
45
|
+
path: "packages/db",
|
|
46
|
+
role: "shared-library",
|
|
47
|
+
sourcePreset: "ts-lib",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
39
50
|
};
|
|
40
51
|
}
|
|
41
52
|
export const vikeAppPresetProjection = {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
3
2
|
import path from "node:path";
|
|
4
3
|
import { fileURLToPath } from "node:url";
|
|
5
4
|
import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
|
|
@@ -49,76 +48,16 @@ export function projectVueAppPackageScripts() {
|
|
|
49
48
|
return {
|
|
50
49
|
"build:run": "vite build",
|
|
51
50
|
dev: "vite",
|
|
52
|
-
"format:check:run": "oxfmt --
|
|
51
|
+
"format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
53
52
|
"format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
54
|
-
"lint:run": "oxlint --config ../../oxlint.config.ts .",
|
|
55
|
-
"lint:fix:run": "oxlint --config ../../oxlint.config.ts . --fix",
|
|
53
|
+
"lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
|
|
54
|
+
"lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
|
|
56
55
|
preview: "vite preview",
|
|
57
|
-
"test:run": "vitest run",
|
|
56
|
+
"test:run": "vitest run --reporter=agent --silent=passed-only",
|
|
58
57
|
"test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
|
|
59
|
-
"typecheck:run": "vue-tsc --build --noEmit",
|
|
58
|
+
"typecheck:run": "vue-tsc --build --noEmit --pretty false",
|
|
60
59
|
};
|
|
61
60
|
}
|
|
62
|
-
function isNodeError(error) {
|
|
63
|
-
return error instanceof Error && "code" in error;
|
|
64
|
-
}
|
|
65
|
-
function localPortsFromText(text) {
|
|
66
|
-
return [
|
|
67
|
-
...text.matchAll(/port:\s*(\d+)/g),
|
|
68
|
-
...text.matchAll(/--port\s+(\d+)/g),
|
|
69
|
-
...text.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1):(\d+)/g),
|
|
70
|
-
].map((match) => Number(match[1]));
|
|
71
|
-
}
|
|
72
|
-
async function usedPlaywrightPorts(root, blueprint) {
|
|
73
|
-
const ports = new Set();
|
|
74
|
-
for (const projectPackage of blueprint.packages ?? []) {
|
|
75
|
-
try {
|
|
76
|
-
const configText = await readFile(path.join(root, projectPackage.path, "playwright.config.ts"), "utf8");
|
|
77
|
-
for (const port of localPortsFromText(configText)) {
|
|
78
|
-
ports.add(port);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
if (!isNodeError(error) || error.code !== "ENOENT") {
|
|
83
|
-
throw error;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return ports;
|
|
88
|
-
}
|
|
89
|
-
async function nextVuePreviewPort(root, blueprint) {
|
|
90
|
-
const usedPorts = await usedPlaywrightPorts(root, blueprint);
|
|
91
|
-
let port = 4173;
|
|
92
|
-
while (usedPorts.has(port)) {
|
|
93
|
-
port += 1;
|
|
94
|
-
}
|
|
95
|
-
return port;
|
|
96
|
-
}
|
|
97
|
-
function vueAppPlaywrightConfig(previewPort) {
|
|
98
|
-
return `import { defineConfig, devices } from "@playwright/test";
|
|
99
|
-
|
|
100
|
-
const previewUrl = "http://127.0.0.1:${previewPort}";
|
|
101
|
-
|
|
102
|
-
export default defineConfig({
|
|
103
|
-
testDir: "./test/e2e",
|
|
104
|
-
use: {
|
|
105
|
-
baseURL: previewUrl,
|
|
106
|
-
trace: "on-first-retry"
|
|
107
|
-
},
|
|
108
|
-
webServer: {
|
|
109
|
-
command: "pnpm run preview --host 127.0.0.1 --port ${previewPort}",
|
|
110
|
-
reuseExistingServer: !process.env.CI,
|
|
111
|
-
url: previewUrl
|
|
112
|
-
},
|
|
113
|
-
projects: [
|
|
114
|
-
{
|
|
115
|
-
name: "chromium",
|
|
116
|
-
use: { ...devices["Desktop Chrome"] }
|
|
117
|
-
}
|
|
118
|
-
]
|
|
119
|
-
});
|
|
120
|
-
`;
|
|
121
|
-
}
|
|
122
61
|
function packageAdditionOperations(packagePath, packageNameValue, nodeVersion) {
|
|
123
62
|
return [
|
|
124
63
|
{
|
|
@@ -289,9 +228,8 @@ function packageAdditionOperations(packagePath, packageNameValue, nodeVersion) {
|
|
|
289
228
|
},
|
|
290
229
|
];
|
|
291
230
|
}
|
|
292
|
-
async function packageAdditionPlan({
|
|
231
|
+
async function packageAdditionPlan({ packageName: packageNameValue, packagePath, nodeVersion, }) {
|
|
293
232
|
const [workspaceCollection] = packagePath.split("/");
|
|
294
|
-
const previewPort = await nextVuePreviewPort(root, blueprint);
|
|
295
233
|
return {
|
|
296
234
|
packagePath,
|
|
297
235
|
workspacePackageGlob: `${workspaceCollection}/*`,
|
|
@@ -300,12 +238,6 @@ async function packageAdditionPlan({ root, blueprint, packageName: packageNameVa
|
|
|
300
238
|
sourceRoot: templateSourceRoot(),
|
|
301
239
|
sourceRoots: { sharedOxc: sharedOxcSourceRoot() },
|
|
302
240
|
operations: packageAdditionOperations(packagePath, packageNameValue, nodeVersion),
|
|
303
|
-
textFiles: [
|
|
304
|
-
{
|
|
305
|
-
path: `${packagePath}/playwright.config.ts`,
|
|
306
|
-
text: vueAppPlaywrightConfig(previewPort),
|
|
307
|
-
},
|
|
308
|
-
],
|
|
309
241
|
};
|
|
310
242
|
}
|
|
311
243
|
function templateSourceRoot() {
|
package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { builtInPresetProjectionSourceRoots, loadBuiltInPresetProjectionDeclaration, } from "@ykdz/template-builtin-source";
|
|
3
|
-
import { playwrightBrowserAssetsEnvironmentNeed, renderFixCommand, renderRootCheckCommand, } from "@ykdz/template-core/module-graph";
|
|
3
|
+
import { playwrightBrowserAssetsEnvironmentNeed, renderFixCommand, renderRootCheckCommand, renderTurboRunCommand, } from "@ykdz/template-core/module-graph";
|
|
4
4
|
import { interpretPresetProjectionDeclaration } from "@ykdz/template-core/projection-capabilities";
|
|
5
5
|
import { renderNewProject } from "@ykdz/template-core/renderer";
|
|
6
6
|
import { PackageAdditionSupport, } from "@ykdz/template-shared";
|
|
7
7
|
export const vueHonoAppPresetMetadata = {
|
|
8
8
|
name: "vue-hono-app",
|
|
9
9
|
title: "Vue Hono app",
|
|
10
|
-
description: "Full-stack Vue and Hono workspace with
|
|
10
|
+
description: "Full-stack Vue and Hono workspace with separated app package boundaries.",
|
|
11
11
|
generation: "supported",
|
|
12
12
|
supportedPackageManagers: ["pnpm"],
|
|
13
13
|
supportedProjectKinds: ["multi-package"],
|
|
@@ -87,48 +87,49 @@ export function vueHonoAppBlueprint(options) {
|
|
|
87
87
|
}
|
|
88
88
|
export function projectVueHonoRootPackageScripts() {
|
|
89
89
|
return {
|
|
90
|
-
check: renderRootCheckCommand(planVueHonoRootChecks())
|
|
90
|
+
check: `pnpm run check:boundaries && ${renderRootCheckCommand(planVueHonoRootChecks())}`,
|
|
91
|
+
"check:boundaries": "turbo boundaries --no-color",
|
|
91
92
|
"check:run": 'node -e ""',
|
|
92
93
|
dev: "turbo run dev --parallel",
|
|
93
94
|
fix: renderFixCommand(planVueHonoRootFixes()),
|
|
94
95
|
"fix:run": 'node -e ""',
|
|
95
|
-
"format:check": "
|
|
96
|
-
"format:check:run": "oxfmt --
|
|
97
|
-
"format:write": "
|
|
96
|
+
"format:check": renderTurboRunCommand(["format:check:run"]),
|
|
97
|
+
"format:check:run": "oxfmt --list-different oxlint.config.ts oxfmt.config.ts",
|
|
98
|
+
"format:write": renderTurboRunCommand(["format:write:run"]),
|
|
98
99
|
"format:write:run": "oxfmt --write oxlint.config.ts oxfmt.config.ts",
|
|
99
|
-
lint: "
|
|
100
|
-
"lint:fix": "
|
|
101
|
-
"lint:fix:run": "oxlint oxlint.config.ts oxfmt.config.ts --fix",
|
|
102
|
-
"lint:run": "oxlint oxlint.config.ts oxfmt.config.ts",
|
|
103
|
-
typecheck: "
|
|
104
|
-
"typecheck:run": "tsc -p tsconfig.config.json --noEmit",
|
|
100
|
+
lint: renderTurboRunCommand(["lint:run"]),
|
|
101
|
+
"lint:fix": renderTurboRunCommand(["lint:fix:run"]),
|
|
102
|
+
"lint:fix:run": "oxlint --format=unix oxlint.config.ts oxfmt.config.ts --fix",
|
|
103
|
+
"lint:run": "oxlint --quiet --format=unix oxlint.config.ts oxfmt.config.ts",
|
|
104
|
+
typecheck: renderTurboRunCommand(["typecheck:run"]),
|
|
105
|
+
"typecheck:run": "tsc -p tsconfig.config.json --noEmit --pretty false",
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
108
|
export function projectVueHonoApiPackageScripts() {
|
|
108
109
|
return {
|
|
109
110
|
"build:run": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
|
|
110
111
|
dev: "tsx watch src/server.ts",
|
|
111
|
-
"format:check:run": "oxfmt --
|
|
112
|
+
"format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
112
113
|
"format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
113
|
-
"lint:run": "oxlint --config ../../oxlint.config.ts .",
|
|
114
|
-
"lint:fix:run": "oxlint --config ../../oxlint.config.ts . --fix",
|
|
114
|
+
"lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
|
|
115
|
+
"lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
|
|
115
116
|
start: "node dist/server.js",
|
|
116
|
-
"test:run": "vitest run",
|
|
117
|
-
"typecheck:run": "tsc -p tsconfig.json --noEmit",
|
|
117
|
+
"test:run": "vitest run --reporter=agent --silent=passed-only",
|
|
118
|
+
"typecheck:run": "tsc -p tsconfig.json --noEmit --pretty false",
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
121
|
export function projectVueHonoWebPackageScripts() {
|
|
121
122
|
return {
|
|
122
123
|
"build:run": "vite build",
|
|
123
124
|
dev: "vite",
|
|
124
|
-
"format:check:run": "oxfmt --
|
|
125
|
+
"format:check:run": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
125
126
|
"format:write:run": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
126
|
-
"lint:run": "oxlint --config ../../oxlint.config.ts .",
|
|
127
|
-
"lint:fix:run": "oxlint --config ../../oxlint.config.ts . --fix",
|
|
127
|
+
"lint:run": "oxlint --quiet --format=unix --config ../../oxlint.config.ts .",
|
|
128
|
+
"lint:fix:run": "oxlint --format=unix --config ../../oxlint.config.ts . --fix",
|
|
128
129
|
preview: "vite preview",
|
|
129
|
-
"test:run": "vitest run",
|
|
130
|
+
"test:run": "vitest run --reporter=agent --silent=passed-only",
|
|
130
131
|
"test:e2e:run": "node --experimental-strip-types scripts/run-playwright.ts",
|
|
131
|
-
"typecheck:run": "vue-tsc --build",
|
|
132
|
+
"typecheck:run": "vue-tsc --build --pretty false",
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
135
|
export const vueHonoAppPresetProjection = {
|
|
@@ -9,24 +9,41 @@
|
|
|
9
9
|
"!templates/registry.ts",
|
|
10
10
|
"!templates/projection-plans.ts",
|
|
11
11
|
"!templates/*/projection.ts",
|
|
12
|
+
"!templates/*/behavior.test.ts",
|
|
12
13
|
"!templates/shared/oxc/tsconfig.json",
|
|
13
14
|
"!templates/**/node_modules"
|
|
14
15
|
],
|
|
15
16
|
"type": "module",
|
|
16
17
|
"exports": {
|
|
17
18
|
".": {
|
|
19
|
+
"source": {
|
|
20
|
+
"types": "./src/index.ts",
|
|
21
|
+
"default": "./src/index.ts"
|
|
22
|
+
},
|
|
18
23
|
"types": "./dist/src/index.d.ts",
|
|
19
24
|
"default": "./dist/src/index.js"
|
|
20
25
|
},
|
|
21
26
|
"./registry": {
|
|
27
|
+
"source": {
|
|
28
|
+
"types": "./templates/registry.ts",
|
|
29
|
+
"default": "./templates/registry.ts"
|
|
30
|
+
},
|
|
22
31
|
"types": "./dist/templates/registry.d.ts",
|
|
23
32
|
"default": "./dist/templates/registry.js"
|
|
24
33
|
},
|
|
25
34
|
"./projection-plans": {
|
|
35
|
+
"source": {
|
|
36
|
+
"types": "./templates/projection-plans.ts",
|
|
37
|
+
"default": "./templates/projection-plans.ts"
|
|
38
|
+
},
|
|
26
39
|
"types": "./dist/templates/projection-plans.d.ts",
|
|
27
40
|
"default": "./dist/templates/projection-plans.js"
|
|
28
41
|
},
|
|
29
42
|
"./templates/*": {
|
|
43
|
+
"source": {
|
|
44
|
+
"types": "./templates/*.ts",
|
|
45
|
+
"default": "./templates/*.ts"
|
|
46
|
+
},
|
|
30
47
|
"types": "./dist/templates/*.d.ts",
|
|
31
48
|
"default": "./dist/templates/*.js"
|
|
32
49
|
}
|
|
@@ -35,15 +52,15 @@
|
|
|
35
52
|
"build": "rm -rf dist && tsc -p tsconfig.build.json",
|
|
36
53
|
"check:templates": "pnpm run check:templates:shared-oxc && pnpm run check:templates:static-source",
|
|
37
54
|
"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",
|
|
38
|
-
"check:templates:shared-oxc:format": "oxfmt --
|
|
39
|
-
"check:templates:shared-oxc:lint": "oxlint --config templates/shared/oxc/node/oxlint.config.ts templates/shared/oxc",
|
|
40
|
-
"check:templates:shared-oxc:typecheck": "tsc -p templates/shared/oxc/tsconfig.json --noEmit",
|
|
55
|
+
"check:templates:shared-oxc:format": "oxfmt --list-different templates/shared/oxc",
|
|
56
|
+
"check:templates:shared-oxc:lint": "oxlint --quiet --format=unix --config templates/shared/oxc/node/oxlint.config.ts templates/shared/oxc",
|
|
57
|
+
"check:templates:shared-oxc:typecheck": "tsc -p templates/shared/oxc/tsconfig.json --noEmit --pretty false",
|
|
41
58
|
"check:templates:static-source": "rustup run stable rustfmt --check templates/rust-bin/src/main.rs",
|
|
42
|
-
"format:check": "oxfmt --
|
|
59
|
+
"format:check": "oxfmt --list-different --config ../../oxfmt.config.ts .",
|
|
43
60
|
"format:write": "oxfmt --write --config ../../oxfmt.config.ts .",
|
|
44
|
-
"lint": "oxlint --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts",
|
|
45
|
-
"lint:fix": "oxlint --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts --fix",
|
|
46
|
-
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
61
|
+
"lint": "oxlint --quiet --format=unix --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts templates/*/behavior.test.ts",
|
|
62
|
+
"lint:fix": "oxlint --format=unix --config ../../oxlint.config.ts src templates/projection-plans.ts templates/registry.ts templates/*/projection.ts templates/*/behavior.test.ts --fix",
|
|
63
|
+
"typecheck": "tsc -p tsconfig.json --noEmit --pretty false"
|
|
47
64
|
},
|
|
48
65
|
"dependencies": {
|
|
49
66
|
"@ykdz/template-core": "workspace:*",
|
|
@@ -52,9 +69,25 @@
|
|
|
52
69
|
"valibot": "catalog:"
|
|
53
70
|
},
|
|
54
71
|
"devDependencies": {
|
|
72
|
+
"@hono/node-server": "catalog:",
|
|
73
|
+
"@playwright/test": "catalog:",
|
|
74
|
+
"@tailwindcss/vite": "catalog:",
|
|
55
75
|
"@types/node": "catalog:",
|
|
76
|
+
"@vikejs/hono": "catalog:",
|
|
77
|
+
"@vitejs/plugin-vue": "catalog:",
|
|
78
|
+
"drizzle-kit": "catalog:",
|
|
79
|
+
"drizzle-orm": "catalog:",
|
|
80
|
+
"hono": "catalog:",
|
|
56
81
|
"oxfmt": "catalog:",
|
|
57
82
|
"oxlint": "catalog:",
|
|
58
|
-
"oxlint-tsgolint": "catalog:"
|
|
83
|
+
"oxlint-tsgolint": "catalog:",
|
|
84
|
+
"pinia": "catalog:",
|
|
85
|
+
"telefunc": "catalog:",
|
|
86
|
+
"vike": "catalog:",
|
|
87
|
+
"vike-vue": "catalog:",
|
|
88
|
+
"vite": "catalog:",
|
|
89
|
+
"vitest": "catalog:",
|
|
90
|
+
"vue": "catalog:",
|
|
91
|
+
"yaml": "catalog:"
|
|
59
92
|
}
|
|
60
93
|
}
|