Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add options for offline mode * add option for a custom download directory
- Loading branch information
Showing
3 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"use strict"; | ||
|
||
function getNpmConfig() { | ||
let npmOptions = {}; | ||
let npmConfigPrefix = 'npm_config_' | ||
Object.keys(process.env).forEach(function (name) { | ||
if (name.indexOf(npmConfigPrefix) !== 0) { | ||
return | ||
} | ||
let value = process.env[name] | ||
name = name.substring(npmConfigPrefix.length) | ||
if (name) { | ||
npmOptions[name] = value | ||
} | ||
}, this) | ||
|
||
return npmOptions; | ||
} | ||
|
||
module.exports = function (log) { | ||
log.verbose("CFG", "Looking for NPM config."); | ||
let options = getNpmConfig(); | ||
|
||
if (options) { | ||
log.silly("CFG", "NPM options:", options); | ||
}else { | ||
log.verbose("CFG", "There are no NPM options available."); | ||
} | ||
|
||
return options; | ||
}; |