aboutsummaryrefslogtreecommitdiffstats
path: root/packages/monorepo-scripts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-24 01:09:24 +0800
committerFabio Berger <me@fabioberger.com>2018-07-24 01:09:24 +0800
commitbddcebfbb1ca81199f273b6571ace0da14cf105a (patch)
tree2db7011329db645e89376eb5cbf67a4068773ec1 /packages/monorepo-scripts
parenta05b14e4d9659be1cc495ee33fd8962ce773f87f (diff)
downloaddexon-0x-contracts-bddcebfbb1ca81199f273b6571ace0da14cf105a.tar.gz
dexon-0x-contracts-bddcebfbb1ca81199f273b6571ace0da14cf105a.tar.zst
dexon-0x-contracts-bddcebfbb1ca81199f273b6571ace0da14cf105a.zip
Allow registry to be configured in lerna.json
Diffstat (limited to 'packages/monorepo-scripts')
-rw-r--r--packages/monorepo-scripts/src/prepublish_checks.ts2
-rw-r--r--packages/monorepo-scripts/src/publish.ts3
-rw-r--r--packages/monorepo-scripts/src/utils/npm_utils.ts6
3 files changed, 6 insertions, 5 deletions
diff --git a/packages/monorepo-scripts/src/prepublish_checks.ts b/packages/monorepo-scripts/src/prepublish_checks.ts
index 431e848ca..683c26094 100644
--- a/packages/monorepo-scripts/src/prepublish_checks.ts
+++ b/packages/monorepo-scripts/src/prepublish_checks.ts
@@ -50,7 +50,7 @@ async function checkGitTagsForNextVersionAndDeleteIfExistAsync(updatedPublicPack
async function checkCurrentVersionMatchesLatestPublishedNPMPackageAsync(
updatedPublicPackages: Package[],
): Promise<void> {
- utils.log('Check package versions against npmjs.org...');
+ utils.log('Check package versions against npm registry...');
const versionMismatches = [];
for (const pkg of updatedPublicPackages) {
const packageName = pkg.packageJson.name;
diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts
index c44e1f85e..53492e012 100644
--- a/packages/monorepo-scripts/src/publish.ts
+++ b/packages/monorepo-scripts/src/publish.ts
@@ -172,8 +172,7 @@ async function updateChangeLogsAsync(updatedPublicPackages: Package[]): Promise<
async function lernaPublishAsync(packageToVersionChange: { [name: string]: string }): Promise<void> {
// HACK: Lerna publish does not provide a way to specify multiple package versions via
// flags so instead we need to interact with their interactive prompt interface.
- const PACKAGE_REGISTRY = 'https://registry.npmjs.org/';
- const child = spawn('lerna', ['publish', `--registry=${PACKAGE_REGISTRY}`], {
+ const child = spawn('lerna', ['publish'], {
cwd: constants.monorepoRootPath,
});
let shouldPrintOutput = false;
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;