Repository navigation
fix(hub): support npm registry proxies in devcontainers - #24
Merged
Merged
Conversation
Allow a credential-free registry URL for CLI installation and container setup, then save it in the container user's npm settings. Disable unused pnpm installation without changing locked dependencies or default registry behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: bd1d4a40-2eb6-4e35-9c28-55affc9e5e96
There was a problem hiding this comment.
🔵 Needs a closer look
Subsequent commands do not reuse the proxy-built CLI image, breaking the documented workflow on proxy-only networks.
No open issues 🎉
What changed in this PR
Adds opt-in npm registry proxy support to Hub’s devcontainer setup.
Changes:
- Configure the registry for CLI installation and initial container dependencies.
- Persist the container’s npm registry setting and document its removal.
- Disable unused pnpm installation and expand wrapper tests.
| File | Description |
|---|---|
hub/test/bin/devcontainer_test.rb |
Test proxy options, validation, and command forwarding. |
hub/docs/development.md |
Document proxy setup, persistence, and cleanup. |
hub/bin/devcontainer |
Parse and apply the proxy option. |
hub/.devcontainer/devcontainer.json |
Disable optional pnpm installation. |
hub/.devcontainer/cli.Dockerfile |
Accept a registry argument for CLI installation. |
Review effort: Max
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.
Why
Contributors on networks that require an npm registry proxy need the devcontainer setup to use that registry from the start. Configuring npm only after startup is too late: installing the devcontainer CLI or the initial project dependencies can already fail. This change provides an explicit, portable way to choose a registry without embedding a particular network's settings or downgrading dependencies to match its package availability.
What changes
Add an opt-in
--use-npm-proxy URLoption to the devcontainer wrapper's startup commands. It accepts a credential-free HTTP(S) registry URL, uses the standardNPM_CONFIG_REGISTRYsetting for CLI installation and initial dependency setup, then saves the registry in the container user's npm settings for later commands. It can also update an existing container without rebuilding or removing it. The development guide documents usage and how to remove the saved override.Disable the Node feature's unused optional pnpm installation because Hub uses npm. Without the proxy option, registry behavior stays unchanged. Host npm settings, repository npm configuration, lockfiles, TLS verification, and the production image are untouched. This PR contains no dependency downgrades or Manage prototypes latency changes.
End-to-end provisioning of a fresh devcontainer with a proxy remains unverified.