From 2d68a5051f2f9b25f35dd5fb00554d2ccc0d77ee Mon Sep 17 00:00:00 2001 From: p-sw Date: Sat, 15 Jun 2024 02:30:29 +0900 Subject: [PATCH] feat(cli): add ability to make dir component URL in getComponentURL --- packages/cli/src/helpers/registry.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/helpers/registry.ts b/packages/cli/src/helpers/registry.ts index ef46c29..9379a78 100644 --- a/packages/cli/src/helpers/registry.ts +++ b/packages/cli/src/helpers/registry.ts @@ -23,8 +23,17 @@ export async function getAvailableComponentNames(registry: Registry): Promise { - return registry.base + registry.paths.components.replace('{componentName}', registry.components[componentName].name) +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 getComponentRealname(