@ykdz/template 0.0.35 → 0.0.36
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/application.d.ts +2 -1
- package/dist/application.js +64 -75
- package/dist/main.js +6 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.d.ts +50 -36
- package/node_modules/@ykdz/template-builtin-presets/dist/src/foundation.js +968 -364
- package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.d.ts +24 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/generation-record.js +154 -0
- package/node_modules/@ykdz/template-builtin-presets/dist/src/index.d.ts +2 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/index.js +1 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.d.ts +31 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/rust-bin/definition.js +29 -33
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/typescript.d.ts +4 -3
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/typescript.js +9 -5
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.d.ts +1 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/shared/vue.js +0 -1
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-cli/definition.d.ts +31 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-cli/definition.js +79 -58
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.d.ts +31 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/ts-lib/definition.js +31 -23
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.d.ts +22 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vike-app/definition.js +53 -25
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.d.ts +26 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-app/definition.js +19 -7
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.d.ts +22 -2
- package/node_modules/@ykdz/template-builtin-presets/dist/src/vue-hono-app/definition.js +31 -20
- package/node_modules/@ykdz/template-builtin-presets/package.json +12 -11
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-deployment-diagnostics.yml +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.github/workflows/check-deployment.yml +1 -1
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/.pnpmfile.mjs +19 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/foundation/tsconfig.packing-hook.json +8 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/CHANGELOG.md.template +17 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/RELEASING.md +17 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/artifact.ts +1271 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/changelog.ts +283 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/check-artifact.ts +99 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/check-readiness.ts +66 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/cli-command-identity.ts +4 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/handoff.ts +450 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/publish.ts +483 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/readiness.ts +1125 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/release.ts +819 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/release.yml +119 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/root-tsconfig.json +13 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/tsconfig.json +4 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication/turbo.json +6 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/README.md +48 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/assets/CHANGELOG.md.template +17 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/assets/LICENSE-APACHE-2.0.txt +202 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/assets/LICENSE-MIT.txt +21 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/assets/README.md.template +5 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/bridge.ts +3336 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/publication-setup/setup.sh +221 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/cli-command-identity.ts +133 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/cli.ts +4 -3
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/src/main.ts +5 -4
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/integration/command.test.ts +14 -13
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/test/unit/cli-command-identity.test.ts +76 -0
- package/node_modules/@ykdz/template-builtin-presets/templates/ts-cli/tsconfig.build.json +2 -0
- package/node_modules/@ykdz/template-core/dist/module-graph.d.ts +15 -53
- package/node_modules/@ykdz/template-core/dist/module-graph.js +134 -101
- package/node_modules/@ykdz/template-core/dist/package-contribution.d.ts +13 -1
- package/node_modules/@ykdz/template-core/dist/package-contribution.js +92 -0
- package/node_modules/@ykdz/template-core/dist/pnpm-workspace.yaml +14 -10
- package/node_modules/@ykdz/template-core/dist/preset-definition.d.ts +71 -13
- package/node_modules/@ykdz/template-core/dist/preset-definition.js +16 -1
- package/node_modules/@ykdz/template-core/dist/project-blueprint.d.ts +56 -0
- package/node_modules/@ykdz/template-core/dist/project-blueprint.js +271 -0
- package/node_modules/@ykdz/template-core/dist/project-linking-v2.d.ts +2 -2
- package/node_modules/@ykdz/template-core/dist/project-linking-v2.js +2 -2
- package/node_modules/@ykdz/template-core/dist/project-projection.d.ts +2 -1
- package/node_modules/@ykdz/template-core/dist/project-projection.js +107 -20
- package/node_modules/@ykdz/template-core/dist/renderer.d.ts +0 -2
- package/node_modules/@ykdz/template-core/dist/renderer.js +17 -38
- package/node_modules/@ykdz/template-core/dist/template-boundary-check.d.ts +2 -2
- package/node_modules/@ykdz/template-core/dist/template-boundary-check.js +6 -0
- package/node_modules/@ykdz/template-core/dist/toolchain-resolution.d.ts +2 -0
- package/node_modules/@ykdz/template-core/dist/toolchain-resolution.js +9 -3
- package/package.json +5 -5
- package/node_modules/@ykdz/template-core/dist/project-blueprint-v2.d.ts +0 -33
- package/node_modules/@ykdz/template-core/dist/project-blueprint-v2.js +0 -182
package/dist/application.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export type InitCommandOptions = {
|
|
|
22
22
|
readonly dryRun: boolean;
|
|
23
23
|
readonly json: boolean;
|
|
24
24
|
readonly todo: boolean;
|
|
25
|
+
readonly name?: string;
|
|
26
|
+
readonly path?: string;
|
|
25
27
|
readonly scope?: string;
|
|
26
28
|
};
|
|
27
29
|
export type AddPackageCommandOptions = {
|
|
@@ -58,7 +60,6 @@ type PackageAdditionCliResult = {
|
|
|
58
60
|
readonly actions: readonly [];
|
|
59
61
|
readonly conflicts: readonly PackageAdditionCliConflict[];
|
|
60
62
|
};
|
|
61
|
-
export declare function normalizeNpmScope(value: string): string;
|
|
62
63
|
export declare function formatPresetCatalog(): string;
|
|
63
64
|
export declare function renderPackageAdditionResult(result: PackageAdditionCliResult, options: AddPackageCommandOptions, preset: string): string;
|
|
64
65
|
export declare function validateBlueprintFile(filePath: string, runtime: ApplicationRuntime): Promise<string>;
|
package/dist/application.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { builtInPresetRegistry,
|
|
4
|
-
import {
|
|
5
|
-
import { reconcileAndApplyProjectProjections, } from "#template-core/project-projection";
|
|
3
|
+
import { builtInPresetRegistry, loadLocalTemplateMetadata, prepareGeneratedRepositoryInitialization, planGeneratedRepositoryPackageAddition, templateSources, } from "#template-builtin-presets";
|
|
4
|
+
import { validateProjectBlueprint } from "#template-core/project-blueprint";
|
|
5
|
+
import { reconcileAndApplyProjectProjections, materializeProjectProjection, } from "#template-core/project-projection";
|
|
6
6
|
import { renderNewProject } from "#template-core/renderer";
|
|
7
7
|
import { resolveToolchainVersions, } from "#template-core/toolchain-resolution";
|
|
8
|
-
export function normalizeNpmScope(value) {
|
|
9
|
-
const scope = value.startsWith("@") ? value.slice(1) : value;
|
|
10
|
-
if (value !== value.trim() || !/^[a-z0-9][a-z0-9._-]*$/.test(scope)) {
|
|
11
|
-
throw new Error("--scope must be a valid npm scope without whitespace");
|
|
12
|
-
}
|
|
13
|
-
return scope;
|
|
14
|
-
}
|
|
15
8
|
export function formatPresetCatalog() {
|
|
16
9
|
return [
|
|
17
10
|
"Built-in presets",
|
|
@@ -97,25 +90,9 @@ export function renderPackageAdditionResult(result, options, preset) {
|
|
|
97
90
|
: result.actions.map((action) => ` ${action.action} ${action.path} (${action.driver})`)),
|
|
98
91
|
].join("\n");
|
|
99
92
|
}
|
|
100
|
-
async function readBlueprint(filePath) {
|
|
101
|
-
const value = JSON.parse(await readFile(filePath, "utf8"));
|
|
102
|
-
if (typeof value === "object" &&
|
|
103
|
-
value !== null &&
|
|
104
|
-
"schemaVersion" in value &&
|
|
105
|
-
value.schemaVersion === 1) {
|
|
106
|
-
throw new Error("Unsupported Local Template Metadata: Blueprint version 1 is not supported");
|
|
107
|
-
}
|
|
108
|
-
return assertProjectBlueprintV2(value);
|
|
109
|
-
}
|
|
110
93
|
export async function validateBlueprintFile(filePath, runtime) {
|
|
111
94
|
const value = JSON.parse(await readFile(path.resolve(runtime.cwd, filePath), "utf8"));
|
|
112
|
-
|
|
113
|
-
value !== null &&
|
|
114
|
-
"schemaVersion" in value &&
|
|
115
|
-
value.schemaVersion === 1) {
|
|
116
|
-
throw new Error("Unsupported Local Template Metadata: Blueprint version 1 is not supported");
|
|
117
|
-
}
|
|
118
|
-
const result = validateProjectBlueprintV2(value);
|
|
95
|
+
const result = validateProjectBlueprint(value);
|
|
119
96
|
if (!result.ok) {
|
|
120
97
|
throw new Error(result.issues
|
|
121
98
|
.map((issue) => `${issue.path}: ${issue.message}`)
|
|
@@ -123,40 +100,66 @@ export async function validateBlueprintFile(filePath, runtime) {
|
|
|
123
100
|
}
|
|
124
101
|
return "Blueprint is valid";
|
|
125
102
|
}
|
|
126
|
-
function deriveExistingPackageScope(blueprint) {
|
|
127
|
-
const scopes = new Set();
|
|
128
|
-
for (const definition of blueprint.packages) {
|
|
129
|
-
const match = definition.name.match(/^@([^/]+)\//);
|
|
130
|
-
if (!match?.[1]) {
|
|
131
|
-
throw new Error(`Package Addition requires a scoped Package Definition: ${definition.name}`);
|
|
132
|
-
}
|
|
133
|
-
scopes.add(match[1]);
|
|
134
|
-
}
|
|
135
|
-
if (scopes.size !== 1) {
|
|
136
|
-
throw new Error(`Package Addition requires exactly one existing npm scope; found ${[...scopes].join(", ") || "none"}`);
|
|
137
|
-
}
|
|
138
|
-
return [...scopes][0];
|
|
139
|
-
}
|
|
140
103
|
export async function runInit(options, runtime) {
|
|
141
104
|
const definition = builtInPresetRegistry.require(options.preset);
|
|
142
105
|
const toolchain = await resolveToolchain(runtime.env);
|
|
143
|
-
const
|
|
106
|
+
const preparation = prepareGeneratedRepositoryInitialization({
|
|
107
|
+
definition,
|
|
144
108
|
targetDir: path.resolve(runtime.cwd, options.dir),
|
|
145
|
-
...(options.scope ? { scope: normalizeNpmScope(options.scope) } : {}),
|
|
146
109
|
toolchain: {
|
|
147
110
|
nodeLtsMajor: toolchain.nodeLtsMajor.value,
|
|
148
111
|
packageManagerPin: toolchain.packageManagerPin.value,
|
|
149
112
|
},
|
|
113
|
+
...((options.name ?? options.path ?? options.scope) === undefined
|
|
114
|
+
? {}
|
|
115
|
+
: {
|
|
116
|
+
overrides: {
|
|
117
|
+
...(options.name === undefined ? {} : { name: options.name }),
|
|
118
|
+
...(options.path === undefined ? {} : { path: options.path }),
|
|
119
|
+
...(options.scope === undefined ? {} : { scope: options.scope }),
|
|
120
|
+
},
|
|
121
|
+
}),
|
|
122
|
+
});
|
|
123
|
+
const { plan, resolved, publicationSetup } = preparation;
|
|
124
|
+
const resolvedPackageRows = [
|
|
125
|
+
["Name", resolved.packages.map(({ name }) => name).join(", ")],
|
|
126
|
+
[
|
|
127
|
+
"Path",
|
|
128
|
+
resolved.packages.map(({ path: packagePath }) => packagePath).join(", "),
|
|
129
|
+
],
|
|
130
|
+
];
|
|
131
|
+
const operations = [
|
|
132
|
+
...plan.operations,
|
|
133
|
+
...(options.todo
|
|
134
|
+
? [
|
|
135
|
+
{
|
|
136
|
+
kind: "writeTextTemplate",
|
|
137
|
+
source: templateSources.foundation,
|
|
138
|
+
from: "TODO.md.template",
|
|
139
|
+
to: "TODO.md",
|
|
140
|
+
replacements: {
|
|
141
|
+
NEXT_STEPS: plan.nextStepInstructions
|
|
142
|
+
.map((instruction, index) => `${index + 1}. \`${instruction.display}\``)
|
|
143
|
+
.join("\n"),
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
]
|
|
147
|
+
: []),
|
|
148
|
+
];
|
|
149
|
+
await materializeProjectProjection({
|
|
150
|
+
operations,
|
|
151
|
+
reconciliation: plan.reconciliation,
|
|
150
152
|
});
|
|
151
|
-
const plan = planGeneratedRepositoryInitialization({ definition, context });
|
|
152
153
|
const output = {
|
|
153
154
|
command: "init",
|
|
154
155
|
dryRun: options.dryRun,
|
|
155
156
|
targetDir: options.dir,
|
|
157
|
+
resolved,
|
|
156
158
|
blueprint: plan.blueprint,
|
|
157
159
|
generationRecord: plan.generationRecord,
|
|
158
160
|
toolchain: toolchainReport(toolchain),
|
|
159
161
|
nextSteps: plan.nextStepInstructions,
|
|
162
|
+
publicationSetup,
|
|
160
163
|
followUpDocument: {
|
|
161
164
|
enabled: options.todo,
|
|
162
165
|
path: options.todo ? "TODO.md" : undefined,
|
|
@@ -174,6 +177,9 @@ export async function runInit(options, runtime) {
|
|
|
174
177
|
"Planned project",
|
|
175
178
|
"",
|
|
176
179
|
...formatRows([
|
|
180
|
+
["Preset", resolved.preset],
|
|
181
|
+
...resolvedPackageRows,
|
|
182
|
+
["Scope", resolved.scope],
|
|
177
183
|
["Target", options.dir],
|
|
178
184
|
["Packages", String(plan.blueprint.packages.length)],
|
|
179
185
|
]),
|
|
@@ -184,24 +190,7 @@ export async function runInit(options, runtime) {
|
|
|
184
190
|
}
|
|
185
191
|
await renderNewProject({
|
|
186
192
|
targetRoot: path.resolve(runtime.cwd, options.dir),
|
|
187
|
-
operations
|
|
188
|
-
...plan.operations,
|
|
189
|
-
...(options.todo
|
|
190
|
-
? [
|
|
191
|
-
{
|
|
192
|
-
kind: "writeTextTemplate",
|
|
193
|
-
source: templateSources.foundation,
|
|
194
|
-
from: "TODO.md.template",
|
|
195
|
-
to: "TODO.md",
|
|
196
|
-
replacements: {
|
|
197
|
-
NEXT_STEPS: plan.nextStepInstructions
|
|
198
|
-
.map((instruction, index) => `${index + 1}. \`${instruction.display}\``)
|
|
199
|
-
.join("\n"),
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
]
|
|
203
|
-
: []),
|
|
204
|
-
],
|
|
193
|
+
operations,
|
|
205
194
|
});
|
|
206
195
|
if (options.json)
|
|
207
196
|
return JSON.stringify(output, null, 2);
|
|
@@ -209,31 +198,31 @@ export async function runInit(options, runtime) {
|
|
|
209
198
|
"Initialized project",
|
|
210
199
|
"",
|
|
211
200
|
...formatRows([
|
|
212
|
-
["Preset",
|
|
201
|
+
["Preset", resolved.preset],
|
|
202
|
+
...resolvedPackageRows,
|
|
203
|
+
["Scope", resolved.scope],
|
|
213
204
|
["Target", options.dir],
|
|
214
205
|
]),
|
|
215
206
|
"",
|
|
216
207
|
"Next steps",
|
|
217
208
|
"",
|
|
218
209
|
...plan.nextStepInstructions.map((instruction, index) => ` ${index + 1}. ${instruction.display}`),
|
|
210
|
+
...(publicationSetup === null
|
|
211
|
+
? []
|
|
212
|
+
: [
|
|
213
|
+
"",
|
|
214
|
+
"One-time npm publication setup",
|
|
215
|
+
"",
|
|
216
|
+
` ${publicationSetup.command}`,
|
|
217
|
+
]),
|
|
219
218
|
].join("\n");
|
|
220
219
|
}
|
|
221
220
|
export async function runAddPackage(options, runtime) {
|
|
222
|
-
const
|
|
223
|
-
const toolchain = await resolveToolchain(runtime.env);
|
|
221
|
+
const localTemplateMetadata = loadLocalTemplateMetadata(runtime.cwd);
|
|
224
222
|
const definition = builtInPresetRegistry.require(options.preset);
|
|
225
|
-
const context = createGenerationContext({
|
|
226
|
-
targetDir: runtime.cwd,
|
|
227
|
-
scope: deriveExistingPackageScope(blueprint),
|
|
228
|
-
toolchain: {
|
|
229
|
-
nodeLtsMajor: toolchain.nodeLtsMajor.value,
|
|
230
|
-
packageManagerPin: toolchain.packageManagerPin.value,
|
|
231
|
-
},
|
|
232
|
-
});
|
|
233
223
|
const plan = planGeneratedRepositoryPackageAddition({
|
|
234
224
|
definition,
|
|
235
|
-
|
|
236
|
-
blueprint,
|
|
225
|
+
localTemplateMetadata,
|
|
237
226
|
packageLeafName: options.name,
|
|
238
227
|
...(options.path ? { packagePath: options.path } : {}),
|
|
239
228
|
...(options.linkFrom.length > 0 ? { linkFrom: options.linkFrom } : {}),
|
package/dist/main.js
CHANGED
|
@@ -46,9 +46,11 @@ export function createCliCommand(runtime) {
|
|
|
46
46
|
.exitOverride();
|
|
47
47
|
command
|
|
48
48
|
.command("init <dir>")
|
|
49
|
-
.description("
|
|
49
|
+
.description("Resolve a Preset, initial package name and path, and package scope before initialization.")
|
|
50
50
|
.requiredOption("--preset <name>", "Project preset to generate")
|
|
51
|
-
.option("--
|
|
51
|
+
.option("--name <name>", "Unscoped leaf name when the Preset supports Primary Package Identity overrides")
|
|
52
|
+
.option("--path <path>", "Two-segment path when the Preset supports Primary Package Identity overrides")
|
|
53
|
+
.option("--scope <name>", "Resolved default package scope")
|
|
52
54
|
.option("-y, --yes", "Accept defaults for non-interactive generation")
|
|
53
55
|
.option("--dry-run", "Print the planned generation without writing files")
|
|
54
56
|
.option("--json", "Print machine-readable output")
|
|
@@ -61,6 +63,8 @@ export function createCliCommand(runtime) {
|
|
|
61
63
|
dryRun: Boolean(options.dryRun),
|
|
62
64
|
json: Boolean(options.json),
|
|
63
65
|
todo: options.todo,
|
|
66
|
+
...(options.name === undefined ? {} : { name: options.name }),
|
|
67
|
+
...(options.path === undefined ? {} : { path: options.path }),
|
|
64
68
|
...(options.scope === undefined ? {} : { scope: options.scope }),
|
|
65
69
|
};
|
|
66
70
|
runtime.streams.stdout.write(`${await runInit(initOptions, runtime)}\n`);
|
|
@@ -1,38 +1,28 @@
|
|
|
1
1
|
import type { CiDiagnosticArtifactDeclaration } from "#template-core/ci-diagnostic-artifact";
|
|
2
2
|
import { type DevelopmentContainerToolLayerBuildArgument, type DevelopmentContainerToolLayerMount, type DevelopmentContainerToolLayerProbe, type PlannedDevelopmentContainerToolLayer } from "#template-core/development-container-tool-layer";
|
|
3
3
|
import type { CheckEnvironmentNeed, DeploymentEnvironmentNeed } from "#template-core/module-graph";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import { type ProjectBlueprintV2 } from "#template-core/project-blueprint-v2";
|
|
4
|
+
import type { BuiltInPresetDefinition, GenerationContext, PlannedPackageContribution, ResolvedPrimaryPackageIdentity } from "#template-core/preset-definition";
|
|
5
|
+
import { type ProjectBlueprint } from "#template-core/project-blueprint";
|
|
7
6
|
import type { DependencyMaintenancePolicy } from "#template-core/project-github";
|
|
8
7
|
import type { MaterializeProjectProjectionOptions, ProjectProjectionPathPrecondition, ProjectProjectionReconciliation } from "#template-core/project-projection";
|
|
9
8
|
import type { RenderOperation } from "#template-core/renderer";
|
|
10
9
|
import { type TemplateSourceHandle } from "#template-core/renderer";
|
|
11
|
-
|
|
10
|
+
import { type GenerationRecord } from "./generation-record.ts";
|
|
11
|
+
export type { PackageDefinition, PackageDefinitionId, PackageLinkIntent, PackageRole, PersistedPackageDefinition, ProjectBlueprint, } from "#template-core/project-blueprint";
|
|
12
12
|
export type { PackageContribution } from "#template-core/package-contribution";
|
|
13
13
|
export type BuiltInGenerationContext = GenerationContext;
|
|
14
14
|
export type { BuiltInPresetDefinition } from "#template-core/preset-definition";
|
|
15
15
|
export type NextStepInstruction = {
|
|
16
16
|
readonly display: string;
|
|
17
17
|
};
|
|
18
|
-
type GeneratedPackagePlanningRecord = {
|
|
19
|
-
readonly path: string;
|
|
20
|
-
readonly definitionName: string;
|
|
21
|
-
readonly planningContribution: "foundationPlan" | "planInitialization" | "planPackageAddition";
|
|
22
|
-
};
|
|
23
|
-
type GenerationRecord = {
|
|
24
|
-
readonly schemaVersion: 1;
|
|
25
|
-
readonly preset: string;
|
|
26
|
-
readonly templateVersion: "0.0.0";
|
|
27
|
-
readonly toolchain: BuiltInGenerationContext["toolchain"];
|
|
28
|
-
readonly packages: readonly GeneratedPackagePlanningRecord[];
|
|
29
|
-
};
|
|
30
18
|
export type GeneratedRepositoryPlan = {
|
|
31
19
|
readonly definitionName: string;
|
|
32
20
|
readonly plannerSourceFile: string;
|
|
33
21
|
readonly planningContribution: "planInitialization" | "planPackageAddition";
|
|
34
|
-
readonly blueprint:
|
|
22
|
+
readonly blueprint: ProjectBlueprint;
|
|
35
23
|
readonly generationRecord: GenerationRecord;
|
|
24
|
+
/** Resolved Preset contributions consumed by Blueprint and projections. */
|
|
25
|
+
readonly packageContributions: readonly PlannedPackageContribution[];
|
|
36
26
|
readonly operations: readonly RenderOperation[];
|
|
37
27
|
readonly reconciliation: readonly ProjectProjectionReconciliation[];
|
|
38
28
|
readonly developmentContainer: {
|
|
@@ -50,6 +40,17 @@ export type GeneratedRepositoryPlan = {
|
|
|
50
40
|
readonly dependencyMaintenancePolicy: DependencyMaintenancePolicy;
|
|
51
41
|
readonly nextStepInstructions: readonly NextStepInstruction[];
|
|
52
42
|
};
|
|
43
|
+
declare const localTemplateMetadataStateKey: unique symbol;
|
|
44
|
+
export type LocalTemplateMetadata = {
|
|
45
|
+
readonly blueprint: ProjectBlueprint;
|
|
46
|
+
readonly context: BuiltInGenerationContext;
|
|
47
|
+
/** Opaque Foundation-owned facts; callers pass the whole metadata value. */
|
|
48
|
+
readonly [localTemplateMetadataStateKey]: {
|
|
49
|
+
readonly generationRecord: GenerationRecord;
|
|
50
|
+
readonly foundationContribution: PlannedPackageContribution;
|
|
51
|
+
readonly packageContributions: readonly PlannedPackageContribution[];
|
|
52
|
+
};
|
|
53
|
+
};
|
|
53
54
|
export type GeneratedRepositoryPackageAdditionPlan = GeneratedRepositoryPlan & {
|
|
54
55
|
readonly projectProjections: {
|
|
55
56
|
readonly before: MaterializeProjectProjectionOptions;
|
|
@@ -57,11 +58,8 @@ export type GeneratedRepositoryPackageAdditionPlan = GeneratedRepositoryPlan & {
|
|
|
57
58
|
readonly preconditions: readonly ProjectProjectionPathPrecondition[];
|
|
58
59
|
};
|
|
59
60
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
readonly definition: BuiltInPresetDefinition;
|
|
63
|
-
readonly contribution: PackageContribution;
|
|
64
|
-
readonly plan: GeneratedRepositoryPlan;
|
|
61
|
+
export type PublicationSetupHandoff = null | {
|
|
62
|
+
readonly command: "./scripts/npm-publication-setup/setup.sh";
|
|
65
63
|
};
|
|
66
64
|
/**
|
|
67
65
|
* The Foundation persists the non-rendering half of every Package
|
|
@@ -71,7 +69,7 @@ export type BuiltInPresetTemplateSourceCheckContext = {
|
|
|
71
69
|
*/
|
|
72
70
|
/** Resolve an owned source handle for diagnostics and source checks. */
|
|
73
71
|
export declare function resolveBuiltInTemplateSource(source: TemplateSourceHandle, relativePath: string): string;
|
|
74
|
-
export declare function
|
|
72
|
+
export declare function validateProjectBlueprint(value: unknown): import("@ykdz/template-core/project-blueprint").BlueprintValidationResult;
|
|
75
73
|
declare class PresetRegistry {
|
|
76
74
|
#private;
|
|
77
75
|
constructor(definitions: readonly BuiltInPresetDefinition[]);
|
|
@@ -79,29 +77,45 @@ declare class PresetRegistry {
|
|
|
79
77
|
require(name: string): BuiltInPresetDefinition;
|
|
80
78
|
}
|
|
81
79
|
export declare const builtInPresetRegistry: PresetRegistry;
|
|
82
|
-
/** Registry-derived Template Source roots checked independently of render plans. */
|
|
83
|
-
export declare function builtInPresetTemplateSourceContexts(): readonly {
|
|
84
|
-
readonly name: string;
|
|
85
|
-
readonly root: string;
|
|
86
|
-
}[];
|
|
87
|
-
/**
|
|
88
|
-
* Derives direct Template Source checks from every registered Definition's
|
|
89
|
-
* actual initial contributions, without maintaining a second Preset catalog.
|
|
90
|
-
*/
|
|
91
|
-
export declare function builtInPresetTemplateSourceCheckContexts(): readonly BuiltInPresetTemplateSourceCheckContext[];
|
|
92
80
|
export declare function createGenerationContext(options: {
|
|
93
81
|
readonly targetDir: string;
|
|
94
|
-
readonly
|
|
82
|
+
readonly defaultPackageScope?: string;
|
|
95
83
|
readonly toolchain: BuiltInGenerationContext["toolchain"];
|
|
96
84
|
}): BuiltInGenerationContext;
|
|
85
|
+
export declare function loadLocalTemplateMetadata(repositoryRoot: string): LocalTemplateMetadata;
|
|
86
|
+
export type InitializationIdentityOverrides = {
|
|
87
|
+
readonly name?: string;
|
|
88
|
+
readonly path?: string;
|
|
89
|
+
readonly scope?: string;
|
|
90
|
+
};
|
|
91
|
+
export type ResolvedInitialization = {
|
|
92
|
+
readonly preset: string;
|
|
93
|
+
readonly topology: "configurable-primary-package" | "fixed";
|
|
94
|
+
readonly packages: readonly {
|
|
95
|
+
readonly name: string;
|
|
96
|
+
readonly path: string;
|
|
97
|
+
}[];
|
|
98
|
+
readonly scope: string;
|
|
99
|
+
};
|
|
97
100
|
export declare function planGeneratedRepositoryInitialization(options: {
|
|
98
101
|
readonly definition: BuiltInPresetDefinition;
|
|
99
102
|
readonly context: BuiltInGenerationContext;
|
|
100
103
|
}): GeneratedRepositoryPlan;
|
|
101
|
-
export declare function
|
|
104
|
+
export declare function prepareGeneratedRepositoryInitialization(options: {
|
|
102
105
|
readonly definition: BuiltInPresetDefinition;
|
|
106
|
+
readonly targetDir: string;
|
|
107
|
+
readonly toolchain: BuiltInGenerationContext["toolchain"];
|
|
108
|
+
readonly overrides?: InitializationIdentityOverrides;
|
|
109
|
+
}): {
|
|
103
110
|
readonly context: BuiltInGenerationContext;
|
|
104
|
-
readonly
|
|
111
|
+
readonly resolvedPackageIdentity?: ResolvedPrimaryPackageIdentity;
|
|
112
|
+
readonly resolved: ResolvedInitialization;
|
|
113
|
+
readonly plan: GeneratedRepositoryPlan;
|
|
114
|
+
readonly publicationSetup: PublicationSetupHandoff;
|
|
115
|
+
};
|
|
116
|
+
export declare function planGeneratedRepositoryPackageAddition(options: {
|
|
117
|
+
readonly definition: BuiltInPresetDefinition;
|
|
118
|
+
readonly localTemplateMetadata: LocalTemplateMetadata;
|
|
105
119
|
readonly packageLeafName: string;
|
|
106
120
|
readonly packagePath?: string;
|
|
107
121
|
/** Existing consumers that explicitly import the newly added provider. */
|