mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
### What does this PR do? This PR implements support for the `email` field in `.npmrc` files for registry scope authentication. Some private registries (particularly Nexus) require the email field to be specified in the registry configuration alongside username/password or token authentication. The email field can now be specified in `.npmrc` files like: ```ini //registry.example.com/:email=user@example.com //registry.example.com/:username=myuser //registry.example.com/:_password=base64encodedpassword ``` ### How did you verify your code works? 1. **Built Bun successfully** - Confirmed the code compiles without errors using `bun bd --debug` 2. **Wrote comprehensive unit tests** - Added two test cases to `test/cli/install/npmrc.test.ts`: - Test for standalone email field parsing - Test for email combined with username/password authentication 3. **Verified tests pass** - Ran `bun bd test test/cli/install/npmrc.test.ts -t "email"` and confirmed both tests pass: ``` ✓ 2 pass ✓ 0 fail ✓ 6 expect() calls ``` 4. **Code changes include**: - Added `email` field to `NpmRegistry` struct in `src/api/schema.zig` - Updated `encode()` and `decode()` methods to handle the email field - Modified `ini.zig` to parse and store the email field from `.npmrc` - Removed email from the unsupported options warning (certfile and keyfile remain unsupported) - Updated all `NpmRegistry` struct initializations to include the email field - Updated `loadNpmrcFromJS` test API to return the email field 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Bot <claude-bot@bun.sh> Co-authored-by: Claude <noreply@anthropic.com>
14 KiB
14 KiB