@ykdz/template 0.0.8 → 0.0.9

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 (39) hide show
  1. package/dist/cli.js +7 -7
  2. package/node_modules/@ykdz/template-builtin-source/dist/src/index.js +10 -6
  3. package/node_modules/@ykdz/template-builtin-source/dist/templates/hono-api/projection.js +15 -5
  4. package/node_modules/@ykdz/template-builtin-source/dist/templates/ts-lib/projection.js +15 -5
  5. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-app/projection.js +23 -4
  6. package/node_modules/@ykdz/template-builtin-source/dist/templates/vue-hono-app/projection.js +6 -6
  7. package/node_modules/@ykdz/template-builtin-source/package.json +15 -2
  8. package/node_modules/@ykdz/template-builtin-source/templates/preset-source.json +14 -2
  9. package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/node/oxlint.config.ts +25 -3
  10. package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/tsconfig.config.json +20 -0
  11. package/node_modules/@ykdz/template-builtin-source/templates/shared/oxc/vue/oxlint.config.ts +27 -3
  12. package/node_modules/@ykdz/template-builtin-source/templates/vue-app/env.d.ts +7 -0
  13. package/node_modules/@ykdz/template-builtin-source/templates/vue-hono-app/web/env.d.ts +7 -0
  14. package/node_modules/@ykdz/template-core/dist/declarations.js +34 -1
  15. package/node_modules/@ykdz/template-core/dist/dependency-catalog.js +11 -6
  16. package/node_modules/@ykdz/template-core/dist/devcontainer.d.ts +5 -5
  17. package/node_modules/@ykdz/template-core/dist/editor-customization.js +20 -29
  18. package/node_modules/@ykdz/template-core/dist/generated-scenarios.d.ts +4 -4
  19. package/node_modules/@ykdz/template-core/dist/generated-scenarios.js +29 -9
  20. package/node_modules/@ykdz/template-core/dist/generation-context.js +8 -3
  21. package/node_modules/@ykdz/template-core/dist/next-step-instructions.js +3 -0
  22. package/node_modules/@ykdz/template-core/dist/package-addition.d.ts +2 -2
  23. package/node_modules/@ykdz/template-core/dist/package-addition.js +22 -8
  24. package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +1 -0
  25. package/node_modules/@ykdz/template-core/dist/preset-projection.d.ts +3 -3
  26. package/node_modules/@ykdz/template-core/dist/preset-projection.js +1 -0
  27. package/node_modules/@ykdz/template-core/dist/preset-source.js +60 -45
  28. package/node_modules/@ykdz/template-core/dist/project-github.d.ts +3 -3
  29. package/node_modules/@ykdz/template-core/dist/project-github.js +1 -0
  30. package/node_modules/@ykdz/template-core/dist/projection-capabilities.d.ts +7 -3
  31. package/node_modules/@ykdz/template-core/dist/projection-capabilities.js +187 -120
  32. package/node_modules/@ykdz/template-core/dist/renderer.d.ts +2 -2
  33. package/node_modules/@ykdz/template-core/dist/renderer.js +2 -2
  34. package/node_modules/@ykdz/template-core/dist/template-boundary-check.d.ts +1 -1
  35. package/node_modules/@ykdz/template-core/dist/template-boundary-check.js +8 -10
  36. package/node_modules/@ykdz/template-core/dist/toolchain-resolution.d.ts +5 -5
  37. package/node_modules/@ykdz/template-core/dist/toolchain-resolution.js +9 -10
  38. package/node_modules/@ykdz/template-core/package.json +9 -2
  39. package/package.json +12 -5
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readFileSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
+ import * as v from "valibot";
4
5
  const capabilityOrder = [
5
6
  "oxc-format-lint",
6
7
  "vue",
@@ -12,6 +13,19 @@ const defaultOxcConfigPaths = {
12
13
  formatter: "./oxfmt.config.ts",
13
14
  lint: "./oxlint.config.ts",
14
15
  };
16
+ const capabilityProjectionSchema = v.object({
17
+ extensions: v.array(v.string()),
18
+ settings: v.record(v.string(), v.unknown()),
19
+ });
20
+ const editorCustomizationDeclarationsSchema = v.object({
21
+ capabilities: v.object({
22
+ "oxc-format-lint": capabilityProjectionSchema,
23
+ vue: capabilityProjectionSchema,
24
+ tailwind: capabilityProjectionSchema,
25
+ "rust-tooling": capabilityProjectionSchema,
26
+ vitest: capabilityProjectionSchema,
27
+ }),
28
+ });
15
29
  const declarations = loadEditorCustomizationDeclarations();
16
30
  function editorCustomizationDeclarationPath() {
17
31
  const moduleDirectory = path.dirname(fileURLToPath(import.meta.url));
@@ -28,38 +42,15 @@ function editorCustomizationDeclarationPath() {
28
42
  }
29
43
  return declarationPath;
30
44
  }
31
- function isRecord(value) {
32
- return typeof value === "object" && value !== null && !Array.isArray(value);
33
- }
34
- function assertCapabilityProjection(capability, value) {
35
- if (!isRecord(value)) {
36
- throw new Error(`Editor customization ${capability} must be an object`);
37
- }
38
- const extensions = value.extensions;
39
- const settings = value.settings;
40
- if (!Array.isArray(extensions) ||
41
- extensions.some((extension) => typeof extension !== "string")) {
42
- throw new Error(`Editor customization ${capability} must declare string extensions`);
43
- }
44
- if (!isRecord(settings)) {
45
- throw new Error(`Editor customization ${capability} must declare object settings`);
46
- }
47
- }
48
45
  function loadEditorCustomizationDeclarations() {
49
46
  const source = JSON.parse(readFileSync(editorCustomizationDeclarationPath(), "utf8"));
50
- if (!isRecord(source) || !isRecord(source.capabilities)) {
51
- throw new Error("Editor customization declarations must contain capabilities");
47
+ const result = v.safeParse(editorCustomizationDeclarationsSchema, source);
48
+ if (!result.success) {
49
+ throw new Error(`Editor customization declarations are invalid: ${result.issues
50
+ .map((issue) => issue.message)
51
+ .join("; ")}`);
52
52
  }
53
- const capabilities = source.capabilities;
54
- for (const capability of capabilityOrder) {
55
- assertCapabilityProjection(capability, capabilities[capability]);
56
- }
57
- return {
58
- capabilities: Object.fromEntries(capabilityOrder.map((capability) => [
59
- capability,
60
- capabilities[capability],
61
- ])),
62
- };
53
+ return result.output;
63
54
  }
64
55
  function oxcConfigPathSettings(configPaths) {
65
56
  if (configPaths === "nested") {
@@ -29,8 +29,8 @@ export type GeneratedScenarioCommandStep = {
29
29
  readonly display: string;
30
30
  };
31
31
  export type GeneratedScenarioCommandRunner = (command: string, args: readonly string[], cwd: string, options?: {
32
- readonly env?: Record<string, string>;
33
- readonly logPrefix?: string;
32
+ readonly env?: Record<string, string> | undefined;
33
+ readonly logPrefix?: string | undefined;
34
34
  }) => Promise<void>;
35
35
  export type GeneratedScenarioReporter = {
36
36
  readonly info?: (message: string) => void;
@@ -54,8 +54,8 @@ export declare function generatedScenarioLabel(scenario: Pick<GeneratedScenario,
54
54
  export declare function selectGeneratedScenarios(manifest: PresetSourceManifest, set: GeneratedScenarioSet): GeneratedScenarioSelection;
55
55
  export declare function packageLeafNameForAddedPreset(manifest: PresetSourceManifest, presetName: string): string;
56
56
  export declare function defaultGeneratedScenarioCommandRunner(command: string, args: readonly string[], cwd: string, options?: {
57
- readonly env?: Record<string, string>;
58
- readonly logPrefix?: string;
57
+ readonly env?: Record<string, string> | undefined;
58
+ readonly logPrefix?: string | undefined;
59
59
  }): Promise<void>;
60
60
  export declare function generatedScenarioQualityGateSteps(manifest: PresetSourceManifest, scenario: GeneratedScenario, projectDir: string, addedPackagePath: string | undefined, options: GeneratedScenarioRunnerOptions): GeneratedScenarioCommandStep[];
61
61
  export declare function fixtureConcurrency(scenarioCount: number): number;
@@ -1,6 +1,7 @@
1
1
  import { readdir, readFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
  import { execa } from "execa";
4
+ import * as v from "valibot";
4
5
  import { assembleGenerationContext } from "./generation-context.js";
5
6
  import { renderPlaywrightBrowserInstallCommand, } from "./module-graph.js";
6
7
  import { planNextStepInstructions } from "./next-step-instructions.js";
@@ -10,6 +11,12 @@ const defaultDeterministicToolchainEnv = {
10
11
  TEMPLATE_TOOLCHAIN_RESOLUTION: "bundled-fallback",
11
12
  };
12
13
  const defaultFixtureConcurrency = 2;
14
+ const storedBlueprintSchema = v.object({
15
+ packages: v.optional(v.array(v.object({
16
+ name: v.string(),
17
+ path: v.string(),
18
+ }))),
19
+ });
13
20
  function cliSourceExecutionEnv(options, env = {}) {
14
21
  return {
15
22
  ...env,
@@ -60,8 +67,10 @@ function createGeneratedScenario(set, input) {
60
67
  return {
61
68
  set,
62
69
  basePreset: input.basePreset,
63
- addedPreset: input.addedPreset,
64
- linkFrom: input.linkFrom ? [...input.linkFrom] : undefined,
70
+ ...(input.addedPreset === undefined
71
+ ? {}
72
+ : { addedPreset: input.addedPreset }),
73
+ ...(input.linkFrom === undefined ? {} : { linkFrom: [...input.linkFrom] }),
65
74
  id: generatedScenarioId(input),
66
75
  label: generatedScenarioLabel(input),
67
76
  };
@@ -78,7 +87,9 @@ export function selectGeneratedScenarios(manifest, set) {
78
87
  const matrixScenarios = contract.supportedCombinations.map((combination) => createGeneratedScenario(set, {
79
88
  basePreset: combination.basePreset,
80
89
  addedPreset: combination.addedPreset,
81
- linkFrom: combination.linkFrom,
90
+ ...(combination.linkFrom === undefined
91
+ ? {}
92
+ : { linkFrom: combination.linkFrom }),
82
93
  }));
83
94
  const skipped = contract.semanticSkips.map((skip) => ({
84
95
  set,
@@ -105,7 +116,7 @@ export async function defaultGeneratedScenarioCommandRunner(command, args, cwd,
105
116
  console.log(`${prefix}$ ${[command, ...args].join(" ")}`);
106
117
  await execa(command, [...args], {
107
118
  cwd,
108
- env: options.env,
119
+ ...(options.env === undefined ? {} : { env: options.env }),
109
120
  stdio: "inherit",
110
121
  });
111
122
  }
@@ -163,7 +174,7 @@ async function linkedConsumerSourceSnapshots(projectDir, packagePaths) {
163
174
  async function sourceFileSnapshot(sourceDir, currentDir = sourceDir) {
164
175
  const snapshot = {};
165
176
  const entries = await readdir(currentDir, { withFileTypes: true });
166
- for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
177
+ for (const entry of entries.toSorted((left, right) => left.name.localeCompare(right.name))) {
167
178
  const entryPath = path.join(currentDir, entry.name);
168
179
  if (entry.isDirectory()) {
169
180
  Object.assign(snapshot, await sourceFileSnapshot(sourceDir, entryPath));
@@ -184,8 +195,14 @@ async function assertLinkedConsumerSourcesUnchanged(projectDir, beforeSnapshots)
184
195
  }
185
196
  }
186
197
  async function readAddedPackagePath(projectDir, packageLeafName) {
187
- const blueprint = JSON.parse(await readFile(path.join(projectDir, ".template", "blueprint.json"), "utf8"));
188
- const packageDefinition = blueprint.packages?.find((pkg) => path.basename(pkg.path) === packageLeafName);
198
+ const input = JSON.parse(await readFile(path.join(projectDir, ".template", "blueprint.json"), "utf8"));
199
+ const result = v.safeParse(storedBlueprintSchema, input);
200
+ if (!result.success) {
201
+ throw new Error(`Generated Repository blueprint is invalid: ${result.issues
202
+ .map((issue) => issue.message)
203
+ .join("; ")}`);
204
+ }
205
+ const packageDefinition = result.output.packages?.find((pkg) => path.basename(pkg.path) === packageLeafName);
189
206
  if (!packageDefinition) {
190
207
  throw new Error(`Package Addition fixture did not record package leaf ${packageLeafName}`);
191
208
  }
@@ -198,7 +215,7 @@ function projectionPlanForPreset(presetName, projectDir, manifest, options, pack
198
215
  }
199
216
  const blueprint = blueprintForPresetSourcePreset(preset, {
200
217
  targetDir: projectDir,
201
- scope: packageScope,
218
+ ...(packageScope === undefined ? {} : { scope: packageScope }),
202
219
  });
203
220
  return projectPresetSourcePreset({
204
221
  preset,
@@ -248,6 +265,9 @@ function addedPresetEnvironmentNeeds(manifest, scenario, projectDir, addedPackag
248
265
  function environmentNeedStep(need, projectDir) {
249
266
  const display = renderPlaywrightBrowserInstallCommand(need);
250
267
  const [command, ...args] = display.split(" ");
268
+ if (command === undefined) {
269
+ throw new Error(`Cannot parse environment setup command: ${display}`);
270
+ }
251
271
  return {
252
272
  id: `install-${need.owner.path}-playwright-browsers`,
253
273
  command,
@@ -282,7 +302,7 @@ async function runGeneratedScenarioQualityGate(manifest, scenario, projectDir, a
282
302
  const env = step.id === "run-root-check" ? { CI: "1" } : undefined;
283
303
  const runStep = async () => {
284
304
  await options.runCommand(step.command, [...step.args], step.cwd, {
285
- env,
305
+ ...(env === undefined ? {} : { env }),
286
306
  logPrefix: scenario.label,
287
307
  });
288
308
  };
@@ -6,9 +6,14 @@ export function assembleGenerationContext(options) {
6
6
  value: path.basename(path.resolve(options.targetDir)),
7
7
  },
8
8
  preset: options.blueprint.preset,
9
- packageManager: options.blueprint.packageManager
10
- ? { kind: "PackageManager", value: options.blueprint.packageManager }
11
- : undefined,
9
+ ...(options.blueprint.packageManager
10
+ ? {
11
+ packageManager: {
12
+ kind: "PackageManager",
13
+ value: options.blueprint.packageManager,
14
+ },
15
+ }
16
+ : {}),
12
17
  blueprint: options.blueprint,
13
18
  toolchain: options.toolchain,
14
19
  };
@@ -73,6 +73,9 @@ function checkEnvironmentInstructions(plan) {
73
73
  return plan.checkPlan.environmentNeeds.map((need) => {
74
74
  const display = renderPlaywrightBrowserInstallCommand(need);
75
75
  const [command, ...args] = display.split(" ");
76
+ if (command === undefined) {
77
+ throw new Error(`Cannot parse environment setup command: ${display}`);
78
+ }
76
79
  return {
77
80
  id: need.owner.path === "apps/web"
78
81
  ? "install-web-playwright-browsers"
@@ -4,8 +4,8 @@ export type AddPackageOptions = {
4
4
  cwd: string;
5
5
  preset: string;
6
6
  name: string;
7
- path?: string;
8
- linkFrom?: readonly string[];
7
+ path?: string | undefined;
8
+ linkFrom?: readonly string[] | undefined;
9
9
  presetSourceManifest: PresetSourceManifest;
10
10
  projectionSourceRoots: PresetProjectionSourceRoots;
11
11
  };
@@ -10,7 +10,7 @@ import { renderProject } from "./renderer.js";
10
10
  function projectNameFromBlueprint(blueprint, fallbackProjectName) {
11
11
  const firstPackage = blueprint.packages?.[0];
12
12
  const match = firstPackage?.name.match(/^@([^/]+)\//);
13
- if (match) {
13
+ if (match?.[1]) {
14
14
  return match[1];
15
15
  }
16
16
  if (/^[a-z0-9][a-z0-9._-]*$/.test(fallbackProjectName)) {
@@ -314,9 +314,17 @@ async function packageManifestsForTaskGraph(options) {
314
314
  for (const packageDefinition of options.blueprint.packages ?? []) {
315
315
  const manifestOverride = options.manifestOverrides?.get(packageDefinition.path);
316
316
  const manifestFromOperations = generatedPackageManifestFromOperations(options.operations, packageDefinition.path);
317
- manifests.push(manifestOverride ??
318
- manifestFromOperations ??
319
- (await readJson(path.join(options.root, packageDefinition.path, "package.json"))));
317
+ if (manifestOverride !== undefined) {
318
+ manifests.push(manifestOverride);
319
+ continue;
320
+ }
321
+ if (manifestFromOperations !== undefined) {
322
+ manifests.push(manifestFromOperations);
323
+ continue;
324
+ }
325
+ const manifest = await readJson(path.join(options.root, packageDefinition.path, "package.json"));
326
+ assertObjectManifest(manifest, packageDefinition.path);
327
+ manifests.push(manifest);
320
328
  }
321
329
  return manifests;
322
330
  }
@@ -348,7 +356,7 @@ function assertObjectManifest(input, packagePath) {
348
356
  }
349
357
  }
350
358
  function recordSortedByKey(record) {
351
- return Object.fromEntries(Object.entries(record).sort(([left], [right]) => left.localeCompare(right)));
359
+ return Object.fromEntries(Object.entries(record).toSorted(([left], [right]) => left.localeCompare(right)));
352
360
  }
353
361
  async function consumerManifestUpdatesForPackageLinkIntents(options) {
354
362
  const updates = [];
@@ -425,16 +433,21 @@ function rootPackageJsonWithPackageTaskFilters(input, blueprint, packageManifest
425
433
  assertRootPackageJson(input);
426
434
  const workspacePackageGlobs = workspacePackageGlobsFromBlueprint(blueprint);
427
435
  const taskNames = turboTaskNamesForPackageManifests(packageManifests);
436
+ const checkScript = input.scripts.check;
437
+ const fixScript = input.scripts.fix;
438
+ if (checkScript === undefined || fixScript === undefined) {
439
+ throw new Error("Cannot update root Package Addition scripts: check and fix scripts are required");
440
+ }
428
441
  return {
429
442
  ...input,
430
443
  scripts: {
431
444
  ...input.scripts,
432
445
  check: rootScriptWithTurboPackageTasks({
433
- script: input.scripts.check,
446
+ script: checkScript,
434
447
  taskNames,
435
448
  workspacePackageGlobs,
436
449
  }),
437
- fix: rootScriptWithTurboPackageTask(input.scripts.fix, "fix", workspacePackageGlobs),
450
+ fix: rootScriptWithTurboPackageTask(fixScript, "fix", workspacePackageGlobs),
438
451
  },
439
452
  };
440
453
  }
@@ -483,6 +496,7 @@ function rootPackageJsonWithSharedOxcRuntimeDependencies(input, requiresSharedOx
483
496
  ...input.devDependencies,
484
497
  oxfmt: input.devDependencies?.oxfmt ?? "catalog:",
485
498
  oxlint: input.devDependencies?.oxlint ?? "catalog:",
499
+ "oxlint-tsgolint": input.devDependencies?.["oxlint-tsgolint"] ?? "catalog:",
486
500
  },
487
501
  };
488
502
  }
@@ -491,7 +505,7 @@ function catalogDependenciesWithSharedOxcRuntimeDependencies(catalogDependencies
491
505
  if (!requiresSharedOxcConfiguration) {
492
506
  return dependencies;
493
507
  }
494
- for (const dependency of ["oxfmt", "oxlint"]) {
508
+ for (const dependency of ["oxfmt", "oxlint", "oxlint-tsgolint"]) {
495
509
  if (!dependencies.includes(dependency)) {
496
510
  dependencies.push(dependency);
497
511
  }
@@ -14,6 +14,7 @@ catalog:
14
14
  hono: ^4.12.27
15
15
  oxfmt: ^0.57.0
16
16
  oxlint: ^1.72.0
17
+ oxlint-tsgolint: ^0.24.0
17
18
  pinia: ^3.0.4
18
19
  tailwindcss: ^4.3.2
19
20
  tsc-alias: ^1.8.17
@@ -20,7 +20,7 @@ export type PresetPackageAdditionPlan = {
20
20
  readonly packageRole: PackageRole;
21
21
  readonly packageSourcePreset: PackageSourcePreset;
22
22
  readonly sourceRoot: string;
23
- readonly sourceRoots?: Record<string, string>;
23
+ readonly sourceRoots?: Record<string, string> | undefined;
24
24
  readonly operations: readonly RenderOperation[];
25
25
  readonly textFiles?: readonly {
26
26
  readonly path: string;
@@ -32,7 +32,7 @@ export type PresetPackageAdditionCapability = {
32
32
  };
33
33
  export type PresetProjectionPlan = {
34
34
  readonly sourceRoot: string;
35
- readonly sourceRoots?: Record<string, string>;
35
+ readonly sourceRoots?: Record<string, string> | undefined;
36
36
  readonly operations: readonly RenderOperation[];
37
37
  readonly checkPlan: CheckPlan;
38
38
  readonly fixPlan: FixPlan;
@@ -48,7 +48,7 @@ export type PresetProjectionPlan = {
48
48
  };
49
49
  export type PresetBlueprintOptions = {
50
50
  readonly targetDir: string;
51
- readonly scope?: string;
51
+ readonly scope?: string | undefined;
52
52
  };
53
53
  export type RenderPresetProjectionOptions = {
54
54
  readonly targetDir: string;
@@ -1,3 +1,4 @@
1
+ import {} from "./module-graph.js";
1
2
  import { planNextStepInstructions, } from "./next-step-instructions.js";
2
3
  export function planNextStepInstructionsForProjection(options) {
3
4
  return planNextStepInstructions({
@@ -797,6 +797,64 @@ function supportedProjectionDeclarationIssues(presets) {
797
797
  ]
798
798
  : []);
799
799
  }
800
+ function normalizePresetSourceManifestOutput(manifest) {
801
+ return {
802
+ schemaVersion: manifest.schemaVersion,
803
+ name: manifest.name,
804
+ sharedResources: manifest.sharedResources.map((resource) => ({
805
+ ...resource,
806
+ })),
807
+ ...(manifest.fixtureMatrix
808
+ ? {
809
+ fixtureMatrix: {
810
+ initSupport: manifest.fixtureMatrix.initSupport.map((support) => ({
811
+ ...support,
812
+ })),
813
+ packageAdditionSupport: manifest.fixtureMatrix.packageAdditionSupport.map((support) => ({
814
+ ...support,
815
+ })),
816
+ supportedCombinations: manifest.fixtureMatrix.supportedCombinations.map((combination) => ({
817
+ basePreset: combination.basePreset,
818
+ addedPreset: combination.addedPreset,
819
+ linkFrom: [...combination.linkFrom],
820
+ })),
821
+ semanticSkips: manifest.fixtureMatrix.semanticSkips.map((skip) => ({
822
+ ...skip,
823
+ })),
824
+ checkRequirements: [...manifest.fixtureMatrix.checkRequirements],
825
+ environmentPreparation: [
826
+ ...manifest.fixtureMatrix.environmentPreparation,
827
+ ],
828
+ },
829
+ }
830
+ : {}),
831
+ presets: manifest.presets.map((preset) => ({
832
+ name: preset.name,
833
+ title: preset.title,
834
+ description: preset.description,
835
+ generation: preset.generation,
836
+ packageAdditionSupport: preset.packageAdditionSupport,
837
+ supportedPackageManagers: [...preset.supportedPackageManagers],
838
+ supportedProjectKinds: [...preset.supportedProjectKinds],
839
+ features: [...preset.features],
840
+ dependencyCatalog: [...preset.dependencyCatalog],
841
+ ...(preset.projection
842
+ ? {
843
+ projection: normalizePresetProjectionDeclaration(preset.projection),
844
+ }
845
+ : {}),
846
+ ...(preset.source
847
+ ? {
848
+ source: {
849
+ roots: [...preset.source.roots],
850
+ files: [...preset.source.files],
851
+ sharedResources: [...preset.source.sharedResources],
852
+ },
853
+ }
854
+ : {}),
855
+ })),
856
+ };
857
+ }
800
858
  export function validatePresetSourceManifest(input, options = {}) {
801
859
  const inlineDependencyIssues = inlineDependencyCatalogSpecifierIssues(input);
802
860
  if (inlineDependencyIssues.length > 0) {
@@ -823,50 +881,7 @@ export function validatePresetSourceManifest(input, options = {}) {
823
881
  }
824
882
  return {
825
883
  ok: true,
826
- value: {
827
- ...result.output,
828
- sharedResources: result.output.sharedResources.map((resource) => ({
829
- ...resource,
830
- })),
831
- fixtureMatrix: result.output.fixtureMatrix
832
- ? {
833
- initSupport: result.output.fixtureMatrix.initSupport.map((support) => ({ ...support })),
834
- packageAdditionSupport: result.output.fixtureMatrix.packageAdditionSupport.map((support) => ({ ...support })),
835
- supportedCombinations: result.output.fixtureMatrix.supportedCombinations.map((combination) => ({
836
- ...combination,
837
- linkFrom: [...(combination.linkFrom ?? [])],
838
- })),
839
- semanticSkips: result.output.fixtureMatrix.semanticSkips.map((skip) => ({ ...skip })),
840
- checkRequirements: [
841
- ...result.output.fixtureMatrix.checkRequirements,
842
- ],
843
- environmentPreparation: [
844
- ...result.output.fixtureMatrix.environmentPreparation,
845
- ],
846
- }
847
- : undefined,
848
- presets: parsedManifest.presets.map((preset) => ({
849
- ...preset,
850
- supportedPackageManagers: [
851
- ...preset.supportedPackageManagers,
852
- ],
853
- supportedProjectKinds: [
854
- ...preset.supportedProjectKinds,
855
- ],
856
- features: [...preset.features],
857
- dependencyCatalog: [...(preset.dependencyCatalog ?? [])],
858
- projection: preset.projection
859
- ? normalizePresetProjectionDeclaration(preset.projection)
860
- : undefined,
861
- source: preset.source
862
- ? {
863
- roots: [...preset.source.roots],
864
- files: [...preset.source.files],
865
- sharedResources: [...preset.source.sharedResources],
866
- }
867
- : undefined,
868
- })),
869
- },
884
+ value: normalizePresetSourceManifestOutput(parsedManifest),
870
885
  };
871
886
  }
872
887
  export function validateBuiltInPresetSourceManifest(input, options = {}) {
@@ -908,7 +923,7 @@ export function manifestReferencedSourceFiles(manifest, sourceRoot) {
908
923
  addReference(file);
909
924
  }
910
925
  }
911
- return [...files].sort();
926
+ return [...files].toSorted();
912
927
  }
913
928
  export function loadPresetSourceManifestFile(filePath) {
914
929
  const result = validatePresetSourceManifest(JSON.parse(readFileSync(filePath, "utf8")), { sourceRoot: path.dirname(filePath) });
@@ -21,9 +21,9 @@ export type DependencyMaintenancePolicy = {
21
21
  };
22
22
  type ProjectCheckWorkflowOptions = {
23
23
  readonly checkPlan: CheckPlan;
24
- readonly capability?: CiCapability;
25
- readonly environmentPreparation?: Partial<CiEnvironmentPreparation>;
26
- readonly taskLayer?: PnpmTaskLayer;
24
+ readonly capability?: CiCapability | undefined;
25
+ readonly environmentPreparation?: Partial<CiEnvironmentPreparation> | undefined;
26
+ readonly taskLayer?: PnpmTaskLayer | undefined;
27
27
  };
28
28
  export declare function projectCheckWorkflow(options: ProjectCheckWorkflowOptions): string;
29
29
  export declare function projectDependabotConfig(policy: DependencyMaintenancePolicy): string;
@@ -1,3 +1,4 @@
1
+ import {} from "./module-graph.js";
1
2
  const defaultCiCapability = {
2
3
  workflowName: "Check",
3
4
  jobName: "check",
@@ -11,9 +11,10 @@ export type WorkspaceLibraryPackageCapabilityDeclaration = {
11
11
  readonly sourceFiles: readonly string[];
12
12
  };
13
13
  export type WorkspaceNodePackageKind = "hono-api" | "vue-app";
14
+ type WorkspaceNodePackagePath = "apps/api" | "apps/web";
14
15
  export type WorkspaceNodePackageDeclaration = {
15
16
  readonly kind: WorkspaceNodePackageKind;
16
- readonly path: "apps/api" | "apps/web";
17
+ readonly path: WorkspaceNodePackagePath;
17
18
  readonly sourceFiles: readonly string[];
18
19
  };
19
20
  export type WorkspaceNodePackagesCapabilityDeclaration = {
@@ -53,8 +54,10 @@ export type PresetProjectionSourceRoots = {
53
54
  readonly sharedDevcontainer: () => string;
54
55
  };
55
56
  export declare function validateProjectionCapabilities(input: unknown): ValidationResult<PresetProjectionDeclaration>;
56
- export declare function projectionCapabilityIssues(presets: readonly PresetSourceManifestPreset[]): ValidationIssue[];
57
- export declare function normalizePresetProjectionDeclaration(declaration: PresetProjectionDeclaration): PresetProjectionDeclaration;
57
+ export declare function projectionCapabilityIssues(presets: readonly {
58
+ readonly projection?: unknown;
59
+ }[]): ValidationIssue[];
60
+ export declare function normalizePresetProjectionDeclaration(declaration: unknown): PresetProjectionDeclaration;
58
61
  export declare function interpretPresetProjectionDeclaration(options: {
59
62
  readonly preset: PresetSourceManifestPreset;
60
63
  readonly declaration: PresetProjectionDeclaration;
@@ -73,3 +76,4 @@ export declare function planPresetSourcePackageAddition(options: {
73
76
  readonly sourceRoots: PresetProjectionSourceRoots;
74
77
  }): Promise<PresetPackageAdditionPlan>;
75
78
  export declare function defaultPackagePathForPresetSourcePackageAddition(preset: PresetSourceManifestPreset, packageLeafName: string, sourceRoots: PresetProjectionSourceRoots): string;
79
+ export {};