refactor(cli): make getComponentURL handle only file component

This commit is contained in:
p-sw 2024-06-15 03:33:26 +09:00
parent 9b0b37ec01
commit 6d3f29a614

View File

@ -1,4 +1,4 @@
import {REGISTRY_URL, Registry} from '../const.js'
import {Registry, REGISTRY_URL, RegistryComponent} from '../const.js'
import {safeFetch} from './safeFetcher.js'
export async function getRegistry(
@ -19,15 +19,6 @@ export async function getRegistry(
return registryResponse
}
export async function getComponentURL(
registry: Registry,
componentName: string,
dirComponentFile?: string,
): Promise<string> {
let base =
registry.base + registry.paths.components.replace('{componentName}', registry.components[componentName].name)
if (dirComponentFile) {
base += '/' + dirComponentFile
}
return base
export async function getComponentURL(registry: Registry, component: RegistryComponent): Promise<string> {
return registry.base + registry.paths.components.replace('{componentName}', component.name)
}