Accept replaces-base option

This commit is contained in:
Michael B. Gale
2026-04-25 17:54:46 +01:00
parent 4d2c7c6e10
commit efdcb31f11
4 changed files with 30 additions and 3 deletions
+1
View File
@@ -198,6 +198,7 @@ async function startProxy(
.map((credential) => ({
type: credential.type,
url: credential.url,
"replaces-base": credential["replaces-base"],
}));
core.setOutput("proxy_urls", JSON.stringify(registry_urls));
+14 -1
View File
@@ -347,8 +347,21 @@ export function getCredentials(
);
}
// Construct the base credential object.
const baseCredential: Omit<Registry, keyof Address> = { type: e.type };
if (isDefined(e["replaces-base"])) {
if (typeof e["replaces-base"] === "boolean") {
baseCredential["replaces-base"] = e["replaces-base"];
} else {
throw new ConfigurationError(
"Invalid credentials - 'replaces-base' must be a boolean",
);
}
}
out.push({
type: e.type,
...baseCredential,
...authConfig,
...address,
});
+2
View File
@@ -246,6 +246,8 @@ export function credentialToStr(credential: Credential): string {
export type Registry = {
/** The type of the package registry. */
type: string;
/** Whether the registry replaces the base registry for the ecosystem. */
"replaces-base"?: boolean;
} & Address;
// If a registry has an `url`, then that takes precedence over the `host` which may or may