Skip to content

Commit

Permalink
fix: automatically remove trailing slash if in registry uri
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanhleung committed Jan 23, 2018
1 parent 6ea2159 commit a57d4f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ To install from a custom registry, use the `--registry` option:

`install-peerdeps my-custom-package --registry https://registry.mycompany.com`.

If you're having problems, make sure that you don't have a trailing slash at the end of the registry URI (e.g. make sure you have `https://registry.mycompany.com` and NOT `https://registry.mycompany.com/`).

### Proxies
To use this tool with a proxy, set the `HTTPS_PROXY` environment variable (if you're using a custom registry and it is only accessible over HTTP, though, set the `HTTP_PROXY` environment variable).

Expand Down
9 changes: 9 additions & 0 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ if (program.dev && program.silent) {
process.exit(1);
}

if (program.registry) {
const { registry } = program;
// Check if last character in registry is a trailing slash
if (registry.substr(-1) === "/") {
// If the last character is a trailing slash, remove it
program.registry = registry.slice(0, -1);
}
}

// Define options object to pass to
// the installPeerDeps function
const options = {
Expand Down

0 comments on commit a57d4f5

Please sign in to comment.