refactor(cli): modify return type of getComponentLibVersion

Modified the return type of the function getComponentLibVersion in registry.ts. Instead of returning a string or null, it now returns an object with a boolean type 'ok' status and 'libVersion'. The 'ok' attribute indicates whether the library version is included in the registry.
This commit is contained in:
p-sw 2024-06-11 13:35:27 +09:00
parent 7c3459076a
commit 6f5ec5042d

View File

@ -34,12 +34,12 @@ export async function getComponentRealname(
export async function getComponentLibVersion(
registry: Registry,
componentName: keyof (typeof registry)['components'],
): Promise<string | null> {
): Promise<{ok: boolean; libVersion: string}> {
const libVersion = registry.components[componentName].libVersion
if (!registry.lib.includes(libVersion)) {
return null
return {ok: false, libVersion}
}
return libVersion
return {ok: true, libVersion}
}
export async function getLibURL(registry: Registry, version: string): Promise<string> {