From bddcebfbb1ca81199f273b6571ace0da14cf105a Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 23 Jul 2018 19:09:24 +0200 Subject: Allow registry to be configured in lerna.json --- packages/monorepo-scripts/src/utils/npm_utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/monorepo-scripts/src/utils') diff --git a/packages/monorepo-scripts/src/utils/npm_utils.ts b/packages/monorepo-scripts/src/utils/npm_utils.ts index cc1e046e7..7c8310459 100644 --- a/packages/monorepo-scripts/src/utils/npm_utils.ts +++ b/packages/monorepo-scripts/src/utils/npm_utils.ts @@ -1,9 +1,11 @@ +import * as fs from 'fs'; import 'isomorphic-fetch'; import * as _ from 'lodash'; import { PackageRegistryJson } from '../types'; -const NPM_REGISTRY_BASE_URL = 'https://registry.npmjs.org'; +const lernaJson = JSON.parse(fs.readFileSync('lerna.json').toString()); +const NPM_REGISTRY_BASE_URL = lernaJson.registry; const SUCCESS_STATUS = 200; const NOT_FOUND_STATUS = 404; @@ -15,7 +17,7 @@ export const npmUtils = { if (response.status === NOT_FOUND_STATUS) { return undefined; } else if (response.status !== SUCCESS_STATUS) { - throw new Error(`Request to ${url} failed. Check your internet connection and that npmjs.org is up.`); + throw new Error(`Request to ${url} failed. Check your internet connection and that npm registry is up.`); } const packageRegistryJson = await response.json(); return packageRegistryJson; -- cgit v1.2.3