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 --save
Usage
If the directory structure is:
/path/to
|-- neuron.config.js
|-- a
|-- b
|-- a.js
var config = ;config;
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 foundroot
will be passed as the only parameter. If package root not found, thenroot
will beundefined
.
config.validate(conf, root, callback);
- conf
Object
- root
path
the root path of the project
Validates and resolves the value of the conf
License
MIT