Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vincentmorneau/node-package-configurator
Allows you to store local configuration files for your Node.js packages
https://github.com/vincentmorneau/node-package-configurator
config javascript json json-schema nodejs
Last synced: about 2 months ago
JSON representation
Allows you to store local configuration files for your Node.js packages
- Host: GitHub
- URL: https://github.com/vincentmorneau/node-package-configurator
- Owner: vincentmorneau
- License: mit
- Created: 2017-02-17T21:47:57.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-12-24T14:34:25.000Z (about 6 years ago)
- Last Synced: 2024-10-13T23:46:58.041Z (2 months ago)
- Topics: config, javascript, json, json-schema, nodejs
- Language: JavaScript
- Homepage:
- Size: 833 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
README
# Node Package Configurator
[![npm](https://img.shields.io/npm/v/node-package-configurator.svg)](https://www.npmjs.com/package/node-package-configurator) [![Build Status](https://travis-ci.org/vincentmorneau/node-package-configurator.svg?branch=master)](https://travis-ci.org/vincentmorneau/node-package-configurator) [![Dependency Status](https://david-dm.org/vincentmorneau/node-package-configurator.svg)](https://david-dm.org/vincentmorneau/node-package-configurator) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo)
![demo](/docs/demo.png)
Node Package Configurator (npc) generates a dynamic web form out of a JSON schema. The user fills the forms, npc resolves the JSON schema into a JSON object, and saves the result locally for persistent storage.
On Windows, npc saves the config file in the user App Data. Example: `C:\users\vmorneau\App Data\yourModuleName`
On MacOS, npc saves the file in the library preference folder. Example: `~/Library/Preferences/yourModuleName`
On Linux, npc saves the file in the root folder. Example: `~/yourModuleName`You can retrieve this file (your project configuration) at any time.
## Install
```
npm install node-package-configurator
```## Usage
### Launch the form
```javascript
const npc = require('node-package-configurator');
const schema = require('path_to_your_json_schema');npc.init({
modules: ["my-module"],
logo: "url",
project: "my-project",
jsonSchema: schema
});
```### Getting the config
```javascript
const npc = require('node-package-configurator');npc.getConfig({
modules: ["my-module"],
project: "my-project"
});
```## Options
Name | Type | Default | Description
--- | --- | --- | ---
module | array | | List of module names, in order of priority.
logo | string | | URL to your project logo (optional)
project | string | | Name of the project
jsonSchema | object | | JSON Schema to use in the form## Methods
Name | Type | Returns | Description
--- | --- | --- | ---
init | function | | Initializes the HTML form
getConfig | function | object | Returns the configuration object of the given project
getProjects | function | array | Returns an array of available project names
getFile | function | object | Returns a file for your npm module from the file system (AppData for Windows, root otherwise)
setFile | function | object | Writes a file for your npm module in the file system (AppData for Windows, root otherwise)## Changelog
[See changelog.](changelog.md)
## Special thanks to
[Brutusin json-forms](https://github.com/brutusin/json-forms)
## License
MIT © [Vincent Morneau](http://vmorneau.me)