wmr
wmr copied to clipboard
Make npm registry url configurable
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.
@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.
@marvinhagemeister @developit I would love to do this change, I can see three idea's
- getting it from cli-flag.
- keeping .npmrc file and reading from it.
- Making an entry in package.json.
Shall we support all three ideas ?.
@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.
Hey folks! I'm running into this same issue and would be interesting in getting this into wmr. Has there been any more progress on https://github.com/preactjs/wmr/issues/151 that is blocking this from being implemented now?
Also, specific to my use case is that this project lives as a workspace within a mono-repo. This particular module being requested is present on disk and I have a hunch that it might be easier to resolve in the fs in these cases. Maybe mono-repo support is a whole separate discussion?