1.6.1 • Published 9 years ago
neuron-project-config v1.6.1
neuron-project-config
Get the configurations of neuron project from an entry directory.
ALWAYS use this module to loop up and read neuron.config.js, so that path.resolve and other problems will not be your concern.
Install
$ npm install neuron-project-config --saveUsage
If the directory structure is:
/path/to
|-- neuron.config.js
|-- a
|-- b
|-- a.jsvar config = require('neuron-project-config');
config.read('/path/to/a/b', function(err, conf){
console.log(conf); // The santitized and resolved exports of neuron.config.js
});config.read(dir, callback)
- callback
function(err, conf)
Looks neuron.config.js up from dir, reads and config.validate the configurations. If not found, an error will pass into the callback.
config.root(dir, callback)
- callback
function(root)the foundrootwill be passed as the only parameter. If package root not found, thenrootwill beundefined.
config.validate(conf, root, callback);
- conf
Object - root
paththe root path of the project
Validates and resolves the value of the conf
License
MIT