Don't use the npm binary you're about to delete

This commit is contained in:
Ash Wilson 2018-08-07 16:56:05 -04:00
parent d0811b82ed
commit 347da770dc
No known key found for this signature in database
GPG Key ID: 81B1DDB704F69D2A

View File

@ -76,8 +76,8 @@ function getApmBinPath () {
return path.join(apmRootPath, 'node_modules', 'atom-package-manager', 'bin', apmBinName)
}
function getNpmBinPath () {
function getNpmBinPath (external = false) {
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm'
const localNpmBinPath = path.resolve(repositoryRootPath, 'script', 'node_modules', '.bin', npmBinName)
return fs.existsSync(localNpmBinPath) ? localNpmBinPath : npmBinName
return !external && fs.existsSync(localNpmBinPath) ? localNpmBinPath : npmBinName
}