Skip to content

Commit 68fd7b0

Browse files
committed
Accept replaces-base option
1 parent 7c1e621 commit 68fd7b0

4 files changed

Lines changed: 21 additions & 3 deletions

File tree

lib/start-proxy-action.js

Lines changed: 7 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: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,18 @@ 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 (
354+
isDefined(e["replaces-base"]) &&
355+
typeof e["replaces-base"] === "boolean"
356+
) {
357+
baseCredential["replaces-base"] = e["replaces-base"];
358+
}
359+
350360
out.push({
351-
type: e.type,
361+
...baseCredential,
352362
...authConfig,
353363
...address,
354364
});

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)