Skip to content

bubkoo/loadrc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loadrc

Load runtime configuration files for your module.

MIT License

Many NodeJS modules have **rc** files, such as .babelrc, .eslintrc.yml, etc.

Use loadrc to parse your rc files into JavaScript object.

Supported files:

  • JavaScript Module
  • Yaml file
  • JSON file
  • Legacy file, such as .config
  • package.json

loadrc will try to load these files by the listed order, stop until any of them loaded.

Install

$ npm install loadrc --save

Usage

var loadrc = require('loadrc');
var config = loadrc.load(basename, rootDir);

// example
// -------
// try to load these files order by order: 
// - .congifrc.js
// - .congifrc.yaml
// - .congifrc.yml
// - .congifrc.json
// - .congifrc
// - load "package.json" and return "config" section
var config = loadrc.load('configrc');

Contributing

Pull requests and stars are highly welcome.

For bugs and feature requests, please create an issue.

About

Load runtime configuration files for your module.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published