custom-config-files
Output, read, and remove both local and global configs from .json, .js, .env, and .yml files with Node.js
Highlights
- Local and global configs
- Output, read, remove
- json, js, env, yml
Install
npm install custom-config-files
yarn add custom-config-files
Usage
Documentation website coming soon!
Initialize
// import packageconst Config = default; // setup instanceconst config = rootName: 'myconfigrc' // required, file patterns .myconfigrc.json globalDir: '~/.config/myconfig' // required, see https://github.com/kirsle/configdir localDir: `/myconfig` // optional, defaults to process.cwd() // edit instance variablesconfig;config;config;
Methods
Extensions
const fileTypes = fileTypes; // extensions are optional, and are used to// specify output or filter input let extensions;// defaults to fileTypes.json for `output` methodextensions = fileTypesjson;// defaults to all available fileTypes for `read` and `remove` methodsextensions = fileTypesjson fileTypesjs fileTypesenv fileTypesyml;
Output Files
// outputs config file to local dirconfig; // outputs config file to global dirconfig;
Read Files
// find most recent local config fileconfig; // find most recent global config fileconfig; // combination, checks local then globalconfig; // all default to `null` if not found
Remove Files
// removes a local config fileconfig; // removes a global config fileconfig; // removes the entire global config folder// only use if you have a custom folder for your global configsconfig;
Low Level API
Documentation website coming soon. See comments in files under ./src/utils
.