mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-12 20:18:41 -09:00
plugins: use user env vars for npm install (#172)
This commit is contained in:
parent
3d7f6fa060
commit
1e1b31aad8
2 changed files with 11 additions and 7 deletions
|
|
@ -14,6 +14,7 @@
|
|||
"gaze": "1.1.0",
|
||||
"mkdirp": "0.5.1",
|
||||
"ms": "0.7.1",
|
||||
"shell-env": "0.1.2",
|
||||
"uid2": "0.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
17
plugins.js
17
plugins.js
|
|
@ -8,6 +8,7 @@ const { exec } = require('child_process');
|
|||
const Config = require('electron-config');
|
||||
const ms = require('ms');
|
||||
const notify = require('./notify');
|
||||
const shellEnv = require('shell-env');
|
||||
|
||||
// local storage
|
||||
const cache = new Config();
|
||||
|
|
@ -189,13 +190,15 @@ function toDependencies (plugins) {
|
|||
}
|
||||
|
||||
function install (fn) {
|
||||
const prefix = 'darwin' === process.platform ? 'eval `/usr/libexec/path_helper -s` && ' : '';
|
||||
exec(prefix + 'npm prune && npm install --production', {
|
||||
cwd: path
|
||||
}, (err, stdout, stderr) => {
|
||||
if (err) return fn(err);
|
||||
fn(null);
|
||||
});
|
||||
shellEnv().then((env) => {
|
||||
exec('npm prune && npm install --production', {
|
||||
cwd: path,
|
||||
env: env
|
||||
}, (err, stdout, stderr) => {
|
||||
if (err) return fn(err);
|
||||
fn(null);
|
||||
});
|
||||
}).catch(fn);
|
||||
}
|
||||
|
||||
exports.subscribe = function (fn) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue