@kungfu-tech/buildchain 2.10.11 → 2.11.0
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/bin/buildchain.mjs +2 -1
- package/dist/site/buildchain-contract.json +5 -5
- package/dist/site/buildchain-site.json +17 -17
- package/dist/site/kfd-claims.json +2 -2
- package/dist/site/kfd-upstream-aggregate.json +1 -1
- package/dist/site/manual-registry.json +3 -3
- package/dist/site/node-api-registry.json +5 -5
- package/dist/site/page-registry.json +10 -10
- package/dist/site/public-surface-audit.json +1 -1
- package/dist/site/site-manifest.json +7 -7
- package/docs/MAP.md +5 -5
- package/docs/cli.md +5 -3
- package/docs/publication-artifacts.md +44 -3
- package/docs/release-propagation.md +50 -1
- package/package.json +1 -1
- package/packages/core/README.md +3 -1
- package/packages/core/buildchain-config.js +35 -0
- package/packages/core/index.js +2 -0
- package/packages/core/publication-artifact.js +294 -3
- package/packages/core/release-propagation.js +71 -2
- package/scripts/publication-artifact.mjs +5 -1
|
@@ -212,14 +212,79 @@ function normalizePackageFact(pkg = {}) {
|
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
function normalizeDigestUrlFact(value = {}, label) {
|
|
216
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
217
|
+
throw new Error(`${label} must be an object`);
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
url: assertString(value.url, `${label}.url`),
|
|
221
|
+
sha256: assertString(value.sha256 || value.digest, `${label}.sha256`),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function normalizeOptionalPathDigestUrlFact(value = undefined, label) {
|
|
226
|
+
if (value === undefined || value === null) {
|
|
227
|
+
return undefined;
|
|
228
|
+
}
|
|
229
|
+
const normalized = normalizeDigestUrlFact(value, label);
|
|
230
|
+
return {
|
|
231
|
+
path: optionalString(value.path),
|
|
232
|
+
bytes: value.bytes === undefined ? undefined : Number(value.bytes),
|
|
233
|
+
...normalized,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function normalizePublicationArtifactFact(value = undefined) {
|
|
238
|
+
if (value === undefined || value === null) {
|
|
239
|
+
return undefined;
|
|
240
|
+
}
|
|
241
|
+
const artifact = assertPlainObject(value, "upstreamRelease.publicationArtifact");
|
|
242
|
+
return {
|
|
243
|
+
id: optionalString(artifact.id),
|
|
244
|
+
kind: optionalString(artifact.kind),
|
|
245
|
+
version: assertString(artifact.version, "upstreamRelease.publicationArtifact.version"),
|
|
246
|
+
canonicalUrl: assertString(
|
|
247
|
+
artifact.canonicalUrl || artifact.canonical_url,
|
|
248
|
+
"upstreamRelease.publicationArtifact.canonicalUrl",
|
|
249
|
+
),
|
|
250
|
+
latestUrl: assertString(
|
|
251
|
+
artifact.latestUrl || artifact.latest_url,
|
|
252
|
+
"upstreamRelease.publicationArtifact.latestUrl",
|
|
253
|
+
),
|
|
254
|
+
latestEvidenceUrl: optionalString(artifact.latestEvidenceUrl || artifact.latest_evidence_url),
|
|
255
|
+
immutableVersionUrl: assertString(
|
|
256
|
+
artifact.immutableVersionUrl || artifact.immutable_version_url || artifact.immutableVersionPrefix || artifact.immutable_version_prefix,
|
|
257
|
+
"upstreamRelease.publicationArtifact.immutableVersionUrl",
|
|
258
|
+
),
|
|
259
|
+
immutableVersionPrefix: optionalString(artifact.immutableVersionPrefix || artifact.immutable_version_prefix),
|
|
260
|
+
registry: normalizeDigestUrlFact(artifact.registry, "upstreamRelease.publicationArtifact.registry"),
|
|
261
|
+
manifest: normalizeDigestUrlFact(artifact.manifest, "upstreamRelease.publicationArtifact.manifest"),
|
|
262
|
+
passport: normalizeDigestUrlFact(artifact.passport, "upstreamRelease.publicationArtifact.passport"),
|
|
263
|
+
primaryArtifact: normalizeOptionalPathDigestUrlFact(
|
|
264
|
+
artifact.primaryArtifact || artifact.primary_artifact,
|
|
265
|
+
"upstreamRelease.publicationArtifact.primaryArtifact",
|
|
266
|
+
),
|
|
267
|
+
sourceBundle: normalizeOptionalPathDigestUrlFact(
|
|
268
|
+
artifact.sourceBundle || artifact.source_bundle,
|
|
269
|
+
"upstreamRelease.publicationArtifact.sourceBundle",
|
|
270
|
+
),
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
215
274
|
function normalizeUpstreamRelease(input) {
|
|
216
275
|
const release = assertPlainObject(input, "upstreamRelease");
|
|
276
|
+
const publicationArtifact = normalizePublicationArtifactFact(release.publicationArtifact || release.publication_artifact);
|
|
277
|
+
const packageFact = release.package === undefined ? undefined : normalizePackageFact(release.package);
|
|
278
|
+
if (!packageFact && !publicationArtifact) {
|
|
279
|
+
throw new Error("upstreamRelease requires package or publicationArtifact");
|
|
280
|
+
}
|
|
217
281
|
return {
|
|
218
282
|
repository: assertString(release.repository, "upstreamRelease.repository"),
|
|
219
283
|
channel: normalizeChannel(release.channel, "upstreamRelease.channel"),
|
|
220
284
|
tag: assertString(release.tag, "upstreamRelease.tag"),
|
|
221
285
|
sourceSha: assertString(release.sourceSha || release.source_sha, "upstreamRelease.sourceSha"),
|
|
222
|
-
package:
|
|
286
|
+
package: packageFact,
|
|
287
|
+
publicationArtifact,
|
|
223
288
|
releasePassport: normalizeReleasePassport(release.releasePassport || release.release_passport),
|
|
224
289
|
siteBundle: release.siteBundle || release.site_bundle
|
|
225
290
|
? {
|
|
@@ -250,6 +315,7 @@ export function createReleasePropagationLock({
|
|
|
250
315
|
tag: upstreamRelease.tag,
|
|
251
316
|
sourceSha: upstreamRelease.sourceSha,
|
|
252
317
|
package: upstreamRelease.package,
|
|
318
|
+
publicationArtifact: upstreamRelease.publicationArtifact,
|
|
253
319
|
releasePassport: upstreamRelease.releasePassport,
|
|
254
320
|
siteBundle: upstreamRelease.siteBundle,
|
|
255
321
|
},
|
|
@@ -278,7 +344,10 @@ export function planReleasePropagation({ graph: graphInput, upstreamRelease: rel
|
|
|
278
344
|
const upstreamRelease = normalizeUpstreamRelease(releaseInput);
|
|
279
345
|
const source = sourceNode
|
|
280
346
|
? graph.nodes.find((node) => node.id === sourceNode)
|
|
281
|
-
: graph.nodes.find((node) =>
|
|
347
|
+
: graph.nodes.find((node) =>
|
|
348
|
+
node.repository === upstreamRelease.repository
|
|
349
|
+
|| (upstreamRelease.package && node.package === upstreamRelease.package.name),
|
|
350
|
+
);
|
|
282
351
|
if (!source) {
|
|
283
352
|
throw new Error("could not resolve source node for upstream release");
|
|
284
353
|
}
|
|
@@ -14,12 +14,13 @@ function readBooleanFlag(args, name) {
|
|
|
14
14
|
export function runPublicationArtifactCli(args = process.argv.slice(2)) {
|
|
15
15
|
const [mode = "manifest"] = args;
|
|
16
16
|
if (!["manifest", "collect"].includes(mode)) {
|
|
17
|
-
throw new Error("usage: buildchain publication-artifact manifest [--cwd <dir>] [--source-sha <sha>] [--output <file>] [--passport-output <file>] [--source-bundle <file>] [--no-source-bundle] [--json]");
|
|
17
|
+
throw new Error("usage: buildchain publication-artifact manifest [--cwd <dir>] [--source-sha <sha>] [--output <file>] [--passport-output <file>] [--registry-output <file>] [--source-bundle <file>] [--no-source-bundle] [--json]");
|
|
18
18
|
}
|
|
19
19
|
const result = writePublicationArtifact({
|
|
20
20
|
cwd: readFlag(args, "cwd", process.cwd()),
|
|
21
21
|
output: readFlag(args, "output", ""),
|
|
22
22
|
passportOutput: readFlag(args, "passport-output", ""),
|
|
23
|
+
registryOutput: readFlag(args, "registry-output", ""),
|
|
23
24
|
sourceSha: readFlag(args, "source-sha", ""),
|
|
24
25
|
sourceBundlePath: readFlag(args, "source-bundle", ""),
|
|
25
26
|
sourceBundle: !readBooleanFlag(args, "no-source-bundle"),
|
|
@@ -30,6 +31,9 @@ export function runPublicationArtifactCli(args = process.argv.slice(2)) {
|
|
|
30
31
|
} else {
|
|
31
32
|
process.stdout.write(`publication-manifest=${result.manifestPath}\n`);
|
|
32
33
|
process.stdout.write(`publication-passport=${result.passportPath}\n`);
|
|
34
|
+
if (result.registryPath) {
|
|
35
|
+
process.stdout.write(`publication-registry=${result.registryPath}\n`);
|
|
36
|
+
}
|
|
33
37
|
process.stdout.write(`publication-primary-artifact=${result.manifest.publication.primaryArtifact}\n`);
|
|
34
38
|
}
|
|
35
39
|
return result;
|