feat(bun): add support for bunfig.toml registry config - #45748
Open
dennisameling wants to merge 11 commits into
Open
feat(bun): add support for bunfig.toml registry config#45748dennisameling wants to merge 11 commits into
dennisameling wants to merge 11 commits into
Conversation
Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
Signed-off-by: Sebastian Danielsson <sebastian.danielsson@proton.me>
Addresses the review feedback on renovatebot#39830 and fixes the registry resolution against Bun 1.4.2: - Move the schema into `schema.ts` and parse with `Toml.pipe()`, so the registry union is normalized to a URL string by a schema transform instead of a hand-written `normalizeBunfigConfig()` function - Apply the registries before the package file is pushed onto the result, so the changes cannot get lost through the object spread - Read `bunfig.toml` next to the Bun lock file only, instead of searching parent directories: Bun does not walk up the tree, and a workspace member's own `bunfig.toml` is ignored by `bun install` too. Matching the file through `managerFilePatterns` also keeps the extract cache correct. - Keep a scoped registry from `.npmrc`, which Bun merges key by key and therefore still prefers over the default registry from `bunfig.toml` - Ignore registries which are not HTTP(S) URLs, such as unexpanded environment variables, and strip credentials from the registry URL so they stay out of logs and pull request bodies Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
dennisameling
marked this pull request as ready for review
September 7, 2026 10:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Renovate now reads the
[install]registry configuration frombunfig.tomlwhen it detects a Bun lock file, and applies the resolved registry to the npm dependencies of that lock file's package files.This continues #39830 by @sebdanielsson, with their commits preserved, rebased onto
mainand finished off against Bun 1.4.2.Review feedback from #39830 that is addressed here:
schema.tsand is parsed withToml.pipe(); thestring | { url }union is normalized to a URL string by a schema transform instead of a hand-writtennormalizeBunfigConfig()functioncodeBlockandtoMatchObjectare used in the testsbunfig.tomlare handled. They are not, because Bun does not handle them either: I verified against Bun 1.4.2 thatbun installreads only thebunfig.tomlnext to the lock file, both when run from the workspace root and when run from inside a workspace member. Renovate now does the same, and no longer searches parent directories for the file.Finalized on top of that:
bunfig.tomlis matched throughmanagerFilePatterns, so the extract cache stays correct when only that file changes.npmrckeeps precedence over the defaultregistryfrombunfig.toml. Bun merges the two files key by key, so without this a repository which sets a default registry inbunfig.tomland a scoped registry in.npmrcwould have its scoped packages looked up in the wrong registry, which is a regression compared to today$NPM_REGISTRY) are ignoredregistryUrls, logs or pull request bodies. Registry authentication stays withhostRules, and Bun's own.npmrcauth still works during lock file updates because Renovate writes the host rules into.npmrcbefore runningbun installContext
AI assistance disclosure
The original commits by @sebdanielsson were created with GitHub Copilot (Claude Opus 4.5). The rebase, the review fixes and the follow-up commits were made with Claude Code (Claude Opus 5), reviewed by @dennisameling before pushing.
Use of AI in replying to PR comments
Who answers review comments:
Documentation (please check one with an [x])
Added a
bunfig.tomlsection to the bun manager readme.How I've tested my work (please select one)
Besides the unit tests, I ran Renovate (
RENOVATE_PLATFORM=local) against a Bun workspace whosebunfig.tomland.npmrcpoint at local registries, and compared the requests Renovate makes with the requestsbun install(1.4.2) makes for the same repository. Both send the same package to the same registry in every case: default registry, scoped registry, workspace member,bunfig.tomlover.npmrcdefault, and.npmrcscope overbunfig.tomldefault.