fix: respect npm_config_registry for update checks#1961
fix: respect npm_config_registry for update checks#1961Will-hxw wants to merge 2 commits intoChromeDevTools:mainfrom
Conversation
Use the npm_config_registry env var (set by npm when invoked via npx with custom registry config) instead of hardcoding registry.npmjs.org. Falls back to the default public registry when the env var is not set. Fixes #1943
|
Hi @coty @precision , sorry to bother you. This PR has been open for a while, so I wanted to kindly check whether you might have time to review it or let me know if any changes are needed.I’m happy to make adjustments if required. Thanks! |
|
Thanks! As discussed in here, this does not solve the case where the DevTools CLI is called directly. @mathiasbynens WDYT? Should the suggestion from here be added? |
Yeah, if we need to support this then let’s do it properly and support all use cases, not just those through The “proper” way to do it would be to use |
|
Thanks for the suggestion. Adding @npmcli/config as a dependency would indeed handle all cases properly, but you're right that it introduces a new dependency. Given the PR is already behind and this would be a meaningful scope expansion, I think it makes sense to treat this as a follow-up PR rather than growing this one further. Would you be okay with merging the current fix as-is (for the npx/npm case) and addressing the direct-CLI case in a separate PR with the proper implementation? |
|
@wolfib Thanks for the follow-up! The plan is to merge the current fix for the npx/npm case, then address the direct-CLI scenario in a follow-up with the proper |
Instead of only checking npm_config_registry env var (which is only set when invoked via npx/npm), now uses `npm config get registry` to read .npmrc regardless of how the CLI was started. This addresses the maintainer's feedback that the original solution did not work when DevTools CLI is called directly.
52701f5 to
5462a96
Compare
Summary
Use
npm_config_registryenvironment variable for npm registry URL in update checks, instead of hardcodingregistry.npmjs.org.Fix
check-latest-version.tsnow respects the user's npm registry configuration. This helps users behind corporate proxies or using private registries (e.g., JFrog Artifactory).When
npm_config_registryis not set, falls back to the default public registry.Validation
npm run buildpassesnpm testpassesFixes #1943