Skip to content

Commit

Permalink
Allow NPM config variables. Resolve #1711
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcus Zanona committed Mar 12, 2015
1 parent 463584e commit 9aef3b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/bower-config/lib/util/rc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function rc(name, defaults, cwd, argv) {
!home ? {} : json(path.join(home, '.' + name + 'rc')),
json(path.join(paths.config, name + 'rc')),
json(find('.' + name + 'rc', cwd)),
env('npm_package_config_' + name + '_'),
env(name + '_'),
argvConfig
]);
Expand Down
18 changes: 18 additions & 0 deletions packages/bower-config/test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var assert = require('assert');

describe('NPM Config on package.json', function () {
describe('Setting process.env.npm_package_config', function () {
/*jshint camelcase:false*/
process.env.npm_package_config_bower_directory = 'npm-path';
process.env.npm_package_config_bower_colors = false;

var config = require('../lib/Config').create().load()._config;

it('should return "npm-path" for "bower_directory"', function () {
assert.equal('npm-path', config.directory);
});
it('should return "false" for "bower_colors"', function () {
assert.equal('false', config.colors);
});
});
});

0 comments on commit 9aef3b7

Please sign in to comment.