Skip to content

Commit 7033a5a

Browse files
authored
Merge pull request atom#23322 from atom/install-using-npm-in-script
Install using npm installed during installation of script dependencies
2 parents eb6258f + 309ecff commit 7033a5a

File tree

3 files changed

+3
-28
lines changed

3 files changed

+3
-28
lines changed

script/config.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
'use strict';
55

6-
const fs = require('fs');
76
const path = require('path');
87
const spawnSync = require('./lib/spawn-sync');
98

@@ -113,8 +112,6 @@ function getApmBinPath() {
113112
}
114113

115114
function getNpmBinPath(external = false) {
116-
if (process.env.NPM_BIN_PATH) return process.env.NPM_BIN_PATH;
117-
118115
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm';
119116
const localNpmBinPath = path.resolve(
120117
repositoryRootPath,
@@ -123,7 +120,5 @@ function getNpmBinPath(external = false) {
123120
'.bin',
124121
npmBinName
125122
);
126-
return !external && fs.existsSync(localNpmBinPath)
127-
? localNpmBinPath
128-
: npmBinName;
123+
return localNpmBinPath;
129124
}

script/lib/install-script-dependencies.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ process.env.ELECTRON_CUSTOM_VERSION = CONFIG.appMetadata.electronVersion;
99

1010
module.exports = function(ci) {
1111
console.log('Installing script dependencies');
12+
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm';
1213
childProcess.execFileSync(
13-
CONFIG.getNpmBinPath(ci),
14+
npmBinName,
1415
['--loglevel=error', ci ? 'ci' : 'install'],
1516
{ env: process.env, cwd: CONFIG.scriptRootPath }
1617
);

script/lib/verify-machine-requirements.js

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33
const childProcess = require('child_process');
44
const path = require('path');
55

6-
const CONFIG = require('../config');
7-
86
module.exports = function(ci) {
97
verifyNode();
10-
verifyNpm(ci);
118
verifyPython();
129
};
1310

@@ -24,24 +21,6 @@ function verifyNode() {
2421
}
2522
}
2623

27-
function verifyNpm(ci) {
28-
const stdout = childProcess.execFileSync(
29-
CONFIG.getNpmBinPath(ci),
30-
['--version'],
31-
{ env: process.env }
32-
);
33-
const fullVersion = stdout.toString().trim();
34-
const majorVersion = fullVersion.split('.')[0];
35-
const oldestMajorVersionSupported = ci ? 6 : 3;
36-
if (majorVersion >= oldestMajorVersionSupported) {
37-
console.log(`Npm:\tv${fullVersion}`);
38-
} else {
39-
throw new Error(
40-
`npm v${oldestMajorVersionSupported}+ is required to build Atom. npm v${fullVersion} was detected.`
41-
);
42-
}
43-
}
44-
4524
function verifyPython() {
4625
// This function essentially re-implements node-gyp's "find-python.js" library,
4726
// but in a synchronous, bootstrap-script-friendly way.

0 commit comments

Comments
 (0)