neuron-project-config

1.6.1 • Public • Published

Build Status

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 = 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 found root will be passed as the only parameter. If package root not found, then root will be undefined.

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

Dependencies (2)

Dev Dependencies (2)

Package Sidebar

Install

npm i neuron-project-config

Weekly Downloads

3

Version

1.6.1

License

MIT

Last publish

Collaborators

  • kael