nextui-org / nextui-cli

⌨️ A CLI tool that unlocks seamless NextUI integration.
MIT License
37 stars 14 forks source link

[Feature Request] Optimize getPackageManagerInfo function #51

Closed winchesHe closed 3 months ago

winchesHe commented 4 months ago

Is your feature request related to a problem? Please describe.

  1. get the exactly type return

Describe the solution you'd like

Referrence: src/constants/store.ts getStore function

Describe alternatives you've considered

No

Screenshots or Videos

No response

ankiiisharma commented 4 months ago

hey @winchesHe , i would like to work on this can you please elaborate this a bit

winchesHe commented 4 months ago

@ankiiisharma Sure

  1. Change the packageManager: string to packageManager: Agent and use generic T instead Agent
  2. When use const { install, remove } = getPackageManagerInfo('npm') got type install --> 'install' remove --> 'unistall' With bun: const { install, remove } = getPackageManagerInfo('bun') got type install --> 'add' remove --> 'remove'

More Referrence:

  1. src/constants/store.ts getStore function
  2. src/helpers/check.ts combineProblemRecord function
  3. src/helpers/upgrade.ts upgrade function
ankiiisharma commented 4 months ago

Onit , can you assign this to me?

winchesHe commented 4 months ago

@ankiiisharma Assigned it to you 🚀

ankiiisharma commented 4 months ago

@winchesHe , If I have not mistaken, would you like me to make the changes in src/helpers/utils.ts file?

-Refactor getPackageManagerInfo to use generics for dynamic inference of install and remove types based on package manager. -Update return type for improved type safety and flexibility. -Restructure function for better readability.

ankiiisharma commented 4 months ago

@winchesHe kindly check.