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

Specify a local npm registry to be used with npmgraph #19

Open
blured75 opened this issue May 25, 2020 · 5 comments
Open

Specify a local npm registry to be used with npmgraph #19

blured75 opened this issue May 25, 2020 · 5 comments

Comments

@blured75
Copy link

Hi,
Thanks a lot for your awesome work !
Is it possible to specify a local npm server like verdaccio to be used with npm graph ?
Regards,
Blured.

@robross0606
Copy link

I have the same or similar question. The running instance seems to ignore my npmrc settings which define a scoped private repository. Is there a way to configure a running instance to use something other than the global public repo?

@broofa
Copy link
Collaborator

broofa commented Jun 2, 2021

Briefly, no, this isn't something that has been designed for, but it's probably doable.

The main issues, off the top of my head:

  1. Make the repository host configurable. (currently uses registry.npmjs.cf) Probably not a big deal. Add a UI to the "ⓘ" tab for this, store in localStorage, etc.
  2. Make secondary hosts configurable. E.g. npmjs.com for links to module info
  3. Figure out how to whitelist private hosts in the Content-Security-Policy.
  4. Handle private modules not being available in services like npms.io and bundlephobia.com

Re: #1, as long as the private repository is reachable directly by the client this could be configured on the client on a per-user basis (my initial thought). So this could potentially work on npmgraph.js.org without having to run a private server. The other approach would be to make this (for example) a .env setting that gets injected by Parcel. This might be more suitable for an enterprise environment where this is hosted on some internal server.

@robross0606
Copy link

robross0606 commented Jun 3, 2021

@broofa npm already has a mechanism for doing this via npmrc environment. The trickiest part here is that internal repositories may be configured specifically for one or more "scoped" packages, while all others are still sourced from the public repo. Reproducing this flexibility using other mechanisms like UI or .env seems like it would be difficult. Would it be possible to have an .npmrc deployed on the server and use that somehow? I already see one in project source. Is that already referenced in the same ways it is for regular npm usage?

@broofa
Copy link
Collaborator

broofa commented Jun 3, 2021

Reproducing this flexibility using other mechanisms like UI or .env seems like it would be difficult.

Fair enough. Using this project's .npmrc file is likely to end up being problematic, however, as it's purpose is to provide configuration specific to _this project. So maybe have a command-line flag or env var for specifying a path to whatever .npmrc file the user has for their environment...?

@broofa
Copy link
Collaborator

broofa commented Jan 18, 2024

Quick update for @EmmetBeachBum (et al)...

I've never used a private registry, so this feature isn't high on my personal list of needs/wants for this project. I'd be open to a PR that added support, however. ('Would have to include instructions for setting up a local Verdaccio repo so I could test, though.)

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

No branches or pull requests

3 participants