From 3ad2f2200298a675e07e62f4e66a324f0a306d38 Mon Sep 17 00:00:00 2001 From: Rupesh Date: Tue, 24 Jul 2018 08:40:47 +0100 Subject: [PATCH] Add option to support custom npm registry url --- updates.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/updates.js b/updates.js index 94ffa64..1733e68 100755 --- a/updates.js +++ b/updates.js @@ -12,6 +12,12 @@ const args = require("minimist")(process.argv.slice(2), { "update", "u", "version", "v", ], + string: [ + "registry", "r", + ], + default: { + "registry": "https://registry.npmjs.org/", + }, alias: { c: "color", e: "exclude", @@ -21,6 +27,7 @@ const args = require("minimist")(process.argv.slice(2), { j: "json", n: "no-color", p: "prerelease", + r: "registry", u: "update", v: "version", }, @@ -38,6 +45,7 @@ if (args.help) { -e, --exclude Exclude given packages -c, --color Force-enable color output -n, --no-color Disable color output + -r, --registry Set a custom NPM registry url -v, --version Print the version -h, --help Print this help @@ -65,7 +73,7 @@ const columnify = require("columnify"); const chalk = require("chalk"); const esc = require("escape-string-regexp"); -const url = "https://registry.npmjs.org/"; +const url = args.registry.endsWith("/") ? args.registry : args.registry + "/"; const packageFile = path.join(process.cwd(), "package.json"); const versionPartRe = /^[0-9a-zA-Z-.]+$/;