Skip to content

Provices facility to maintain configuration files in JSON for OS.js

License

Notifications You must be signed in to change notification settings

os-js/osjs-json-config-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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