npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-red-nodegen

v0.2.4

Published

Node generator for Node-RED

Downloads

116

Readme

Node generator for Node-RED

Node generator is a command line tool to generate Node-RED nodes based on various sources such as an OpenAPI (Swagger) document, a Node-RED Function node, or a Web Of Things Thing description. It helps developers dramatically reduce the time to implement Node-RED nodes.

Installation

Install node generator globally to make the node-red-nodegen command available on your path:

npm install -g node-red-nodegen

You may need to run this with sudo, or from within an Administrator command shell.

Usage

Usage:
   node-red-nodegen <source file or URL> [-o <path to save>] [--prefix <prefix string>] [--name <node name>] [--module <module name>] [--version <version number>] [--keywords <keywords list>] [--category <node category>] [--icon <png or gif file>] [--color <node color>] [--tgz] [--help] [--wottd] [--encoding <encoding>] [--encodekey <encoding key>] [--lang <accept-language>] [-v]

Description:
   Node generator for Node-RED

Supported source:
   - OpenAPI document
   - Function node (js file in library, "~/.node-red/lib/function/")
   - Subflow node (json file of subflow)
   - (Beta) Thing Description of W3C Web of Things (jsonld file or URL that points jsonld file)

Options:
   -o : Destination path to save generated node (default: current directory)
   --prefix : Prefix of npm module (default: "node-red-contrib-")
   --name : Node name (default: name defined in source)
   --module : Module name (default: "node-red-contrib-<node name>")
   --version : Node version (format: "number.number.number" like "4.5.1")
   --keywords : Additional keywords (format: comma separated string, default: "node-red-nodegen")
   --category : Node category (default: "function")
   --icon : PNG file for node appearance (image size should be 10x20)
   --color : Color for node appearance (format: color hexadecimal numbers like "A6BBCF")
   --tgz : Save node as tgz file
   --help : Show help
   --wottd : explicitly instruct source file/URL points a Thing Description
   --encoding : Encoding scheme of subflow (none or AES)
   --encodekey : Encoding key of subflow
   --lang : Language negotiation information when retrieve a Thing Description
   -v : Show node generator version

Example 1. Create an original node from OpenAPI document

  • node-red-nodegen http://petstore.swagger.io/v2/swagger.json
  • cd ~/.node-red
  • npm install <path-to>/node-red-contrib-swagger-petstore
  • node-red

-> You can use swagger-petstore node on Node-RED flow editor.

Example 2. Create an original node from function node (JavaScript code)

  • In Node-RED flow editor, edit the function node and to the right of the 'name' option, click on the book icon and select 'Save to library'. Then fill in the 'Export as' with the file name (lower-case.js).
  • node-red-nodegen ~/.node-red/lib/functions/lower-case.js
  • cd ~/.node-red
  • npm install <path-to>/node-red-contrib-lower-case
  • node-red

-> You can use lower-case node on Node-RED flow editor.

Example 3. Create original node from Thing Description

  • node-red-nodegen example.jsonld
  • cd ~/.node-red
  • npm install <path-to>/node-red-contrib-example-thing
  • node-red

-> You can use Example Thing node on Node-RED flow editor.

Example 4. Create original node from Thing Description via HTTP

  • node-red-nodegen http://example.com/td.jsonld --wottd --lang "en-US,en;q=0.5"
  • cd ~/.node-red
  • npm install <path-to>/node-red-contrib-example-thing
  • node-red

-> You can use Example Thing node on Node-RED flow editor.

Example 5. Create an original node from SUBFLOW definition

  • In Node-RED flow editor, create the SUBFLOW template with module properties filled. Here, we assume module name for the SUBFLOW template is node-red-contrib-qrcode.
  • Export JSON definition of the SUBFLOW template from Export menu. We assume it is saved to a file named qrcode.json.
  • node-red-nodegen qrcode.json
  • cd ~/.node-red
  • npm install <path-to>/node-red-contrib-qrcode
  • node-red

-> You can use qrcode node on Node-RED flow editor.

Documentation

Note: Currently node generator supports GET and POST methods using JSON format without authentication.