-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
feat(install): automatically migrate package-lock.json to bun.lockb #6352
Conversation
…re lockfile edge cases :/
src/install/install.zig
Outdated
var root = Lockfile.Package{}; | ||
var needs_new_lockfile = load_lockfile_result != .ok or (load_lockfile_result.ok.buffers.dependencies.items.len == 0 and manager.package_json_updates.len > 0); | ||
var needs_new_lockfile = load_lockfile_result != .ok or load_lockfile_result.ok.buffers.dependencies.items.len == 0 and manager.package_json_updates.len > 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not. lol
/// | ||
/// By default, the underlying buffer is filled with "invalid_id" to indicate this package ID | ||
/// was not resolved | ||
resolutions: PackageIDSlice = .{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets not move the order of these fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
damn i didnt realize i did that
can u add a test case for |
cool |
✅ |
❌ @paperdave 9 files with test failures on bun-darwin-aarch64:
|
❌ @paperdave 6 files with test failures on linux-x64:
|
❌ @paperdave 6 files with test failures on linux-x64-baseline:
|
❌ @paperdave 9 files with test failures on bun-darwin-x64-baseline:
|
What does this PR do?
If you do not have a
bun.lockb
, but apackage-lock.json
exists, this PR reads that data and generates a bun lockfile in memory, and uses that for the install.I think the migration can be made faster, but people will ideally only run this once per project, so it is fine.
If a
yarn.lock
orpnpm-lock.yaml
exists, a warning is printedAll of the above only happens if no
bun.lockb
is present. so this has no perf impact on existing projects.You can also run
bun pm migrate
to run just the migrator code path, useful for testing.There are some situations where this migration is not 100% accurate to what npm installs, which is due to bugs and limitations/optimizations of Bun's package hoisting logic.