From 6d3f29a6141809f9cf265a74ce5b892dcf5d7a72 Mon Sep 17 00:00:00 2001 From: p-sw Date: Sat, 15 Jun 2024 03:33:26 +0900 Subject: [PATCH] refactor(cli): make getComponentURL handle only file component --- packages/cli/src/helpers/registry.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/cli/src/helpers/registry.ts b/packages/cli/src/helpers/registry.ts index c53fb8b..a048b6b 100644 --- a/packages/cli/src/helpers/registry.ts +++ b/packages/cli/src/helpers/registry.ts @@ -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 { - 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 { + return registry.base + registry.paths.components.replace('{componentName}', component.name) }