@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.
Files changed (51) hide show
  1. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.d.ts +3 -5
  2. package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +172 -165
  3. package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.js +4 -24
  4. package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.d.ts +0 -3
  5. package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.js +8 -26
  6. package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.js +5 -29
  7. package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.js +24 -50
  8. package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.js +2 -4
  9. package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.js +9 -26
  10. package/node_modules/@ykdz/template-builtin-presets/package.json +2 -1
  11. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-playwright.yml +1 -1
  12. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-rust.yml +1 -1
  13. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check.dynamic.template +1 -1
  14. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check.yml +1 -1
  15. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.dynamic.txt +1 -5
  16. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/pnpm-workspace.yaml +2 -3
  17. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/scripts/check-boundaries.ts +12 -0
  18. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/scripts/run-root-owned-task.ts +69 -0
  19. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/tsconfig.json +6 -1
  20. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/turbo.json +15 -8
  21. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/.github/workflows/check.yml +1 -1
  22. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/Cargo.lock +2 -2
  23. package/node_modules/@ykdz/template-builtin-presets/templates/rust-bin/Cargo.toml +1 -1
  24. package/node_modules/@ykdz/template-builtin-presets/templates/shared/devcontainer/node-pnpm.Dockerfile +5 -2
  25. package/node_modules/@ykdz/template-builtin-presets/templates/ts-lib/.github/workflows/check.yml +1 -1
  26. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db/turbo.json +1 -1
  27. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/db-migrations/turbo.json +2 -2
  28. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/Dockerfile +5 -6
  29. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/scripts/check-standalone-deployment.ts +1 -1
  30. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/tsconfig.json +1 -1
  31. package/node_modules/@ykdz/template-builtin-presets/templates/vike-app/web/turbo.json +3 -3
  32. package/node_modules/@ykdz/template-builtin-presets/templates/vue-app/.github/workflows/check.yml +1 -1
  33. package/node_modules/@ykdz/template-builtin-presets/templates/vue-app/turbo.json +3 -3
  34. package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/api/turbo.json +1 -1
  35. package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/web/playwright.config.ts +1 -1
  36. package/node_modules/@ykdz/template-builtin-presets/templates/vue-hono-app/web/turbo.json +2 -2
  37. package/node_modules/@ykdz/template-core/dist/Cargo.lock +2 -2
  38. package/node_modules/@ykdz/template-core/dist/Cargo.toml +1 -1
  39. package/node_modules/@ykdz/template-core/dist/dependency-catalog.d.ts +0 -1
  40. package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +2 -8
  41. package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +39 -37
  42. package/node_modules/@ykdz/template-core/dist/module-graph.js +84 -142
  43. package/node_modules/@ykdz/template-core/dist/package-contribution.d.ts +3 -5
  44. package/node_modules/@ykdz/template-core/dist/package-contribution.js +7 -7
  45. package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +5 -7
  46. package/node_modules/@ykdz/template-core/dist/project-github.d.ts +11 -3
  47. package/node_modules/@ykdz/template-core/dist/project-github.js +31 -36
  48. package/node_modules/@ykdz/template-core/dist/project-linking-v2.d.ts +1 -1
  49. package/node_modules/@ykdz/template-core/dist/renderer.js +38 -21
  50. package/package.json +1 -1
  51. package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.pnpmfile.cts +0 -14
@@ -1,4 +1,4 @@
1
- import { deploymentCheckEnvironmentNeeds, deploymentCheckTaskName, renderPlaywrightBrowserInstallCommand, } from "./module-graph.js";
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.checkPlan.environmentNeeds.some((need) => need.kind === "rust-toolchain");
19
+ options.environment.needs.some((need) => need.kind === "rust-toolchain");
20
20
  const taskLayer = options.taskLayer ?? pnpmTaskLayer;
21
- const deploymentChecks = options.checkPlan.deploymentChecks ?? [];
22
- const needsDocker = deploymentChecks.some((check) => deploymentCheckEnvironmentNeeds(check).some((need) => need.kind === "docker-engine"));
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
- ...(deploymentChecks.length === 0
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@v6", " with:", " node-version-file: package.json", " - run: corepack enable");
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.checkPlan.environmentNeeds) {
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 (deploymentChecks.length > 0 && need.kind === "shellcheck-command") {
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 (deploymentChecks.length > 0) {
62
+ if (hasDeploymentTask) {
66
63
  lines.push(" if: matrix.check == 'root'");
67
64
  }
68
- const deploymentCheck = deploymentChecks[0];
69
- if (deploymentCheck !== undefined) {
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.checkPlan.environmentNeeds.some((need) => need.kind === "rust-toolchain");
87
- const deploymentChecks = options.checkPlan.deploymentChecks ?? [];
88
- const needsDocker = deploymentChecks.some((check) => deploymentCheckEnvironmentNeeds(check).some((need) => need.kind === "docker-engine"));
89
- const deploymentCheck = deploymentChecks[0];
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
- ...(deploymentChecks.length > 0 && need.kind === "shellcheck-command"
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: deploymentChecks.length === 0
104
- ? ""
105
- : "\n strategy:\n matrix:\n check: [root, deployment]",
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: deploymentChecks.length === 0
110
- ? ""
111
- : "\n if: matrix.check == 'root'",
112
- DEPLOYMENT_CHECK: deploymentCheck === undefined
113
- ? ""
114
- : `\n - run: pnpm run ${deploymentCheckTaskName(deploymentCheck)}\n if: matrix.check == 'deployment'`,
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. Turbo resolves ^build:run through the derived workspace
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 changedEntries = changedRootEntries(options.operations);
464
+ const changedPaths = changedOutputPaths(options.operations);
465
465
  let committed = false;
466
466
  try {
467
- await cp(targetRoot, stagingRoot, { recursive: true });
467
+ await cp(targetRoot, stagingRoot, {
468
+ recursive: true,
469
+ filter: generatedDependencyTreeCopyFilter,
470
+ });
468
471
  await renderProject({ ...options, targetRoot: stagingRoot });
469
- // Commit only the entries changed by the staged plan. In particular, do
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 entry has a rollback copy before it is made visible.
473
- for (const entry of changedEntries) {
474
- const current = path.join(targetRoot, entry);
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
- await cp(current, path.join(backupRoot, entry), { recursive: true });
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 entry of changedEntries) {
485
- await cp(path.join(stagingRoot, entry), path.join(targetRoot, entry), {
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 rollbackStagedEntries({ targetRoot, backupRoot, changedEntries });
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 changedRootEntries(operations) {
506
- const entries = new Set();
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
- const entry = outputPath.split(/[\\/]/)[0];
512
- if (entry !== undefined && entry.length > 0)
513
- entries.add(entry);
522
+ if (outputPath.length > 0)
523
+ changedPaths.add(path.normalize(outputPath));
514
524
  }
515
- return [...entries];
525
+ return [...changedPaths];
516
526
  }
517
- async function rollbackStagedEntries(options) {
518
- for (const entry of options.changedEntries) {
519
- const target = path.join(options.targetRoot, entry);
520
- const backup = path.join(options.backupRoot, entry);
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 cp(backup, target, { recursive: true });
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@ykdz/template",
3
- "version": "0.0.24",
3
+ "version": "0.0.26",
4
4
  "private": false,
5
5
  "description": "Project template generator for YKDZ starter projects.",
6
6
  "keywords": [
@@ -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 } };