-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
026deea
commit 476c617
Showing
13 changed files
with
574 additions
and
275 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 |
---|---|---|
@@ -1,6 +1,12 @@ | ||
'use strict'; | ||
const config = require('./lib/config')(process.argv); | ||
Object.keys(config).forEach(key => { | ||
process.env['npm_config_' + key] = config[key]; | ||
const config = require('./lib/config')(process.argv.slice(2)); | ||
|
||
Object.keys(config.npmrc).forEach(key => { | ||
config.env['npm_config_' + key.replace(/-/g, '_')] = config.npmrc[key]; | ||
}); | ||
console.log(process.env); | ||
|
||
Object.assign(process.env, config.env, process.env); | ||
|
||
if (process.mainModule === module) { | ||
console.log(process.env); | ||
} |
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 |
---|---|---|
@@ -1,8 +1,6 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
const npmrc = require('./npmrc'); | ||
const env = require('./env'); | ||
const update = require('./update'); | ||
const path = require('path'); | ||
|
||
npmrc(process.argv, path.join(process.cwd(), '.npmrc')).catch(console.error); | ||
env(process.argv).catch(console.error); | ||
update(process.argv.slice(2), path.resolve('.npmrc')); |
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 |
---|---|---|
@@ -1,24 +1,20 @@ | ||
'use strict'; | ||
const npmrc = require('./npmrc'); | ||
const env = require('./env'); | ||
const update = require('./update'); | ||
const path = require('path'); | ||
const os = require('os'); | ||
|
||
var argv; | ||
let argv; | ||
try { | ||
argv = JSON.parse(process.env.npm_config_argv).original; | ||
} catch (ex) { | ||
argv = process.argv; | ||
argv = process.argv.slice(2); | ||
} | ||
|
||
npmrc(argv, process.env.npm_config_userconfig || path.join(os.homedir(), '.npmrc')).catch(e => { | ||
if (e.code === 'EACCES' || /\bpermissions?\b/i.test(e.message)) { | ||
console.error(e.message); | ||
console.error('Please try running this command again as root/Administrator.'); | ||
} else { | ||
console.error(e); | ||
} | ||
process.exitCode = 1; | ||
}); | ||
let configFile = process.env.npm_config_userconfig; | ||
if (configFile) { | ||
configFile = path.resolve(configFile); | ||
} else { | ||
configFile = path.join(os.homedir(), '.npmrc'); | ||
} | ||
|
||
env(); | ||
module.exports = update(argv, configFile); |
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
Oops, something went wrong.