Add npm as build dependency

This switches script/bootstrap to use a locally installed npm so that
the version of npm being used to bootstrap apm is now managed in
build/package.json instead of whatever version is installed globally on the
machine running script/bootstrap.

Closes #1770
This commit is contained in:
Kevin Sawicki 2014-03-19 08:41:08 -07:00
parent 6838ff8ea2
commit f912eb805d
2 changed files with 10 additions and 5 deletions

View File

@ -33,6 +33,7 @@
"runas": "0.5.x",
"underscore-plus": "1.x",
"unzip": "~0.1.9",
"vm-compatibility-layer": "~0.1.0"
"vm-compatibility-layer": "~0.1.0",
"npm": "~1.4.5"
}
}

View File

@ -27,15 +27,19 @@ if (!fs.existsSync(path.join(apmInstallPath, 'node_modules')))
var apmPath = 'apm/node_modules/atom-package-manager/bin/apm'
var apmFlags = process.env.JANKY_SHA1 || process.argv.indexOf('--no-color') !== -1 ? '--no-color' : '';
var npmPath = path.resolve(__dirname, '..', 'build', 'node_modules', '.bin', 'npm');
var npmFlags = ' --userconfig=' + path.resolve('.npmrc') + ' ';
var packagesToDedupe = ['fs-plus', 'humanize-plus', 'oniguruma', 'roaster', 'season'];
var npmCommand = 'npm --userconfig=' + path.resolve('.npmrc') + ' ';
var echoNewLine = process.platform == 'win32' ? 'echo.' : 'echo';
var commands = [
'git submodule --quiet sync',
'git submodule --quiet update --recursive --init',
{command: npmCommand + 'install --quiet', options: {cwd: path.resolve(__dirname, '..', 'build'), ignoreStdout: true}},
{command: npmCommand + 'install --quiet', options: {cwd: apmVendorPath, ignoreStdout: true}},
{command: npmCommand + 'install --quiet ' + apmVendorPath, options: {cwd: apmInstallPath, ignoreStdout: true}},
{command: 'npm' + npmFlags + 'install --quiet', options: {cwd: path.resolve(__dirname, '..', 'build'), ignoreStdout: true}},
{command: npmPath + npmFlags + 'install --quiet', options: {cwd: apmVendorPath, ignoreStdout: true}},
{command: npmPath + npmFlags + 'install --quiet ' + apmVendorPath, options: {cwd: apmInstallPath, ignoreStdout: true}},
echoNewLine,
apmPath + ' clean ' + apmFlags,
apmPath + ' install --quiet ' + apmFlags,