Skip to content
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(bun): Add support for updating text-format lockfile when package.json changes #33189

Merged

Conversation

nathankleyn
Copy link
Contributor

@nathankleyn nathankleyn commented Dec 18, 2024

Changes

Bun 1.2.x will introduce and switch by default to a text-format verison of the lockfile. Where currently they use a binary version named bun.lockb, this will become bun.lock and be plaintext:

https://bun.sh/blog/bun-lock-text-lockfile

This can be switched on by default in-advance since Bun 1.1.40 and so will appear in the wild as of now:

https://bun.sh/blog/bun-v1.1.40#new-install-savetextlockfile-in-bunfig-toml

This commit adds support for both lockfile formats by supporting by file-suffixes.

Context

As of Bun 1.1.40, this feature can be opted-in and Renovate no longer works for Bun without it.

As of Bun 1.2.x this feature will be on by default.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

The docs that would be affected are auto-generated ones

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

Tested and run on https://github.com/nathankleyn/bun-renovate-text-lockfile-test, where you can see a PR at which correctly detected and changed the new-style lockfile: nathankleyn/bun-renovate-text-lockfile-test#2

Sorry, something went wrong.

Bun 1.2 will introduce and switch by default to a text-format verison of
the lockfile. Where currently they use a binary version named
`bun.lockb`, this will become `bun.lock` and be plaintext:

https://bun.sh/blog/bun-lock-text-lockfile

This can be switched on by default in-advance since Bun 1.1.40 and so
will appear in the wild as of now:

https://bun.sh/blog/bun-v1.1.40#new-install-savetextlockfile-in-bunfig-toml

This commit adds support for both lockfile formats by supporting by
file-suffixes.
@nathankleyn nathankleyn force-pushed the add-support-for-bun-text-format-lockfile branch from ce825ec to 50e6e6a Compare December 18, 2024 12:47
Copy link
Collaborator

@rarkins rarkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs testing on a real repo with text lockfile format

lib/modules/manager/bun/index.ts Outdated Show resolved Hide resolved
@nathankleyn nathankleyn requested a review from rarkins December 18, 2024 14:21
@nathankleyn
Copy link
Contributor Author

@rarkins Thanks so much for super-fast review — I've made that fix to simplify the regex, and I've created a public repository where I've run Renovate with the changes at https://github.com/nathankleyn/bun-renovate-text-lockfile-test — you can see a PR at which correctly detected and changed the new-style lockfile: nathankleyn/bun-renovate-text-lockfile-test#2

rarkins
rarkins previously approved these changes Dec 18, 2024
@rarkins
Copy link
Collaborator

rarkins commented Dec 18, 2024

@nathankleyn thanks for your PR! I'm surprised/delighted to discover that this started working with very little logic change.

@rarkins rarkins changed the title feat: Add support for Bun's text-format lockfile feat(bun): Add support for updating text-format lockfile when package.json changes Dec 18, 2024
@rarkins rarkins disabled auto-merge December 18, 2024 14:26
@rarkins rarkins added this pull request to the merge queue Dec 18, 2024
Merged via the queue into renovatebot:main with commit ca821eb Dec 18, 2024
38 checks passed
@nathankleyn nathankleyn deleted the add-support-for-bun-text-format-lockfile branch December 18, 2024 14:48
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 39.74.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants