@cto.ai/ops-local-config
v1.2.0
Published
cto.ai library for managing local configuration settings
Downloads
10
Keywords
Readme
@cto.ai/ops-local-config
cto.ai library for managing local configuration settings
Creates, writes, reads and removes a config.json
file from a specified directory.
API
This is a native ESM module.
localConfig(opts) => instance
Options:
dir
(string
) Required - the configuration directory to store aconfig.json
file inname
(string
) Optional - an alternative name forconfig.json
(without the extension)
instance.read() => Promise => config
Read and parse contents of the config.json
file into an object.
instance.write(config) => Promise => config
Serialize and write a configuration object to the config.json
file.
instance.clear() => Promise => undefined
Removes the config.json
file.
Engines
- Node 12.4+
- Node 14.0+
Development
Test:
npm test
Visual coverage report (run after test):
npm run cov
Lint:
npm run lint
Autoformat:
npm run lint -- --fix
Releasing
For mainline releases:
npm version <major|minor|patch>
git push --follow-tags
For prereleases:
npm version prerelease
git push --follow-tags
License
MIT