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

Add external registry support to authentication check #365

Merged
merged 4 commits into from
Mar 15, 2019

Conversation

privatenumber
Copy link
Sponsor Contributor

@privatenumber privatenumber commented Mar 11, 2019

Fixes #361

@itaisteinherz
Copy link
Collaborator

Please fix the linting errors (usually can be done automatically by running npx xo --fix).

@itaisteinherz itaisteinherz changed the title Added registry support to login check Add external registry support to authentication check Mar 11, 2019
@sindresorhus
Copy link
Owner

Why do we have to pass --registry explicitly to npm whoami? Seems like npm should pick that up itself.

@privatenumber
Copy link
Sponsor Contributor Author

@sindresorhus
I wish it would but that's not the case, and unfortunately thewhoami doc doesn't document this behavior very well.

I dug through the source code to determine that whoami gets the default registry from the .npmrc file (aka npm config get registry). The registry defined in .npmrc is the registry where npm install pulls from.

For the purpose of publishing, the relevant registry is in package.json:publishConfig.registry. This is why we have to explicitly pass it in.

In my use-case, I have a private company-project that uses the official npm registry to install dependencies from, but we publish to an internal registry for others at the company to install our project from.

@sindresorhus
Copy link
Owner

Alright. Thanks for explaining.

@sindresorhus sindresorhus merged commit 72ebf7d into sindresorhus:master Mar 15, 2019
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.

None yet

3 participants