oven-sh / bun

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

Support `yarn.lock` in `bun pm migrate` #6409

Open Jarred-Sumner opened 11 months ago

Jarred-Sumner commented 11 months ago

Tracking issue following up from https://github.com/oven-sh/bun/issues/1751

wojtekmaj commented 11 months ago

Note Yarn Classic (v1) and Yarn Berry (v2+) uses completely different lockfile formats. Is this tracking both?

john-griffin commented 11 months ago

Looking forward to this. We tried to do yarn.lock -> package-lock.json -> bun. But we lost too much context and couldn't build the apps.

yharaskrik commented 11 months ago

This would be amazing and help us incrementally adopt bun

Jarred-Sumner commented 11 months ago

Note Yarn Classic (v1) and Yarn Berry (v2+) uses completely different lockfile formats. Is this tracking both?

This is tracking Yarn v1 because npm download stats suggest more people use it.

wojtekmaj commented 11 months ago

@Jarred-Sumner, you cannot rely on npm download stats. Here's why:

https://twitter.com/wojtekmaj91/status/1679944016941527040

This is an extremely bad way of comparing package managers popularity.

  • Package managers updated more often will get downloaded more often by the same users.
  • Yarn Berry used to sit inside the repo in .yarn/releases. This resulted in one download per repo, and it wasn't from npm.
  • Node Corepack doesn't use npm for all Yarn versions - see source code: https://github.com/nodejs/corepack/blob/main/config.json

My suggestion would be to count lockfiles and packageManager entries in package.json in OSS repositories instead. Of course, easier said than done.

wojtekmaj commented 11 months ago

Actually, this inspired me to measure package managers popularity it as accurately as possible. Here are the results.

https://dev.to/wojtekmaj/package-manager-wars-the-real-picture-e9p

muzuiget commented 10 months ago

I hope bun can add support for loading and writing Yarn v1 lock file directly, so we can use bun as a drop-in replacement for Yarn v1, because current workflow and keyboard muscle memory are not easily to change.

alias yarn='bun yarn-v1'
yarn install # CRUD the yarn.lock file

I think Yarn v1 stills has large users, see the Yarn v4 document Migrating from 1.x / npm, and Alpine Linux only pack Yarn v1.

I don't like Yarn v4, it makes a package manager so complex, they don't release a standalone binary for Yarn v4, it need you to use Corepack, a package manager depency another pacakge manger, it doesn't make sense.

When I use Yarn v1 to replace npm as package manager, only a few reasons:

I don't need any advanced features like PnP, workspace, just need it downloads the package files fast.

XenoWad01 commented 7 months ago

@john-griffin You can now bun install package-lock.json if you are on bun canary. https://github.com/oven-sh/bun/issues/1751#issuecomment-1757253940

terion-name commented 3 months ago

any progress here?( it is very strange that bun can print yarn.lock but cannot do reverse