support npm proxy configuration for the installation script (#692)

This patch starts supporting NPM proxy configuration in the installation script.
If both NPM proxy and environment proxy are set, NPM proxy settings are preferred.

Fixes #648
This commit is contained in:
Andrey Lushnikov 2017-09-08 23:37:22 -07:00 committed by GitHub
parent 8d2a427eee
commit b8bb80a089

View File

@ -29,6 +29,14 @@ const revisionInfo = Downloader.revisionInfo(platform, revision);
if (revisionInfo.downloaded)
return;
// Override current environment proxy settings with npm configuration, if any.
const NPM_HTTPS_PROXY = process.env.npm_config_https_proxy || process.env.npm_config_proxy;
const NPM_HTTP_PROXY = process.env.npm_config_http_proxy || process.env.npm_config_proxy;
if (NPM_HTTPS_PROXY)
process.env.HTTPS_PROXY = NPM_HTTPS_PROXY;
if (NPM_HTTP_PROXY)
process.env.HTTP_PROXY = NPM_HTTP_PROXY;
const allRevisions = Downloader.downloadedRevisions();
Downloader.downloadRevision(platform, revision, onProgress)
.then(onSuccess)