From 82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Apr 2017 03:09:25 +0200 Subject: Reorganize module loading. We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node. --- node_modules/global-prefix/index.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'node_modules/global-prefix/index.js') diff --git a/node_modules/global-prefix/index.js b/node_modules/global-prefix/index.js index 591f6be8b..fa19422ff 100644 --- a/node_modules/global-prefix/index.js +++ b/node_modules/global-prefix/index.js @@ -7,10 +7,10 @@ 'use strict'; -var fs = require('fs') +var homedir = require('homedir-polyfill'); var path = require('path'); -var osenv = require('osenv'); var ini = require('ini'); +var fs = require('fs') var prefix; @@ -18,8 +18,12 @@ if (process.env.PREFIX) { prefix = process.env.PREFIX; } else { // Start by checking if the global prefix is set by the user - var userConfig = path.resolve(osenv.home(), '.npmrc'); - prefix = readPrefix(userConfig); + var home = homedir(); + if (home) { + // homedir() returns undefined if $HOME not set; path.resolve requires strings + var userConfig = path.resolve(home, '.npmrc'); + prefix = readPrefix(userConfig); + } if (!prefix) { // Otherwise find the path of npm @@ -60,10 +64,10 @@ function fallback() { function npmPath() { try { - return fs.realpathSync(require('which').sync('npm')) + return fs.realpathSync(require('which').sync('npm')); } catch (ex) { } - return false + return false; } function readPrefix(configPath) { -- cgit v1.2.3