@ykdz/template 0.0.24 → 0.0.26
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-presets/dist/src/foundation.d.ts +3 -5
- package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +172 -165
- package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.js +4 -24
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.d.ts +0 -3
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.js +8 -26
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.js +5 -29
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.js +24 -50
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.js +2 -4
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.js +9 -26
- package/node_modules/@ykdz/template-builtin-presets/package.json +2 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-playwright.yml +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-rust.yml +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check.dynamic.template +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.dynamic.txt +1 -5
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.yaml +2 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/scripts/check-boundaries.ts +12 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/scripts/run-root-owned-task.ts +69 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/tsconfig.json +6 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/turbo.json +15 -8
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/Cargo.lock +2 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/Cargo.toml +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/shared/devcontainer/node-pnpm.Dockerfile +5 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-lib/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/turbo.json +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/turbo.json +2 -2
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/Dockerfile +5 -6
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/scripts/check-standalone-deployment.ts +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.json +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/turbo.json +3 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-app/.github/workflows/check.yml +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-app/turbo.json +3 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/api/turbo.json +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/web/playwright.config.ts +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/web/turbo.json +2 -2
- package/node_modules/@ykdz/template-core/dist/Cargo.lock +2 -2
- package/node_modules/@ykdz/template-core/dist/Cargo.toml +1 -1
- package/node_modules/@ykdz/template-core/dist/dependency-catalog.d.ts +0 -1
- package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +2 -8
- package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +39 -37
- package/node_modules/@ykdz/template-core/dist/module-graph.js +84 -142
- package/node_modules/@ykdz/template-core/dist/package-contribution.d.ts +3 -5
- package/node_modules/@ykdz/template-core/dist/package-contribution.js +7 -7
- package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +5 -7
- package/node_modules/@ykdz/template-core/dist/project-github.d.ts +11 -3
- package/node_modules/@ykdz/template-core/dist/project-github.js +31 -36
- package/node_modules/@ykdz/template-core/dist/project-linking-v2.d.ts +1 -1
- package/node_modules/@ykdz/template-core/dist/renderer.js +38 -21
- package/package.json +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.pnpmfile.cts +0 -14
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { renderPlaywrightBrowserInstallCommand, } from "./module-graph.js";
|
|
2
2
|
const defaultCiCapability = {
|
|
3
3
|
workflowName: "Check",
|
|
4
4
|
jobName: "check",
|
|
@@ -16,10 +16,10 @@ export function projectCheckWorkflow(options) {
|
|
|
16
16
|
...options.environmentPreparation,
|
|
17
17
|
};
|
|
18
18
|
const requiresRustToolchain = environmentPreparation.rustToolchain ||
|
|
19
|
-
options.
|
|
19
|
+
options.environment.needs.some((need) => need.kind === "rust-toolchain");
|
|
20
20
|
const taskLayer = options.taskLayer ?? pnpmTaskLayer;
|
|
21
|
-
const
|
|
22
|
-
const needsDocker =
|
|
21
|
+
const hasDeploymentTask = options.hasDeploymentTask === true;
|
|
22
|
+
const needsDocker = (options.deploymentEnvironmentNeeds ?? []).some((need) => need.kind === "docker-engine");
|
|
23
23
|
const lines = [
|
|
24
24
|
`name: ${capability.workflowName}`,
|
|
25
25
|
"",
|
|
@@ -32,42 +32,38 @@ export function projectCheckWorkflow(options) {
|
|
|
32
32
|
"jobs:",
|
|
33
33
|
` ${capability.jobName}:`,
|
|
34
34
|
` runs-on: ${capability.runner}`,
|
|
35
|
-
...(
|
|
36
|
-
? []
|
|
37
|
-
: [
|
|
38
|
-
" strategy:",
|
|
39
|
-
" matrix:",
|
|
40
|
-
" check: [root, deployment]",
|
|
41
|
-
]),
|
|
35
|
+
...(hasDeploymentTask
|
|
36
|
+
? [" strategy:", " matrix:", " check: [root, deployment]"]
|
|
37
|
+
: []),
|
|
42
38
|
" steps:",
|
|
43
39
|
" - uses: actions/checkout@v7",
|
|
44
40
|
];
|
|
45
41
|
if (environmentPreparation.nodeFromPackageMetadata) {
|
|
46
|
-
lines.push(" - uses: actions/setup-node@
|
|
42
|
+
lines.push(" - uses: actions/setup-node@v7", " with:", " node-version-file: package.json", " - run: corepack enable");
|
|
47
43
|
}
|
|
48
|
-
if (needsDocker) {
|
|
44
|
+
if (hasDeploymentTask && needsDocker) {
|
|
49
45
|
lines.push(" - uses: docker/setup-buildx-action@v3", " if: matrix.check == 'deployment'");
|
|
50
46
|
}
|
|
51
47
|
if (requiresRustToolchain)
|
|
52
48
|
lines.push(...rustCiPreparationLines());
|
|
53
49
|
lines.push(` - run: ${taskLayer.installCommand}`);
|
|
54
50
|
const checkEnvironmentLines = [];
|
|
55
|
-
for (const need of options.
|
|
56
|
-
if (need.kind === "rust-toolchain")
|
|
51
|
+
for (const need of options.environment.needs) {
|
|
52
|
+
if (need.kind === "rust-toolchain") {
|
|
57
53
|
continue;
|
|
54
|
+
}
|
|
58
55
|
checkEnvironmentLines.push(` - run: ${renderCiEnvironmentNeedCommand(need)}`);
|
|
59
|
-
if (
|
|
56
|
+
if (hasDeploymentTask && need.kind === "shellcheck-command") {
|
|
60
57
|
checkEnvironmentLines.push(" if: matrix.check == 'root'");
|
|
61
58
|
}
|
|
62
59
|
}
|
|
63
60
|
lines.push(...checkEnvironmentLines);
|
|
64
61
|
lines.push(` - run: ${taskLayer.checkCommand}`);
|
|
65
|
-
if (
|
|
62
|
+
if (hasDeploymentTask) {
|
|
66
63
|
lines.push(" if: matrix.check == 'root'");
|
|
67
64
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
lines.push(` - run: pnpm run ${deploymentCheckTaskName(deploymentCheck)}`, " if: matrix.check == 'deployment'");
|
|
65
|
+
if (hasDeploymentTask) {
|
|
66
|
+
lines.push(" - run: pnpm run check:deployment", " if: matrix.check == 'deployment'");
|
|
71
67
|
}
|
|
72
68
|
lines.push("");
|
|
73
69
|
return lines.join("\n");
|
|
@@ -83,15 +79,14 @@ function rustCiPreparationLines() {
|
|
|
83
79
|
/** Limited substitutions for the Foundation-owned workflow Template Source. */
|
|
84
80
|
export function projectCheckWorkflowTemplateReplacements(options) {
|
|
85
81
|
const requiresRustToolchain = options.environmentPreparation?.rustToolchain === true ||
|
|
86
|
-
options.
|
|
87
|
-
const
|
|
88
|
-
const needsDocker =
|
|
89
|
-
const
|
|
90
|
-
const environmentSteps = options.checkPlan.environmentNeeds
|
|
82
|
+
options.environment.needs.some((need) => need.kind === "rust-toolchain");
|
|
83
|
+
const hasDeploymentTask = options.hasDeploymentTask === true;
|
|
84
|
+
const needsDocker = (options.deploymentEnvironmentNeeds ?? []).some((need) => need.kind === "docker-engine");
|
|
85
|
+
const environmentSteps = options.environment.needs
|
|
91
86
|
.filter((need) => need.kind !== "rust-toolchain")
|
|
92
87
|
.map((need) => [
|
|
93
88
|
` - run: ${renderCiEnvironmentNeedCommand(need)}`,
|
|
94
|
-
...(
|
|
89
|
+
...(hasDeploymentTask && need.kind === "shellcheck-command"
|
|
95
90
|
? [" if: matrix.check == 'root'"]
|
|
96
91
|
: []),
|
|
97
92
|
].join("\n"));
|
|
@@ -100,18 +95,18 @@ export function projectCheckWorkflowTemplateReplacements(options) {
|
|
|
100
95
|
? `\n${rustCiPreparationLines().join("\n")}`
|
|
101
96
|
: "",
|
|
102
97
|
CHECK_ENVIRONMENT_PREPARATION: environmentSteps.length === 0 ? "" : `\n${environmentSteps.join("\n")}`,
|
|
103
|
-
DEPLOYMENT_MATRIX:
|
|
104
|
-
? ""
|
|
105
|
-
: "
|
|
106
|
-
DEPLOYMENT_DOCKER_PREPARATION: needsDocker
|
|
98
|
+
DEPLOYMENT_MATRIX: hasDeploymentTask
|
|
99
|
+
? "\n strategy:\n matrix:\n check: [root, deployment]"
|
|
100
|
+
: "",
|
|
101
|
+
DEPLOYMENT_DOCKER_PREPARATION: hasDeploymentTask && needsDocker
|
|
107
102
|
? "\n - uses: docker/setup-buildx-action@v3\n if: matrix.check == 'deployment'"
|
|
108
103
|
: "",
|
|
109
|
-
ROOT_CHECK_CONDITION:
|
|
110
|
-
? ""
|
|
111
|
-
: "
|
|
112
|
-
DEPLOYMENT_CHECK:
|
|
113
|
-
? ""
|
|
114
|
-
:
|
|
104
|
+
ROOT_CHECK_CONDITION: hasDeploymentTask
|
|
105
|
+
? "\n if: matrix.check == 'root'"
|
|
106
|
+
: "",
|
|
107
|
+
DEPLOYMENT_CHECK: hasDeploymentTask
|
|
108
|
+
? "\n - run: pnpm run check:deployment\n if: matrix.check == 'deployment'"
|
|
109
|
+
: "",
|
|
115
110
|
};
|
|
116
111
|
}
|
|
117
112
|
export function projectDependabotConfig(policy) {
|
|
@@ -4,7 +4,7 @@ export type ExplicitProjectLinkPlan = {
|
|
|
4
4
|
readonly manifestDependenciesByPackagePath: ReadonlyMap<string, Readonly<Record<string, "workspace:*">>>;
|
|
5
5
|
/**
|
|
6
6
|
* Build ordering follows the same explicit package relationships as manifest
|
|
7
|
-
* dependencies.
|
|
7
|
+
* dependencies. Turbo resolves ^build through the derived workspace
|
|
8
8
|
* dependency rather than through Preset or framework vocabulary.
|
|
9
9
|
*/
|
|
10
10
|
readonly hasBuildOrdering: boolean;
|
|
@@ -461,19 +461,27 @@ export async function renderProjectAtomically(options) {
|
|
|
461
461
|
const parent = path.dirname(targetRoot);
|
|
462
462
|
const stagingRoot = await mkdtemp(path.join(parent, `.${path.basename(targetRoot)}.template-update-`));
|
|
463
463
|
const backupRoot = await mkdtemp(path.join(parent, `.${path.basename(targetRoot)}.template-backup-`));
|
|
464
|
-
const
|
|
464
|
+
const changedPaths = changedOutputPaths(options.operations);
|
|
465
465
|
let committed = false;
|
|
466
466
|
try {
|
|
467
|
-
await cp(targetRoot, stagingRoot, {
|
|
467
|
+
await cp(targetRoot, stagingRoot, {
|
|
468
|
+
recursive: true,
|
|
469
|
+
filter: generatedDependencyTreeCopyFilter,
|
|
470
|
+
});
|
|
468
471
|
await renderProject({ ...options, targetRoot: stagingRoot });
|
|
469
|
-
// Commit only the
|
|
472
|
+
// Commit only the files changed by the staged plan. In particular, do
|
|
470
473
|
// not rename the target directory: callers commonly run `template add`
|
|
471
474
|
// from that directory, and renaming it leaves their shell on a deleted
|
|
472
|
-
// inode. Each
|
|
473
|
-
for (const
|
|
474
|
-
const current = path.join(targetRoot,
|
|
475
|
+
// inode. Each path has a rollback copy before it is made visible.
|
|
476
|
+
for (const changedPath of changedPaths) {
|
|
477
|
+
const current = path.join(targetRoot, changedPath);
|
|
475
478
|
try {
|
|
476
|
-
|
|
479
|
+
const backup = path.join(backupRoot, changedPath);
|
|
480
|
+
await mkdir(path.dirname(backup), { recursive: true });
|
|
481
|
+
await cp(current, backup, {
|
|
482
|
+
recursive: true,
|
|
483
|
+
filter: generatedDependencyTreeCopyFilter,
|
|
484
|
+
});
|
|
477
485
|
}
|
|
478
486
|
catch (error) {
|
|
479
487
|
if (!isNodeError(error) || error.code !== "ENOENT")
|
|
@@ -481,16 +489,19 @@ export async function renderProjectAtomically(options) {
|
|
|
481
489
|
}
|
|
482
490
|
}
|
|
483
491
|
try {
|
|
484
|
-
for (const
|
|
485
|
-
|
|
492
|
+
for (const changedPath of changedPaths) {
|
|
493
|
+
const target = path.join(targetRoot, changedPath);
|
|
494
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
495
|
+
await cp(path.join(stagingRoot, changedPath), target, {
|
|
486
496
|
recursive: true,
|
|
487
497
|
force: true,
|
|
498
|
+
filter: generatedDependencyTreeCopyFilter,
|
|
488
499
|
});
|
|
489
500
|
}
|
|
490
501
|
committed = true;
|
|
491
502
|
}
|
|
492
503
|
catch (error) {
|
|
493
|
-
await
|
|
504
|
+
await rollbackStagedPaths({ targetRoot, backupRoot, changedPaths });
|
|
494
505
|
throw error;
|
|
495
506
|
}
|
|
496
507
|
}
|
|
@@ -502,25 +513,31 @@ export async function renderProjectAtomically(options) {
|
|
|
502
513
|
await rm(stagingRoot, { recursive: true, force: true });
|
|
503
514
|
}
|
|
504
515
|
}
|
|
505
|
-
function
|
|
506
|
-
const
|
|
516
|
+
function changedOutputPaths(operations) {
|
|
517
|
+
const changedPaths = new Set();
|
|
507
518
|
for (const operation of operations) {
|
|
508
519
|
const outputPath = operation.kind === "setExecutable" || operation.kind === "replaceAnchors"
|
|
509
520
|
? operation.path
|
|
510
521
|
: operation.to;
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
entries.add(entry);
|
|
522
|
+
if (outputPath.length > 0)
|
|
523
|
+
changedPaths.add(path.normalize(outputPath));
|
|
514
524
|
}
|
|
515
|
-
return [...
|
|
525
|
+
return [...changedPaths];
|
|
516
526
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
527
|
+
function generatedDependencyTreeCopyFilter(source) {
|
|
528
|
+
return !source.split(/[\\/]/).includes("node_modules");
|
|
529
|
+
}
|
|
530
|
+
async function rollbackStagedPaths(options) {
|
|
531
|
+
for (const changedPath of options.changedPaths) {
|
|
532
|
+
const target = path.join(options.targetRoot, changedPath);
|
|
533
|
+
const backup = path.join(options.backupRoot, changedPath);
|
|
521
534
|
await rm(target, { recursive: true, force: true });
|
|
522
535
|
try {
|
|
523
|
-
await
|
|
536
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
537
|
+
await cp(backup, target, {
|
|
538
|
+
recursive: true,
|
|
539
|
+
filter: generatedDependencyTreeCopyFilter,
|
|
540
|
+
});
|
|
524
541
|
}
|
|
525
542
|
catch (error) {
|
|
526
543
|
if (!isNodeError(error) || error.code !== "ENOENT")
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const typeOnlyPeerOwners = new Set(["valibot"]);
|
|
2
|
-
|
|
3
|
-
function readPackage(pkg: {
|
|
4
|
-
name?: string;
|
|
5
|
-
peerDependencies?: Record<string, string>;
|
|
6
|
-
peerDependenciesMeta?: Record<string, unknown>;
|
|
7
|
-
}) {
|
|
8
|
-
if (!pkg.name || !typeOnlyPeerOwners.has(pkg.name)) return pkg;
|
|
9
|
-
delete pkg.peerDependencies?.typescript;
|
|
10
|
-
delete pkg.peerDependenciesMeta?.typescript;
|
|
11
|
-
return pkg;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default { hooks: { readPackage } };
|