antfu-collective / ni

💡 Use the right package manager
MIT License
6.25k stars 208 forks source link

Use `package-manager-detector` in this library #218

Closed benmccann closed 2 weeks ago

benmccann commented 1 month ago

Clear and concise description of the problem

There are lots of places like create-svelte, svelte-add, shadcn-svelte, changesets, etc. where we've needed to detect the user's package manager. We end up duplicating this logic or using other packages, which are way too heavy

Suggested solution

I would love if the code to detect the user's preferred package manager were refactored out into a separate callable package. This repository could be made into a monorepo holding both packages with the CLI calling the library

Alternative

There is a preferred-pm package, but it has 24 dependencies: https://npmgraph.js.org/?q=preferred-pm

Additional context

No response

Validations

userquin commented 1 month ago

https://github.com/userquin/package-manager-detector (will be tranferred to antfu collective)

userquin commented 1 month ago

released initial version v0.0.1: https://github.com/antfu-collective/package-manager-detector/releases

benmccann commented 1 month ago

Amazing! Thank you @userquin!

I've renamed this issue to track the remaining portion of using package-manager-detector here