From d721aa290f48910b16ada79fa988845be4bf70c9 Mon Sep 17 00:00:00 2001 From: p-sw Date: Sat, 15 Jun 2024 02:59:23 +0900 Subject: [PATCH] fix(cli): check installed check with required files --- packages/cli/src/commands/add.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/cli/src/commands/add.tsx b/packages/cli/src/commands/add.tsx index 62d0c89..205254a 100644 --- a/packages/cli/src/commands/add.tsx +++ b/packages/cli/src/commands/add.tsx @@ -188,7 +188,7 @@ export default class Add extends Command { for await (const libFile of registry.lib) { const filePath = join(libFolder, libFile) if (!existsSync(filePath)) { - const libFileContentResponse = await safeFetch(registry.base + registry.paths.lib.replace('libName', libFile)) + const libFileContentResponse = await safeFetch(registry.base + registry.paths.lib.replace('{libName}', libFile)) if (!libFileContentResponse.ok) { libFileOra.fail(libFileContentResponse.message) return @@ -229,10 +229,10 @@ export default class Add extends Command { await mkdir(componentDir, {recursive: true}) } const installed = await getDirComponentInstalledFiles(componentObject, resolvedConfig) - if (installed.length === 0 && !force) { + const files = componentObject.files.filter((filename) => !installed.includes(filename)) + if (files.length === 0 && !force) { componentFileOra.succeed(`Component is already installed! (${componentDir})`) } else { - const files = componentObject.files.filter((filename) => !installed.includes(filename)) for await (const filename of files) { const componentFile = join(componentDir, filename) if (!existsSync(componentFile) || force) {