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

Support for private npm registries #116

Open
xpure-sklatt opened this issue Nov 2, 2017 · 2 comments
Open

Support for private npm registries #116

xpure-sklatt opened this issue Nov 2, 2017 · 2 comments

Comments

@xpure-sklatt
Copy link
Contributor

Hi,
we're using a private npm registry where authentication is required and we're struggling by fetching the version info from there.

At the moment it seems like next-update is using the .npmrc file to get the registry url, so I tried to put user and password into the url, like: https://user:pass@my-custom-registry.com within my .npmrc file, but that still resulted in a timeout. Problem here is that https is always replaced by http, which is not supported by our registry.

I finally fixed it by editing your registry.js file (line 182):

// replaced this:
// npmUrl = npmUrl.replace(/^https:/, 'http:').trim()
// var url = npmUrl + escapeName(name)

// with this:
var user = encodeURIComponent('me@foo.bar');
var pass = encodeURIComponent('123abc?');
var registryBase = 'my-custom-registry.com/api/npm/';
var url = 'https://' + user + ':' + pass + '@' + registryBase + escapeName(name);

I also needed to increase the MAX_CHECK_TIMEOUT on line 313.

Is there a chance to implement a way of configuring a custom registry with custom credentials, https support and custom timeout value? We'd really love to use next-update in our project! It's a great tool!

xpure-sklatt added a commit to xpure-sklatt/next-update that referenced this issue Nov 3, 2017
@xpure-sklatt
Copy link
Contributor Author

I forked next-update and implemented a solution that would work for our needs:
https://github.com/xpure-sklatt/next-update

It provides two additional parameters:

  • --registry where you can define a custom registry url that is used for fetching the versions
  • --check-version-timeout that lets you define a custom timeout for fetching versions

We are then running next-update like this:
next-update --check-version-timeout 100000 --registry https://me%40foo.bar:123abc%3F@my-custom-registry.com/api/npm/

xpure-sklatt added a commit to xpure-sklatt/next-update that referenced this issue Nov 3, 2017
xpure-sklatt added a commit to xpure-sklatt/next-update that referenced this issue Nov 6, 2017
xpure-sklatt added a commit to xpure-sklatt/next-update that referenced this issue Nov 6, 2017
bahmutov pushed a commit that referenced this issue Nov 6, 2017
* feat(registry): provide new option '--registry' to set a custom registry url #116

* feat(registry): fix passing options correctly into fetchVersions #116

* feat(check-version-timeout): define custom timeout for version check #116

* feat(registry/check-version-timeout): clean up code #116

* feat(registry/check-version-timeout): reset version to 0.0.0 #116
@Nxt3
Copy link

Nxt3 commented Jul 24, 2018

So our registry doesn't need authentication. I run the command like so:

next-update --registry=http://mycustomregistry.com

and still get:

npm ERR! This request requires auth credentials. Run npm login and repeat the request.

But I have no need for auth. Am I doing something wrong?

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

No branches or pull requests

2 participants