From 7312d0faf4698146bfff50893d16a16e5c8d1e3a Mon Sep 17 00:00:00 2001 From: "Irsyad A. Panjaitan" Date: Tue, 11 Feb 2025 00:47:59 +0700 Subject: [PATCH] fix: reapply the existing component on `index.ts` --- package.json | 16 ++-------------- src/commands/add.ts | 6 ++---- src/resources/components.ts | 8 +++++++- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index fd25464..ec9b42c 100644 --- a/package.json +++ b/package.json @@ -7,13 +7,7 @@ "bin": { "justd": "dist/index.js" }, - "files": [ - "dist", - "src/resources", - "LICENSE", - "README.md", - "package.json" - ], + "files": ["dist", "src/resources", "LICENSE", "README.md", "package.json"], "repository": { "type": "git", "url": "git+https://github.com/justdlabs/cli.git" @@ -32,13 +26,7 @@ "release": "export GITHUB_TOKEN=$(cat .github_token) && release-it", "typecheck": "tsc --noEmit" }, - "keywords": [ - "cli", - "justd cli", - "Justd", - "design-system", - "justd" - ], + "keywords": ["cli", "justd cli", "Justd", "design-system", "justd"], "author": "Irsyad A. Panjaitan", "license": "MIT", "devDependencies": { diff --git a/src/commands/add.ts b/src/commands/add.ts index 7709899..f8d0557 100644 --- a/src/commands/add.ts +++ b/src/commands/add.ts @@ -73,7 +73,7 @@ async function updateIndexFile( * Sort the existing exports and add the primitive export at the beginning. * This ensures that the primitive export is always included first in the index file. */ - existingExports = [primitiveExport, ...existingExports.sort()] + existingExports = [primitiveExport, ...[...new Set(existingExports)].sort()] fs.writeFileSync(indexPath, `${existingExports.join("\n")}\n`, { flag: "w" }) @@ -292,9 +292,7 @@ export async function add(options: { }) } - if (!overwrite) { - await updateIndexFile(config, componentName) - } + await updateIndexFile(config, componentName) } catch (error) { console.error(warningText(`Error processing '${componentName}'.`)) } diff --git a/src/resources/components.ts b/src/resources/components.ts index 3c2e37c..633470b 100644 --- a/src/resources/components.ts +++ b/src/resources/components.ts @@ -269,7 +269,13 @@ const components: any[] = [ }, { name: "select", - children: [{ name: "field" }, { name: "list-box" }, { name: "popover" }], + children: [ + { name: "field" }, + { name: "list-box" }, + { name: "popover" }, + { name: "dialog" }, + { name: "keyboard" }, + ], }, { name: "multiple-select",