Development
For detailed contributing guidelines, refer to CONTRIBUTING.md.
Environment Setup
Follow these steps to set up your development environment for contributing to this project:
Using the VS Code Dev Container
This method sets up a Docker container with all required tools and dependencies.
Fork the Node-RED Home Assistant repository.
Clone your forked repository:
git clone https://github.com/<GITHUB_USER_NAME>/node-red-contrib-home-assistant-websocket
Open the project in VS Code.
Install the Remote - Containers extension.
Click the green button in the lower-left corner labeled "Reopen in Container."
Wait for the container to build and start.
Open a terminal in VS Code and run
pnpm dev
to start the development server.
Local Setup
Fork the Repository:
- Begin by forking the Node-RED Home Assistant repository to your GitHub account.
Clone Your Forked Repository:
Clone the forked repository to your local machine:
git clone https://github.com/<GITHUB_USER_NAME>/node-red-contrib-home-assistant-websocket
Navigate to the Project Directory:
Change to the project’s root directory:
cd node-red-contrib-home-assistant-websocket
Setup the Environment:
- You can either run the setup script or manually configure the environment:
Option A: Run the Setup Script
Execute the provided setup script to automate the environment configuration:
./scripts/setup.sh
Option B: Manual Setup
Alternatively, you can manually create a
.node-red
directory and linkpnpm
:mkdir .node-red corepack enable && corepack enable pnpm pnpm link --dir .node-red
Start Node-RED:
Launch Node-RED in development mode:
pnpm dev
Accessing the Development Server
After running pnpm dev
, Node-RED will be available on ports 1880 and 3000. Access the development server at:
Port 3000 includes browser-sync, which will automatically reload the browser when changes are made to the editor source code.
Linting
This project uses ESLint and Prettier for code linting and formatting. Run the following command to lint the code:
pnpm lint
Testing
To run the tests, use:
pnpm test