https://github.com/bubkoo/loadrc
Load runtime configuration files for your module.
https://github.com/bubkoo/loadrc
Last synced: over 1 year ago
JSON representation
Load runtime configuration files for your module.
- Host: GitHub
- URL: https://github.com/bubkoo/loadrc
- Owner: bubkoo
- License: mit
- Created: 2016-04-02T12:01:16.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-12T13:24:12.000Z (about 10 years ago)
- Last Synced: 2024-10-05T13:41:23.546Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/loadrc
- Size: 7.81 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# loadrc
> Load runtime configuration files for your module.
[](https://github.com/bubkoo/loadrc/blob/master/LICENSE)
Many NodeJS modules have `**rc**` [files](http://stackoverflow.com/questions/11030552/what-does-rc-mean-in-dot-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
```js
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](https://github.com/bubkoo/loadrc/issues).