Skip to content

Commit

Permalink
fix: exit the process when all components added
Browse files Browse the repository at this point in the history
  • Loading branch information
winchesHe committed Dec 7, 2024
1 parent 3cd788a commit caaf1ae
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/actions/add-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,25 @@ export async function addAction(components: string[], options: AddActionOptions)
const isNextUIAll = !!allDependencies[NEXT_UI];

if (!components.length && !all) {
const filteredComponents = store.nextUIComponents.filter(
(component) =>
!currentComponents.some((currentComponent) => currentComponent.name === component.name)
);

if (!filteredComponents.length) {
Logger.success('✅ All components have been added');
process.exit(0);
}

components = await getAutocompleteMultiselect(
'Which components would you like to add?',
store.nextUIComponents
.filter(
(component) =>
!currentComponents.some((currentComponent) => currentComponent.name === component.name)
)
.map((component) => {
return {
description: component.description,
title: component.name,
value: component.name
};
})
filteredComponents.map((component) => {
return {
description: component.description,
title: component.name,
value: component.name
};
})
);
} else if (all) {
components = [NEXT_UI];
Expand Down

0 comments on commit caaf1ae

Please sign in to comment.