# node-red-cli-tool

> This is a CLI tool for managing node-red flows and storing them in a VCS like git.

Latest version **0.0.6** (published 2020-10-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install node-red-cli-tool
pnpm add node-red-cli-tool
yarn add node-red-cli-tool
bun add node-red-cli-tool
```

Provides the command `node-red-tool`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2020-10-09 |
| First published | 2019-01-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 23.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | arstulke |
| Maintainers | arstulke |

## Links

- npm: https://www.npmjs.com/package/node-red-cli-tool
- npm.io page: https://npm.io/package/node-red-cli-tool

## Dependencies (1)

- [node-fetch](https://npm.io/package/node-fetch.md) ^2.6.0

## Recent versions

- 0.0.6 (latest) — 2020-10-09
- 0.0.5 — 2020-07-29
- 0.0.3 — 2019-03-26
- 0.0.2 — 2019-01-04
- 0.0.1 — 2019-01-04

## README

# Node Red Tool
This is a CLI tool for managing node-red flows and storing them in a VCS like git.

## Terminology
* The serverId is the id of the target server.
* The projectId is the id of the project.
* The flowId is the id of the flow. It is stored in the text description of the flow.

## Usage
### Setup
1. `npm i -g node-red-cli-tool`
2. Create a credentials file named 'node-red.credentials.json' in your project directory with the following template and replace the placeholders:
```
{
  "<serverId>": {
    "projects": {
      "<projectId>": {
        "url": "<url>",
        "username": "<username>",
        "password": "<password>"
      }
    }
  }
}
```
3. Create a project file named 'node-red.config.json' in the '{{projectId}}' directory in your project directory with the following template and replace the placeholders:
```
{
  "id": "<projectId>",
  "flowFile": "flow.json",
  "flowTextId": "<flowId>",
  "stages": {
    "<stageKey>": "<serverId>"
  },
  "functionsDir": "functions",
  "functionBindings": [
    {
      "functionFileName": "<some_function_file_name_1.js>"
      "functionId": "001"
    },
    {
      "functionFileName": "<some_function_file_name_2.js>"
      "functionId": "002"
    }
  ]
}
```


### Commands
| Name    | Befehl                                          | Beschreibung                                                  |
|---------|-------------------------------------------------|---------------------------------------------------------------|
| Fetch   | node-red-tool fetch <subProjectDir> <stageKey>  | Loads the flow file for Subprojects' flow                     |
| Extract | node-red-tool extract <subProjectDir>           | Extracts the functions of the flow file to the function files |
| Build   | node-red-tool build <subProjectDir              | Copies the functions of the functions files in the flow file  |
| Deploy  | node-red-tool deploy <subProjectDir> <stageKey> | Deploys the flow file to the specified server                 |
| Clean   | node-red-tool clean <subProjectDir>             | Removes all functions bodies from the local flow file         |

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