# node-package-configurator

> Receives a JSON Schema, deploys an HTML form and saves it locally.

Latest version **1.4.0** (published 2018-12-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-package-configurator
pnpm add node-package-configurator
yarn add node-package-configurator
bun add node-package-configurator
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2018-12-24 |
| First published | 2017-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 429.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Vincent Morneau |
| Maintainers | vincentmorneau |
| Keywords | json, json-schema, config, javascript, nodejs |

## Links

- npm: https://www.npmjs.com/package/node-package-configurator
- Repository: https://github.com/vincentmorneau/node-package-configurator
- Homepage: https://github.com/vincentmorneau/node-package-configurator#readme
- Issues: https://github.com/vincentmorneau/node-package-configurator/issues
- npm.io page: https://npm.io/package/node-package-configurator

## Dependencies (6)

- [opn](https://npm.io/package/opn.md) 5.4.x
- [express](https://npm.io/package/express.md) ^4.16.4
- [handlebars](https://npm.io/package/handlebars.md) ^4.0.12
- [body-parser](https://npm.io/package/body-parser.md) ^1.18.3
- [portscanner](https://npm.io/package/portscanner.md) 2.2.x
- [json-mapping](https://npm.io/package/json-mapping.md) ^1.1.2

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.4.0 (latest) — 2018-12-24
- 1.3.3 — 2018-03-31
- 1.3.2 — 2017-09-20
- 1.3.0 — 2017-07-14

## 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)

---
_Source: https://npm.io/package/node-package-configurator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
