Use configured shell to update plugins (#447)

* Use configured shell to update plugins

* Make it more compatible

* Use shell-env@0.2.0
This commit is contained in:
Albin Ekblom 2016-07-30 20:51:09 +02:00 committed by Leo Lamprecht
parent e295e6f66e
commit 3198a90823
2 changed files with 10 additions and 6 deletions

View file

@ -18,7 +18,7 @@
"gaze": "1.1.0",
"mkdirp": "0.5.1",
"ms": "0.7.1",
"shell-env": "0.1.2",
"shell-env": "0.2.0",
"uuid": "2.0.2"
},
"eslintConfig": {

View file

@ -197,15 +197,19 @@ function toDependencies (plugins) {
}
function install (fn) {
shellEnv().then((env) => {
let registry = exports.getDecoratedConfig().npmRegistry;
if (registry) env.NPM_CONFIG_REGISTRY = registry;
const { shell: cfgShell, npmRegistry } = exports.getDecoratedConfig();
const shell = cfgShell && cfgShell !== '' ? cfgShell : undefined;
shellEnv(shell).then((env) => {
if (npmRegistry) env.NPM_CONFIG_REGISTRY = npmRegistry;
env.npm_config_runtime = 'electron';
env.npm_config_target = '1.3.0';
env.npm_config_disturl = 'https://atom.io/download/atom-shell';
exec('npm prune && npm install --production', {
exec('npm prune; npm install --production', {
cwd: path,
env: env
env,
shell
}, (err, stdout, stderr) => {
if (err) return fn(err);
fn(null);