@ykdz/template 0.0.13 → 0.0.15
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/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +7 -34
- package/node_modules/@ykdz/template-builtin-source/dist/templates/projection-plans.js +9 -8
- package/node_modules/@ykdz/template-builtin-source/dist/templates/rust-bin/projection.js +6 -4
- package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +5 -32
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vike-app/projection.js +4 -1
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +8 -36
- package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +27 -74
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/hono-api/turbo.json +8 -0
- package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +22 -11
- package/node_modules/@ykdz/template-builtin-source/templates/rust-bin/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/rust-bin/turbo.json +3 -0
- package/node_modules/@ykdz/template-builtin-source/templates/ts-lib/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/ts-lib/turbo.json +3 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vike-app/.github/workflows/check.yml +2 -2
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-app/turbo.json +11 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/api/turbo.json +8 -0
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/playwright.config.ts +1 -1
- package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/turbo.json +11 -0
- package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +4 -0
- package/node_modules/@ykdz/template-core/dist/module-graph.js +64 -4
- package/node_modules/@ykdz/template-core/dist/package-addition.js +23 -35
- package/node_modules/@ykdz/template-core/dist/package-linking.js +14 -8
- package/node_modules/@ykdz/template-core/dist/project-github.js +1 -1
- package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +160 -167
- package/node_modules/@ykdz/template-shared/dist/index.d.ts +4 -4
- package/node_modules/@ykdz/template-shared/dist/index.js +21 -12
- package/package.json +3 -3
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{env.d.ts → types/env.d.ts} +0 -0
- /package/node_modules/@ykdz/template-builtin-source/templates/vike-app/{global.d.ts → types/global.d.ts} +0 -0
package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/playwright.config.ts
CHANGED
|
@@ -26,7 +26,7 @@ export default defineConfig({
|
|
|
26
26
|
},
|
|
27
27
|
webServer: [
|
|
28
28
|
{
|
|
29
|
-
command: `pnpm --dir ../api run build && PORT=${apiPort} pnpm --dir ../api run start`,
|
|
29
|
+
command: `pnpm --dir ../api run build:run && PORT=${apiPort} pnpm --dir ../api run start`,
|
|
30
30
|
url: apiHealthUrl,
|
|
31
31
|
reuseExistingServer: false,
|
|
32
32
|
},
|
|
@@ -37,6 +37,10 @@ export type CheckPlan = {
|
|
|
37
37
|
export type FixPlan = {
|
|
38
38
|
readonly components: FixComponent[];
|
|
39
39
|
};
|
|
40
|
+
export declare function checkComponentTaskName(component: CheckComponent): string;
|
|
41
|
+
export declare function fixComponentTaskName(component: FixComponent): string;
|
|
42
|
+
export declare function renderCheckLeafCommand(component: CheckComponent): string;
|
|
43
|
+
export declare function renderFixLeafCommand(component: FixComponent): string;
|
|
40
44
|
export declare function renderRootCheckCommand(plan: CheckPlan): string;
|
|
41
45
|
export declare function renderFixCommand(plan: FixPlan): string;
|
|
42
46
|
export declare function renderPlaywrightBrowserInstallCommand(need: CheckEnvironmentNeed, options?: {
|
|
@@ -4,7 +4,61 @@ function renderTurboPackageFilter(owner) {
|
|
|
4
4
|
}
|
|
5
5
|
return `--filter './${owner.path}'`;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
export function checkComponentTaskName(component) {
|
|
8
|
+
return checkComponentTaskNames(component)[0] ?? "check:run";
|
|
9
|
+
}
|
|
10
|
+
function checkComponentTaskNames(component) {
|
|
11
|
+
switch (component.kind) {
|
|
12
|
+
case "typescript-typecheck":
|
|
13
|
+
case "turbo-package-typecheck":
|
|
14
|
+
return ["typecheck:run"];
|
|
15
|
+
case "oxc-lint":
|
|
16
|
+
case "cargo-clippy":
|
|
17
|
+
return ["lint:run"];
|
|
18
|
+
case "oxc-format-check":
|
|
19
|
+
case "rustfmt-check":
|
|
20
|
+
return ["format:check:run"];
|
|
21
|
+
case "build":
|
|
22
|
+
case "turbo-package-build":
|
|
23
|
+
return ["build:run"];
|
|
24
|
+
case "unit-test":
|
|
25
|
+
case "cargo-test":
|
|
26
|
+
case "turbo-package-test":
|
|
27
|
+
return ["test:run"];
|
|
28
|
+
case "e2e-test":
|
|
29
|
+
case "turbo-package-e2e-test":
|
|
30
|
+
return ["test:e2e:run"];
|
|
31
|
+
case "turbo-check":
|
|
32
|
+
case "turbo-package-check":
|
|
33
|
+
return [
|
|
34
|
+
"format:check:run",
|
|
35
|
+
"lint:run",
|
|
36
|
+
"typecheck:run",
|
|
37
|
+
"build:run",
|
|
38
|
+
"test:run",
|
|
39
|
+
"test:e2e:run",
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function fixComponentTaskName(component) {
|
|
44
|
+
return fixComponentTaskNames(component)[0] ?? "fix:run";
|
|
45
|
+
}
|
|
46
|
+
function fixComponentTaskNames(component) {
|
|
47
|
+
switch (component.kind) {
|
|
48
|
+
case "oxc-format-write":
|
|
49
|
+
case "rustfmt-write":
|
|
50
|
+
return ["format:write:run"];
|
|
51
|
+
case "oxc-lint-fix":
|
|
52
|
+
return ["lint:fix:run"];
|
|
53
|
+
case "turbo-fix":
|
|
54
|
+
case "turbo-package-fix":
|
|
55
|
+
return ["format:write:run", "lint:fix:run"];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function uniqueTaskNames(taskNames) {
|
|
59
|
+
return [...new Set(taskNames)];
|
|
60
|
+
}
|
|
61
|
+
export function renderCheckLeafCommand(component) {
|
|
8
62
|
switch (component.kind) {
|
|
9
63
|
case "typescript-typecheck":
|
|
10
64
|
return "pnpm run typecheck";
|
|
@@ -38,7 +92,7 @@ function renderCheckComponentCommand(component) {
|
|
|
38
92
|
return "cargo test --workspace";
|
|
39
93
|
}
|
|
40
94
|
}
|
|
41
|
-
function
|
|
95
|
+
export function renderFixLeafCommand(component) {
|
|
42
96
|
switch (component.kind) {
|
|
43
97
|
case "oxc-format-write":
|
|
44
98
|
return "pnpm run format:write";
|
|
@@ -53,10 +107,16 @@ function renderFixComponentCommand(component) {
|
|
|
53
107
|
}
|
|
54
108
|
}
|
|
55
109
|
export function renderRootCheckCommand(plan) {
|
|
56
|
-
return
|
|
110
|
+
return `turbo run ${uniqueTaskNames([
|
|
111
|
+
...plan.components.flatMap(checkComponentTaskNames),
|
|
112
|
+
"check:run",
|
|
113
|
+
]).join(" ")}`;
|
|
57
114
|
}
|
|
58
115
|
export function renderFixCommand(plan) {
|
|
59
|
-
return
|
|
116
|
+
return `turbo run ${uniqueTaskNames([
|
|
117
|
+
...plan.components.flatMap(fixComponentTaskNames),
|
|
118
|
+
"fix:run",
|
|
119
|
+
]).join(" ")}`;
|
|
60
120
|
}
|
|
61
121
|
function playwrightBrowserInstallArgs(need, options = {}) {
|
|
62
122
|
const installArgs = [
|
|
@@ -155,7 +155,8 @@ async function assertPackageLinkIntentConsumersAreTypeScriptBoundaries(options)
|
|
|
155
155
|
const hasTypeScriptPackageShape = isRecord(manifest) &&
|
|
156
156
|
manifest.type === "module" &&
|
|
157
157
|
isRecord(scripts) &&
|
|
158
|
-
typeof scripts.typecheck === "string"
|
|
158
|
+
(typeof scripts.typecheck === "string" ||
|
|
159
|
+
typeof scripts["typecheck:run"] === "string");
|
|
159
160
|
if (hasTypeScriptPackageShape) {
|
|
160
161
|
continue;
|
|
161
162
|
}
|
|
@@ -380,44 +381,20 @@ async function consumerManifestUpdatesForPackageLinkIntents(options) {
|
|
|
380
381
|
}
|
|
381
382
|
return updates;
|
|
382
383
|
}
|
|
383
|
-
function workspacePackageGlobsFromBlueprint(blueprint) {
|
|
384
|
-
const globs = [];
|
|
385
|
-
for (const packageDefinition of blueprint.packages ?? []) {
|
|
386
|
-
const [workspaceDir] = packageDefinition.path.split("/");
|
|
387
|
-
if (!workspaceDir) {
|
|
388
|
-
throw new Error(`Cannot update root Package Addition scripts: invalid package path ${packageDefinition.path}`);
|
|
389
|
-
}
|
|
390
|
-
const glob = `${workspaceDir}/*`;
|
|
391
|
-
if (!globs.includes(glob)) {
|
|
392
|
-
globs.push(glob);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
return globs;
|
|
396
|
-
}
|
|
397
|
-
function turboPackageTaskCommand(task, workspacePackageGlobs) {
|
|
398
|
-
const filters = workspacePackageGlobs.map((glob) => `--filter './${glob}'`);
|
|
399
|
-
const concurrency = task === "check" ? ["--concurrency=1"] : [];
|
|
400
|
-
return [`turbo run ${task}`, ...concurrency, ...filters].join(" ");
|
|
401
|
-
}
|
|
402
|
-
function rootScriptWithTurboPackageTask(script, task, workspacePackageGlobs) {
|
|
403
|
-
const commands = script.split(" && ");
|
|
404
|
-
const turboCommandIndex = commands.findIndex((command) => command.startsWith(`turbo run ${task}`));
|
|
405
|
-
if (turboCommandIndex === -1) {
|
|
406
|
-
throw new Error(`Cannot update root Package Addition scripts: scripts.${task} must run Turbo package tasks`);
|
|
407
|
-
}
|
|
408
|
-
commands[turboCommandIndex] = turboPackageTaskCommand(task, workspacePackageGlobs);
|
|
409
|
-
return commands.join(" && ");
|
|
410
|
-
}
|
|
411
384
|
function rootScriptWithTurboPackageTasks(options) {
|
|
412
385
|
const rootCommands = options.script
|
|
413
386
|
.split(" && ")
|
|
414
387
|
.filter((command) => !command.startsWith("turbo run "));
|
|
415
|
-
const
|
|
416
|
-
|
|
388
|
+
const turboCommand = [
|
|
389
|
+
"turbo run",
|
|
390
|
+
...options.taskNames,
|
|
391
|
+
...(options.concurrency === undefined ? [] : ["--concurrency=1"]),
|
|
392
|
+
].join(" ");
|
|
393
|
+
return [...rootCommands, turboCommand].join(" && ");
|
|
417
394
|
}
|
|
418
395
|
function rootPackageJsonWithPackageTaskFilters(input, blueprint) {
|
|
396
|
+
void blueprint;
|
|
419
397
|
assertRootPackageJson(input);
|
|
420
|
-
const workspacePackageGlobs = workspacePackageGlobsFromBlueprint(blueprint);
|
|
421
398
|
const checkScript = input.scripts.check;
|
|
422
399
|
const fixScript = input.scripts.fix;
|
|
423
400
|
if (checkScript === undefined || fixScript === undefined) {
|
|
@@ -429,10 +406,21 @@ function rootPackageJsonWithPackageTaskFilters(input, blueprint) {
|
|
|
429
406
|
...input.scripts,
|
|
430
407
|
check: rootScriptWithTurboPackageTasks({
|
|
431
408
|
script: checkScript,
|
|
432
|
-
taskNames: [
|
|
433
|
-
|
|
409
|
+
taskNames: [
|
|
410
|
+
"format:check:run",
|
|
411
|
+
"lint:run",
|
|
412
|
+
"typecheck:run",
|
|
413
|
+
"build:run",
|
|
414
|
+
"test:run",
|
|
415
|
+
"test:e2e:run",
|
|
416
|
+
"check:run",
|
|
417
|
+
],
|
|
418
|
+
concurrency: 1,
|
|
419
|
+
}),
|
|
420
|
+
fix: rootScriptWithTurboPackageTasks({
|
|
421
|
+
script: fixScript,
|
|
422
|
+
taskNames: ["format:write:run", "lint:fix:run", "fix:run"],
|
|
434
423
|
}),
|
|
435
|
-
fix: rootScriptWithTurboPackageTask(fixScript, "fix", workspacePackageGlobs),
|
|
436
424
|
},
|
|
437
425
|
};
|
|
438
426
|
}
|
|
@@ -67,16 +67,22 @@ export function planPackageLinks(definitions, intents = []) {
|
|
|
67
67
|
}
|
|
68
68
|
export function packageTurboTasks({ dependencyBuildsRequired, }) {
|
|
69
69
|
return {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
"format:check:run": {},
|
|
71
|
+
"format:write:run": { cache: false },
|
|
72
|
+
"lint:run": {},
|
|
73
|
+
"lint:fix:run": { cache: false },
|
|
74
|
+
"typecheck:run": { dependsOn: ["^typecheck:run"] },
|
|
75
|
+
"build:run": dependencyBuildsRequired
|
|
76
|
+
? { dependsOn: ["^build:run"], outputs: ["dist/**"] }
|
|
73
77
|
: { outputs: ["dist/**"] },
|
|
74
|
-
test: { dependsOn: ["^typecheck"] },
|
|
75
|
-
"test:e2e": {
|
|
76
|
-
dependsOn: dependencyBuildsRequired
|
|
78
|
+
"test:run": { dependsOn: ["^typecheck:run"] },
|
|
79
|
+
"test:e2e:run": {
|
|
80
|
+
dependsOn: dependencyBuildsRequired
|
|
81
|
+
? ["build:run", "^build:run"]
|
|
82
|
+
: ["build:run"],
|
|
77
83
|
},
|
|
78
|
-
check: {
|
|
79
|
-
fix: { cache: false },
|
|
84
|
+
"check:run": { cache: false },
|
|
85
|
+
"fix:run": { cache: false },
|
|
80
86
|
};
|
|
81
87
|
}
|
|
82
88
|
export function packageManifestExposureFields(exposure) {
|
|
@@ -29,7 +29,7 @@ export function projectCheckWorkflow(options) {
|
|
|
29
29
|
` ${capability.jobName}:`,
|
|
30
30
|
` runs-on: ${capability.runner}`,
|
|
31
31
|
" steps:",
|
|
32
|
-
" - uses: actions/checkout@
|
|
32
|
+
" - uses: actions/checkout@v7",
|
|
33
33
|
];
|
|
34
34
|
if (environmentPreparation.nodeFromPackageMetadata) {
|
|
35
35
|
lines.push(" - uses: actions/setup-node@v6", " with:", " node-version-file: package.json", " - run: corepack enable");
|