bahmutov / bahmutov/next-update

Support for private npm registries

Open
#116 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
557
Forks
16
PR merge metrics
No merged PRs in 30d

Description

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](https://github.com/bahmutov/next-update/blob/master/src/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!

Contributor guide

No contributing guide indexed for this repository

Research direction

Read src/registry.js around line 182 to trace how the .npmrc registry URL is handled, then inspect MAX_CHECK_TIMEOUT around line 313. Determine how custom credentials, HTTPS URLs, and a configurable timeout should be represented. Done means private registries can be queried with those settings without editing the source.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.