mirror of
https://github.com/bower/bower.git
synced 2026-02-04 02:54:56 -05:00
Better error messages for invalid bowerrc files, closes #220.
This commit is contained in:
@@ -23,19 +23,28 @@ var folder = process.platform === 'win32'
|
||||
: '.bower';
|
||||
|
||||
// Bower Config
|
||||
var config = require('rc') ('bower', {
|
||||
cache : path.join(roaming, folder, 'cache'),
|
||||
links : path.join(roaming, folder, 'links'),
|
||||
completion : path.join(roaming, folder, 'completion'),
|
||||
json : 'component.json',
|
||||
endpoint : 'https://bower.herokuapp.com',
|
||||
directory : 'components'
|
||||
});
|
||||
var config;
|
||||
try {
|
||||
config = require('rc') ('bower', {
|
||||
cache : path.join(roaming, folder, 'cache'),
|
||||
links : path.join(roaming, folder, 'links'),
|
||||
completion : path.join(roaming, folder, 'completion'),
|
||||
json : 'component.json',
|
||||
endpoint : 'https://bower.herokuapp.com',
|
||||
directory : 'components'
|
||||
});
|
||||
} catch (e) {
|
||||
throw new Error('Unable to parse global .bowerrc file: ' + e.message);
|
||||
}
|
||||
|
||||
// If there is a local .bowerrc file, merge it
|
||||
var localFile = path.join(this.cwd, '.bowerrc');
|
||||
if (fileExists(localFile)) {
|
||||
_.extend(config, JSON.parse(fs.readFileSync(localFile)));
|
||||
try {
|
||||
_.extend(config, JSON.parse(fs.readFileSync(localFile)));
|
||||
} catch (e) {
|
||||
throw new Error('Unable to parse local .bowerrc file: ' + e.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Configure tmp package to use graceful degradationn
|
||||
|
||||
Reference in New Issue
Block a user