@osjs/json-config-cli

1.0.2 • Public • Published

OS.js Logo

OS.js is an open-source web desktop platform with a window manager, application APIs, GUI toolkit, filesystem abstractions and much more.

Support Support Donate Donate

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 tree
  • config:json:get --key=<string> - Get given key
  • config:json:set --key=<string> --value=<*> - Sets a value
  • config:json:push --key=<string> --value=<*> - Adds a value to an array
  • config:json:remove --key=<string> -- Removes an entry

See simplejsonconf for more information about how this works.

Contribution

Documentation

See the Official Manuals for articles, tutorials and guides.

Links

Readme

Keywords

Package Sidebar

Install

npm i @osjs/json-config-cli

Weekly Downloads

0

Version

1.0.2

License

BSD-2-Clause

Unpacked Size

8.84 kB

Total Files

5

Last publish

Collaborators

  • andersevenrud