continuous-integration/drone/push Build is passing
Details
continuous-integration/drone Build is passing
Details
|
10 months ago | |
---|---|---|
.vscode | 10 months ago | |
src | 10 months ago | |
.drone.yml | 10 months ago | |
.gitignore | 10 months ago | |
.npmrc | 11 months ago | |
.nvmrc | 11 months ago | |
.prettierignore | 11 months ago | |
.prettierrc | 11 months ago | |
Makefile | 11 months ago | |
README.md | 11 months ago | |
package.json | 10 months ago | |
pnpm-lock.yaml | 11 months ago | |
tsconfig.json | 11 months ago |
README.md
@4lch4/LT-Commander
LT-Commander is a "helper" library for building CLI applications with Commander.
Config Utilities
LT-Commander exports two configuration utilities, each of which provide a unique set of features/functionality.
ConfigUtil
This class makes use of the configstore dependency. It provides a number of methods for getting, updating, deleting, etc., of configuration settings.
Configstore Details
Easily load and persist config without having to think about where and how.
The config is stored in a JSON file located in $XDG_CONFIG_HOME
or ~/.config
.
Example: ~/.config/configstore/some-id.json
CosmicUtil
This class makes use of the cosmiconfig dependency which only provides a single method for loading the config file content (if it exists): load
Cosmiconfig Details
Cosmiconfig searches for and loads configuration for your program.
It features smart defaults based on conventional expectations in the JavaScript ecosystem. But it's also flexible enough to search wherever you'd like to search, and load whatever you'd like to load.
By default, Cosmiconfig will start where you tell it to start and search up the directory tree for the following:
- A package.json property
- A JSON or YAML, extensionless "rc file"
- An "rc file" with the extensions
.json
,.yaml
,.yml
,.js
, or.cjs
- A
.config.js
or.config.cjs
CommonJS module
For example, if your module's name is "myapp", cosmiconfig will search up the directory tree for configuration in the following places:
- A
myapp
property in package.json - A
.myapprc
file in JSON or YAML format - A
.myapprc.json
,.myapprc.yaml
,.myapprc.yml
,.myapprc.js
, or.myapprc.cjs
file - A
myapp.config.js
ormyapp.config.cjs
CommonJS module exporting an object
Cosmiconfig continues to search up the directory tree, checking each of these places in each directory, until it finds some acceptable configuration (or hits the home directory). If a path is provided to the load
function, then the search begins there.