@osjs/json-config-cli
v1.0.2
Published
Provices facility to maintain configuration files in JSON for OS.js
Downloads
3
Readme
OS.js is an open-source web desktop platform with a window manager, application APIs, GUI toolkit, filesystem abstractions and much more.
OS.js JSON Configuration CLI Module
Provices facility to maintain configuration files in JSON for OS.js.
Useful to automate writing configuration files via CLI commands.
Installation
npm install @osjs/json-config-cli
Usage
In your CLI bootstrap file (src/cli/index.js
):
const json = require('@osjs/osjs-json-config-cli');
module.exports = {
tasks: [json]
};
To use a JSON file in your OS.js distro, ex src/client/config.js
:
import json from '../config.json';
// THIS IS JUST AN EXAMPLE. YOU PROBABLY WANT TO USE 'deepmerge' OR SOMETHING SIMILAR.
module.exports = Object.assign({
// Your configuration
}, json);
By default the configuration file is
src/config.json
, but you can specify this with--config
.
You now have these tasks available:
config:json:get
- Get entire configuration treeconfig:json:get --key=<string>
- Get given keyconfig:json:set --key=<string> --value=<*>
- Sets a valueconfig:json:push --key=<string> --value=<*>
- Adds a value to an arrayconfig:json:remove --key=<string>
-- Removes an entry
See simplejsonconf for more information about how this works.
Contribution
- Sponsor on Github
- Become a Patreon
- Support on Open Collective
- Contribution Guide
Documentation
See the Official Manuals for articles, tutorials and guides.