mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
plugins: detect location of npm
This commit is contained in:
parent
edc201ea03
commit
3eb50ca946
1 changed files with 14 additions and 12 deletions
26
plugins.js
26
plugins.js
|
|
@ -166,22 +166,24 @@ function toDependencies (plugins) {
|
|||
}
|
||||
|
||||
function install (fn) {
|
||||
exec('npm prune && npm install --production', {
|
||||
cwd: path
|
||||
}, (err, stdout, stderr) => {
|
||||
which('npm', (err, bin) => {
|
||||
if (err) {
|
||||
if (/(command not found|not recognized as an)/.test(err.stack)) {
|
||||
if (plugins.plugins.length) {
|
||||
alert('We found `plugins` in `.hyperterm.js`, but `npm` is ' +
|
||||
'not installed or not in $PATH!\nPlease head to ' +
|
||||
'https://nodejs.org and install the Node.js runtime.');
|
||||
} else {
|
||||
console.log('npm not found, but no plugins defined');
|
||||
}
|
||||
if (plugins.plugins.length) {
|
||||
alert('We found `plugins` in `.hyperterm.js`, but `npm` is ' +
|
||||
'not installed or not in $PATH!\nPlease head to ' +
|
||||
'https://nodejs.org and install the Node.js runtime.');
|
||||
} else {
|
||||
console.log('npm not found, but no plugins defined');
|
||||
}
|
||||
return fn(err);
|
||||
}
|
||||
fn(null);
|
||||
|
||||
exec(`${bin} prune && ${bin} install --production`, {
|
||||
cwd: path
|
||||
}, (err, stdout, stderr) => {
|
||||
if (err) return fn(err);
|
||||
fn(null);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue