-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Implement text-based lockfile #15705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Failing |
|
Also failing frozen install. Also the file is not valid JSON but maybe it's not intended to be. If it is supposed to be JSON it'd be nice if the extension was json. Has issues like Fixing up the JSON and diffing it actually seems like maybe the only changes are the order of things in the Why doesn't this just use the output of |
|
In real project where each installed package have a long list of dependencies, the single line of dependencies approach would make it hard for versioning, as when we update the packages there will be a lot of change in single line and it'll feel clutered for reviewing. I suggest use multiple line, or adopt or format like YAML so we can achieve both consise and versioning-friendly purpose. |
Bun added support for a new lockfile format using the jsonc language. It uses an unconventional file extension, but it would be nice if VSCode understands it by default anyway. See oven-sh/bun#15705
|
Me |
What does this PR do?
Adds support for
bun.lock. With the followingpackage.json:{ "name": "pkg", "version": "2.2.2", "dependencies": { "is-number": "1.0.0", "is-odd": "^3.0.1" } }A JSON with trailing commas
bun.lockfile is created:{ "lockfileVersion": 0, "workspaces": { "": { "dependencies": { "is-number": "1.0.0", "is-odd": "^3.0.1", } } }, "packages": { "is-number": ["[email protected]", "", {}, "sha512-chlxkgJp4PZIiff6kUe/MWLp5+soELWNYA2IsOTus1YwKj8d9JZS6QsU7Ryqwhb1f4i0nQ5SsoUj6d5kGgq0KQ=="], "is-odd": ["[email protected]", "", { "dependencies": { "is-number": "^6.0.0" } }, "sha512-CQpnWPrDwmP1+SMHXZhtLtJv90yiyVfluGsX5iNCVkrhQtU3TQHsUWPG9wkdk9Lgd5yNpAg9jQEo90CBaXgWMA=="], "is-odd/is-number": ["[email protected]", "", {}, "sha512-Wu1VHeILBK8KAWJUAiSZQX94GmOE45Rg6/538fKwiloUu21KncEkYGPqob2oSZ5mUT73vLGrHQjKw3KMPwfDzg=="], } }closes #11863
closes #5486
Currently, if
bun.lockbexists andbun.lockdoes not, or no lockfile exists, bun will still use the binary format. Runningbun install --save-text-lockfilewill producebun.lock. Bun will choosebun.lockoverbun.lockbif both exist.How did you verify your code works?
Testing is ongoing. Currently there is code for converting
bun.lockbtobun.lockin memory then re-parsing it before installing.