Find configuration for the current file from provided path, settings, package.json, workspace, HOME directory or env variable.
Donate
If you want to thank me, or promote your Issue.
Sorry, but I have work and support for plugins and modules requires some time after work. I will be glad of your support or PR's.
Install
$ npm i -S config-profiler
Why?
Originally designed for my VS Code plugins, because many plugins use similar code.
The ability to add your parsers for specific files or for one file.
The ability to setup predefined configs and use they from configs.
Less dependencies and more features.
How it works?
For example, if your config name is "my-cofig" we will search out configuration in the following places and order:
Settings (if you set options.settings):
* Return options.settings if they are the object.
* Return config from oprions.predefinedConfigs by name in the options.settings if is a string and it is found.
* Return config from filepath defined in the options.settings.
Trying to get the path to the config file from environment variable (if you set options.envVariableName)
Trying to find the config file in the current workspace (cwd). Closest config file to the current file. File from the following list:
* options.configFiles
* package.json if you set options.packageProp
Trying to find the config file in the HOME directory.
If no configuration object is found then we return null.