mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-15 21:28:40 -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",
|
"gaze": "1.1.0",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"ms": "0.7.1",
|
"ms": "0.7.1",
|
||||||
|
"shell-env": "0.1.2",
|
||||||
"uid2": "0.0.3"
|
"uid2": "0.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
17
plugins.js
17
plugins.js
|
|
@ -8,6 +8,7 @@ const { exec } = require('child_process');
|
||||||
const Config = require('electron-config');
|
const Config = require('electron-config');
|
||||||
const ms = require('ms');
|
const ms = require('ms');
|
||||||
const notify = require('./notify');
|
const notify = require('./notify');
|
||||||
|
const shellEnv = require('shell-env');
|
||||||
|
|
||||||
// local storage
|
// local storage
|
||||||
const cache = new Config();
|
const cache = new Config();
|
||||||
|
|
@ -189,13 +190,15 @@ function toDependencies (plugins) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function install (fn) {
|
function install (fn) {
|
||||||
const prefix = 'darwin' === process.platform ? 'eval `/usr/libexec/path_helper -s` && ' : '';
|
shellEnv().then((env) => {
|
||||||
exec(prefix + 'npm prune && npm install --production', {
|
exec('npm prune && npm install --production', {
|
||||||
cwd: path
|
cwd: path,
|
||||||
}, (err, stdout, stderr) => {
|
env: env
|
||||||
if (err) return fn(err);
|
}, (err, stdout, stderr) => {
|
||||||
fn(null);
|
if (err) return fn(err);
|
||||||
});
|
fn(null);
|
||||||
|
});
|
||||||
|
}).catch(fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.subscribe = function (fn) {
|
exports.subscribe = function (fn) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue