diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js index ad14f3082d3..7b156212bec 100644 --- a/build/npm/postinstall.js +++ b/build/npm/postinstall.js @@ -4,13 +4,15 @@ *--------------------------------------------------------------------------------------------*/ const cp = require('child_process'); +const path = require('path'); const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm'; -function npmInstall(location) { - const result = cp.spawnSync(npm, ['install'], { - cwd: location , - stdio: 'inherit' - }); +function npmInstall(location, opts) { + opts = opts || {}; + opts.cwd = location; + opts.stdio = 'inherit'; + + const result = cp.spawnSync(npm, ['install'], opts); if (result.error || result.status !== 0) { process.exit(1); @@ -43,4 +45,17 @@ const extensions = [ extensions.forEach(extension => npmInstall(`extensions/${extension}`)); -npmInstall(`build`); // node modules required for build \ No newline at end of file +function npmInstallBuildDependencies() { + // make sure we install gulp watch for the system installed + // node, since that is the driver of gulp + const env = Object.assign({}, process.env); + + delete env['npm_config_disturl']; + delete env['npm_config_target']; + delete env['npm_config_runtime']; + + npmInstall(path.join(path.dirname(__dirname), 'lib', 'watch'), { env }); +} + +npmInstall(`build`); // node modules required for build +npmInstallBuildDependencies(); // node modules for watching, specific to host node version, not electron \ No newline at end of file diff --git a/build/npm/preinstall.js b/build/npm/preinstall.js index 987eeca8565..2bcbfb6e7d0 100644 --- a/build/npm/preinstall.js +++ b/build/npm/preinstall.js @@ -3,9 +3,6 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -const path = require('path'); -const cp = require('child_process'); - if (process.env['npm_config_disturl'] !== 'https://atom.io/download/electron') { console.error("You can't use plain npm to install Code's dependencies."); console.error( @@ -15,18 +12,4 @@ if (process.env['npm_config_disturl'] !== 'https://atom.io/download/electron') { ); process.exit(1); -} - -// make sure we install gulp watch for the system installed -// node, since that is the driver of gulp -const env = Object.assign({}, process.env); - -delete env['npm_config_disturl']; -delete env['npm_config_target']; -delete env['npm_config_runtime']; - -cp.spawnSync('npm', ['install'], { - cwd: path.join(path.dirname(__dirname), 'lib', 'watch'), - stdio: 'inherit', - env -}); \ No newline at end of file +} \ No newline at end of file