Handle kind property in registries

This commit is contained in:
Dave Bartolomeo 2024-10-01 14:44:46 -04:00
parent e1763c0db9
commit 6682b14bf4
3 changed files with 10 additions and 5 deletions

5
lib/config-utils.js generated
View file

@ -498,8 +498,8 @@ function parseRegistries(registriesInput) {
} }
function parseRegistriesWithoutCredentials(registriesInput) { function parseRegistriesWithoutCredentials(registriesInput) {
return parseRegistries(registriesInput)?.map((r) => { return parseRegistries(registriesInput)?.map((r) => {
const { url, packages } = r; const { url, packages, kind } = r;
return { url, packages }; return { url, packages, kind };
}); });
} }
function isLocal(configPath) { function isLocal(configPath) {
@ -623,6 +623,7 @@ function createRegistriesBlock(registries) {
// ensure the url ends with a slash to avoid a bug in the CLI 2.10.4 // ensure the url ends with a slash to avoid a bug in the CLI 2.10.4
url: !registry?.url.endsWith("/") ? `${registry.url}/` : registry.url, url: !registry?.url.endsWith("/") ? `${registry.url}/` : registry.url,
packages: registry.packages, packages: registry.packages,
kind: registry.kind,
})); }));
const qlconfig = { const qlconfig = {
registries: safeRegistries, registries: safeRegistries,

File diff suppressed because one or more lines are too long

View file

@ -63,6 +63,9 @@ export interface RegistryConfigNoCredentials {
// List of globs that determine which packs are associated with this registry. // List of globs that determine which packs are associated with this registry.
packages: string[] | string; packages: string[] | string;
// Kind of registry, either "github" or "docker". Default is "docker".
kind?: "github" | "docker";
} }
interface ExcludeQueryFilter { interface ExcludeQueryFilter {
@ -871,8 +874,8 @@ export function parseRegistriesWithoutCredentials(
registriesInput?: string, registriesInput?: string,
): RegistryConfigNoCredentials[] | undefined { ): RegistryConfigNoCredentials[] | undefined {
return parseRegistries(registriesInput)?.map((r) => { return parseRegistries(registriesInput)?.map((r) => {
const { url, packages } = r; const { url, packages, kind } = r;
return { url, packages }; return { url, packages, kind };
}); });
} }
@ -1039,6 +1042,7 @@ function createRegistriesBlock(registries: RegistryConfigWithCredentials[]): {
// ensure the url ends with a slash to avoid a bug in the CLI 2.10.4 // ensure the url ends with a slash to avoid a bug in the CLI 2.10.4
url: !registry?.url.endsWith("/") ? `${registry.url}/` : registry.url, url: !registry?.url.endsWith("/") ? `${registry.url}/` : registry.url,
packages: registry.packages, packages: registry.packages,
kind: registry.kind,
})); }));
const qlconfig = { const qlconfig = {
registries: safeRegistries, registries: safeRegistries,