Skip to content

Commit efdcb31

Browse files
committed
Accept replaces-base option
1 parent 4d2c7c6 commit efdcb31

4 files changed

Lines changed: 30 additions & 3 deletions

File tree

lib/start-proxy-action.js

Lines changed: 13 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/start-proxy-action.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ async function startProxy(
198198
.map((credential) => ({
199199
type: credential.type,
200200
url: credential.url,
201+
"replaces-base": credential["replaces-base"],
201202
}));
202203
core.setOutput("proxy_urls", JSON.stringify(registry_urls));
203204

src/start-proxy.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,21 @@ export function getCredentials(
347347
);
348348
}
349349

350+
// Construct the base credential object.
351+
const baseCredential: Omit<Registry, keyof Address> = { type: e.type };
352+
353+
if (isDefined(e["replaces-base"])) {
354+
if (typeof e["replaces-base"] === "boolean") {
355+
baseCredential["replaces-base"] = e["replaces-base"];
356+
} else {
357+
throw new ConfigurationError(
358+
"Invalid credentials - 'replaces-base' must be a boolean",
359+
);
360+
}
361+
}
362+
350363
out.push({
351-
type: e.type,
364+
...baseCredential,
352365
...authConfig,
353366
...address,
354367
});

src/start-proxy/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,8 @@ export function credentialToStr(credential: Credential): string {
246246
export type Registry = {
247247
/** The type of the package registry. */
248248
type: string;
249+
/** Whether the registry replaces the base registry for the ecosystem. */
250+
"replaces-base"?: boolean;
249251
} & Address;
250252

251253
// If a registry has an `url`, then that takes precedence over the `host` which may or may

0 commit comments

Comments
 (0)