Skip to content

Latest commit

 

History

History
131 lines (93 loc) · 5.42 KB

File metadata and controls

131 lines (93 loc) · 5.42 KB

Introduction

Welcome to the guide on maintaining and updating existing Node Red flows. This document is designed to help you navigate through the process smoothly and effectively. It is not ment to be a total tutorial on software meintenence but provide an overview of some Node Red specifics.

Who is this for?

This guide is tailored for individuals who:

  • Have a working knowledge of Node Red, including installing and executing external flows.
  • Possess fundamental skills in git, encompassing operations such as clone, fork, branch, commit, push, and managing pull requests.

Prerequisites

Before you begin, ensure you meet the following prerequisites:

  • Familiarity with Node Red and its operational basics.
  • Basic understanding of git and its common commands.
  • You have identified a bug, feature or outdated package you want to fix in an existing Node Red flow.

Getting Started

To initiate the process, identify a repository you wish to modify. You can find repositories by navigating through the flow documentation link at Node Red Flows, which will direct you to the respective GitHub repository.

For example, let's use the Node Red Contrib Hello World flow. You can access the GitHub repository via this link: GitHub - Node Red Contrib Hello World.

Todo: Consider setting up a more comprehensive example flow that includes several dependencies and minor errors, such as a spelling mistake, for the user to rectify.

Fork and Clone a Repository

  1. Fork the desired repository to your GitHub account using the GitHub web interface.
  2. Clone the forked repository to your local development machine using the command:
    git clone [repository_url]

The forked and cloned repository on your local machine is where you'll make changes and from which you'll create a pull request (PR).

Install the Flow and Start Node Red

Todo: Document the procedure for running a local instance of Node Red.

Follow these steps to install the flow and start Node Red:

  1. Navigate to the directory where you cloned the repository and run npm install.
  2. Change directory (cd) to your .node-red directory and execute:
    npm install <cloned-directory>
    This command creates a symbolic link to your cloned repository, allowing Node Red to load it.
  3. Start Node Red.

Make Changes

Modify the flow as needed. Test your changes and restart Node Red to ensure your modifications are working correctly.

Commit changes and issue PR

Todo: Write section

Tips for getting a PR accepted

Todo: Write section

Tips and Tricks

Local and Isolated Installation with alternate-node-red-installer

Local installation of Node-RED can often be preferred due to its
benefits in development and deployment environments. This approach allows for a more controlled, isolated, and secure management of your Node-RED instances.

This section guides you through the process of installing alternate-node-red-installer globally, setting up a new Node-RED environment locally, and starting your Node-RED instance. Follow the steps below:

  1. Global Installation:

    • Install alternate-node-red-installer globally using npm by running the following command in your terminal:
      npm install -g alternate-node-red-installer
  2. Environment Setup:

    • To set up a new Node-RED environment, use the -f flag to specify the installation folder. Replace folderForInstall with your desired directory name:
      alternate-node-red-installer -f folderForInstall
    • Navigate to the installation folder:
      cd folderForInstall
    • (Optional) Modify the data/settings.json file if you need to customize your Node-RED settings.
  3. Starting Node-RED:

    • Inside the installation folder (folderForInstall), start your Node-RED instance with:
      npm start
    • After executing the command, your Node-RED instance should be running and accessible.

Ensure you have the necessary permissions to install global packages and modify the installation directory. Happy coding with Node-RED!

How to Update Dependencies in package.json

Note: This section is under development and will provide comprehensive information on updating dependencies in future iterations of the documentation.

Review Dependencies

  • Action: Open your package.json and review the list of current dependencies and their versions in the dependencies and devDependencies sections.

Check Available Updates

  • Action: Use the following command to check for available updates for your packages:
    npm outdated
    This command displays a list of packages that have newer versions available.

Update Packages

  • For all packages: To update all packages to their latest possible versions based on the version range specified in package.json, you can use:
    npm update
  • For a specific package: To update a specific package to its latest version, use:
    npm install [package-name]@latest
    This command will install the latest version and update the package.json and package-lock.json files.

By following these steps, you can ensure that your project dependencies are up-to-date and maintain the stability and security of your application.