mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-09 13:15:37 +03:00
Merge pull request #23322 from atom/install-using-npm-in-script
Install using npm installed during installation of script dependencies
This commit is contained in:
commit
7033a5a22f
@ -3,7 +3,6 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const spawnSync = require('./lib/spawn-sync');
|
||||
|
||||
@ -113,8 +112,6 @@ function getApmBinPath() {
|
||||
}
|
||||
|
||||
function getNpmBinPath(external = false) {
|
||||
if (process.env.NPM_BIN_PATH) return process.env.NPM_BIN_PATH;
|
||||
|
||||
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
const localNpmBinPath = path.resolve(
|
||||
repositoryRootPath,
|
||||
@ -123,7 +120,5 @@ function getNpmBinPath(external = false) {
|
||||
'.bin',
|
||||
npmBinName
|
||||
);
|
||||
return !external && fs.existsSync(localNpmBinPath)
|
||||
? localNpmBinPath
|
||||
: npmBinName;
|
||||
return localNpmBinPath;
|
||||
}
|
||||
|
@ -9,8 +9,9 @@ process.env.ELECTRON_CUSTOM_VERSION = CONFIG.appMetadata.electronVersion;
|
||||
|
||||
module.exports = function(ci) {
|
||||
console.log('Installing script dependencies');
|
||||
const npmBinName = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
childProcess.execFileSync(
|
||||
CONFIG.getNpmBinPath(ci),
|
||||
npmBinName,
|
||||
['--loglevel=error', ci ? 'ci' : 'install'],
|
||||
{ env: process.env, cwd: CONFIG.scriptRootPath }
|
||||
);
|
||||
|
@ -3,11 +3,8 @@
|
||||
const childProcess = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
const CONFIG = require('../config');
|
||||
|
||||
module.exports = function(ci) {
|
||||
verifyNode();
|
||||
verifyNpm(ci);
|
||||
verifyPython();
|
||||
};
|
||||
|
||||
@ -24,24 +21,6 @@ function verifyNode() {
|
||||
}
|
||||
}
|
||||
|
||||
function verifyNpm(ci) {
|
||||
const stdout = childProcess.execFileSync(
|
||||
CONFIG.getNpmBinPath(ci),
|
||||
['--version'],
|
||||
{ env: process.env }
|
||||
);
|
||||
const fullVersion = stdout.toString().trim();
|
||||
const majorVersion = fullVersion.split('.')[0];
|
||||
const oldestMajorVersionSupported = ci ? 6 : 3;
|
||||
if (majorVersion >= oldestMajorVersionSupported) {
|
||||
console.log(`Npm:\tv${fullVersion}`);
|
||||
} else {
|
||||
throw new Error(
|
||||
`npm v${oldestMajorVersionSupported}+ is required to build Atom. npm v${fullVersion} was detected.`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function verifyPython() {
|
||||
// This function essentially re-implements node-gyp's "find-python.js" library,
|
||||
// but in a synchronous, bootstrap-script-friendly way.
|
||||
|
Loading…
Reference in New Issue
Block a user