oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.29k stars 2.77k forks source link

Support npm commands, specifically install #15198

Open leftmove opened 1 day ago

leftmove commented 1 day ago

What is the problem this feature would solve?

A lot of existing websites that advertise NPM libraries have an easy copy/paste button that copies npm install {package}.

It gets somewhat tedious having to replacenpm with bun add package. I know that bun install or even bun install --save-dev works, but it would useful if I could just copy/paste npm anyways.

What is the feature you are proposing to solve the problem?

bun npm install {package}

Whenever npm is given as an argument, Bun could just run the equivalent NPM command, factoring in for things like npm i or even other package mangers PNPM or Yarn.

This would be really convenient and work towards Bun's mission of being the drop-in Node.js replacement.

What alternatives have you considered?

Replacing every npm with bun works, but the time adds up.

nektro commented 12 hours ago

which websites do you find yourself copying from most often?

tobycm commented 8 hours ago

i have a simple alias for myself for situations like this:

alias bnpm=bun

usage: type b and paste npm command: bnpm install abcxyz