Skip to content

Commit

Permalink
Merge branch 'main' of github.com:nextui-org/nextui-cli into feat/eng…
Browse files Browse the repository at this point in the history
…-1637-canary
  • Loading branch information
winchesHe committed Dec 9, 2024
2 parents 5bf72af + 6795d1b commit f665616
Show file tree
Hide file tree
Showing 13 changed files with 456 additions and 305 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# [0.5.0](https://github.com/nextui-org/nextui-cli/compare/v0.4.2...v0.5.0) (2024-12-08)

### Bug Fixes

- **upgrade:** missing packages use min required and peerDep shoud use latest version ([#121](https://github.com/nextui-org/nextui-cli/issues/121)) ([a81e24b](https://github.com/nextui-org/nextui-cli/commit/a81e24ba2fec18e5efd129895ac5f980670c2507))

### Features

- prompt to choose agent when it cant be detected and some optimizations ([#122](https://github.com/nextui-org/nextui-cli/issues/122)) ([c7efffe](https://github.com/nextui-org/nextui-cli/commit/c7efffeb07a455dd6de7e8d8f4c3ab89ab7af33c))

## [0.4.2](https://github.com/nextui-org/nextui-cli/compare/v0.4.1...v0.4.2) (2024-12-07)

### Bug Fixes

- exit the process when all components added ([#119](https://github.com/nextui-org/nextui-cli/issues/119)) ([0863d3b](https://github.com/nextui-org/nextui-cli/commit/0863d3b1e71768e53a999b1e24504d5956ab5015))
- reduce fetch components ([#117](https://github.com/nextui-org/nextui-cli/issues/117)) ([6fca076](https://github.com/nextui-org/nextui-cli/commit/6fca0765dfc42451d17ba8ad3d78a9bc9eb35317))
- upgrade peerDep version required min version ([#120](https://github.com/nextui-org/nextui-cli/issues/120)) ([d40042e](https://github.com/nextui-org/nextui-cli/commit/d40042e1813f3269b301f61de6fa505177b2eedf))

## [0.4.1](https://github.com/nextui-org/nextui-cli/compare/v0.4.0...v0.4.1) (2024-12-06)

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": false,
"type": "module",
"license": "MIT",
"version": "0.4.1",
"version": "0.5.0",
"homepage": "https://github.com/nextui-org/nextui-cli#readme",
"description": "A CLI tool that unlocks seamless NextUI integration",
"keywords": [
Expand Down
29 changes: 17 additions & 12 deletions src/actions/add-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,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
29 changes: 22 additions & 7 deletions src/constants/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ export function getNextuiComponentsData(nextUIComponents: Components) {
};
}

export function initStoreComponentsData(nextUIComponents: Components) {
export function initStoreComponentsData({
beta,
nextUIComponents
}: {
beta: boolean;
nextUIComponents: Components;
}) {
const {
nextUIComponentsKeys,
nextUIComponentsKeysSet,
Expand All @@ -37,12 +43,21 @@ export function initStoreComponentsData(nextUIComponents: Components) {
nextUIcomponentsPackages
} = getNextuiComponentsData(nextUIComponents);

store.nextUIComponents = nextUIComponents;
store.nextUIComponentsKeys = nextUIComponentsKeys;
store.nextUIComponentsKeysSet = nextUIComponentsKeysSet;
store.nextUIComponentsMap = nextUIComponentsMap;
store.nextUIComponentsPackageMap = nextUIComponentsPackageMap;
store.nextUIcomponentsPackages = nextUIcomponentsPackages;
if (beta) {
store.betaNextUIComponents = nextUIComponents;
store.betaNextUIComponentsKeys = nextUIComponentsKeys;
store.betaNextUIComponentsKeysSet = nextUIComponentsKeysSet;
store.betaNextUIComponentsMap = nextUIComponentsMap;
store.betaNextUIComponentsPackageMap = nextUIComponentsPackageMap;
store.betaNextUIcomponentsPackages = nextUIcomponentsPackages;
} else {
store.nextUIComponents = nextUIComponents;
store.nextUIComponentsKeys = nextUIComponentsKeys;
store.nextUIComponentsKeysSet = nextUIComponentsKeysSet;
store.nextUIComponentsMap = nextUIComponentsMap;
store.nextUIComponentsPackageMap = nextUIComponentsPackageMap;
store.nextUIcomponentsPackages = nextUIcomponentsPackages;
}
}

export type NextUIComponentsMap = Record<string, (typeof store.nextUIComponents)[number]>;
Expand Down
Loading

0 comments on commit f665616

Please sign in to comment.