|
| 1 | +# Node-RED Node TypeScript Starter |
| 2 | + |
| 3 | +This is a quick-start template repository for creating new Node-RED node sets in TypeScript. |
| 4 | + |
| 5 | +## Project Structure |
| 6 | + |
| 7 | +``` |
| 8 | +node-red-node-typescript-starter/ |
| 9 | + ├──src/ * source files of the node set |
| 10 | + │ ├──__tests__/ * tests for the node set (test file names should match *.test.ts glob pattern) |
| 11 | + │ │ └──transform-text.test.ts * tests for the transform-text node |
| 12 | + │ │ |
| 13 | + │ └──nodes/ * node set folder, where subfolder names = node types |
| 14 | + │ ├──shared/ * folder for .ts files shared across multiple nodes in the node set |
| 15 | + │ │ |
| 16 | + │ └──transform-text/ * source files of the transform-text node |
| 17 | + │ ├──icons/ * custom icons used by the node set in the editor |
| 18 | + │ │ |
| 19 | + │ ├──modules/ * .ts modules for the runtime side (transform-text.js file) of the node |
| 20 | + │ │ |
| 21 | + │ ├──shared/ * folder for .ts files shared between the runtime side (.js file) and the editor side (.html file) of the node |
| 22 | + │ │ |
| 23 | + │ ├──transform-text.html/ * files for compiling and bundling into the editor side (transform-text.html file) of the node |
| 24 | + │ │ ├──modules/ * .ts modules |
| 25 | + │ │ ├──editor.html * html template for the edit dialog |
| 26 | + │ │ ├──help.html * html template for the help in the info tab |
| 27 | + │ │ └──index.ts * entry file |
| 28 | + │ │ |
| 29 | + | └──transform-text.ts * entry file for the runtime side (transform-text.js file) of the node |
| 30 | + | |
| 31 | + ├──package.json * dependencies and node types for the Node-RED runtime to load |
| 32 | + | |
| 33 | + ├──rollup.config.editor.json * rollup config for building the editor side of the nodes |
| 34 | + | |
| 35 | + ├──tsconfig.json * base typescript config, for the code editor |
| 36 | + ├──tsconfig.runtime.json * config for creating a production build of the runtime side of the nodes |
| 37 | + └──tsconfig.runtime.watch.json * config for watching and incremental building the runtime side of the nodes |
| 38 | +``` |
| 39 | + |
| 40 | +## Getting Started |
| 41 | + |
| 42 | +1. Generate a new GitHub repository by clicking the `Use this template` button at the top of the repository homepage, then clone your new repo. Or you might just clone this repo: `git clone https://github.com/alexk111/node-red-node-typescript-starter.git` and cd into it: `cd node-red-node-typescript-starter`. |
| 43 | +2. This project is designed to work with `yarn`. If you don't have `yarn` installed, you can install it with `npm install -g yarn`. |
| 44 | +3. Install dependencies: `yarn install`. |
| 45 | + |
| 46 | +## Adding/Removing Node |
| 47 | + |
| 48 | +TODO: Scripts for adding/removing a node |
| 49 | + |
| 50 | +## Developing Node Set |
| 51 | + |
| 52 | +Build & Test in Watch mode: |
| 53 | + |
| 54 | +``` |
| 55 | +yarn dev |
| 56 | +``` |
| 57 | + |
| 58 | +## Building Node Set |
| 59 | + |
| 60 | +Create a production build: |
| 61 | + |
| 62 | +``` |
| 63 | +yarn build |
| 64 | +``` |
| 65 | + |
| 66 | +## License |
| 67 | + |
| 68 | +MIT © Alex Kaul |
0 commit comments