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

Make npm registry url configurable #167

Open
marvinhagemeister opened this issue Oct 20, 2020 · 3 comments
Open

Make npm registry url configurable #167

marvinhagemeister opened this issue Oct 20, 2020 · 3 comments

Comments

@marvinhagemeister
Copy link
Member

@marvinhagemeister marvinhagemeister commented Oct 20, 2020

Just came across one of our client projects, which uses their own npm registry instead of the official one. By making it configurable via cli-flag like --registry https://my-registry.com we could support that use case.

I'm wondering if this is how we can make our npm plugin testable too! We could spin up a fake registry since we only ever download the tarball and use the --registry flag in our tests to point to our mocked server.

@developit
Copy link
Member

@developit developit commented Oct 20, 2020

@marvinhagemeister I wonder if we could check for an npmrc file at $cwd/.npmrc and pull the registry from there? Maybe in addition to the flag or something. Or we could even allow setting "registry":"..." in the package.json... so many options.

@pajaydev
Copy link

@pajaydev pajaydev commented Dec 2, 2020

@marvinhagemeister @developit I would love to do this change, I can see three idea's

  1. getting it from cli-flag.
  2. keeping .npmrc file and reading from it.
  3. Making an entry in package.json.

Shall we support all three ideas ?.

@developit
Copy link
Member

@developit developit commented Dec 3, 2020

@pajaydev I'm not sure about a CLI flag, since folks would need to pass it everywhere they run WMR.

I actually am thinking maybe as a start we could just check for process.env.NPM_CONFIG_REGISTRY? It's only defined when the script is run from npm, but that's most cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.