The whole repository it is an opinionated monorepository:
- NPM workspaces to manage monorepo:
- Flat learning curve
- No depedencies, just npm
- Schema validation to guarantee runtime type checking
- ts-standard as linter + formatter
- No dealing with complicated setup
- StandardJS as code style
- Vitest as test suite
- Faster
- Quite easy to setup
- tsup as build layer on top of tsc
- Transpile to ESM + CJS
- Quite easy to setup
- Naming has some rules:
- All packages are published with scope
@coremarine
- The library is called typically as
<manufacturer>-<protocol>
or something like that - The NodeRED component is called the same as the library with
-nodered
ending - Example:
@coremarine/nmea-parser
and@coremarine/nmea-parser-ndoered
- All packages are published with scope
- Create well-tested and battle tested TypeScript library.
- Create a NodeRED wrapper / compoment which uses that library.
Always you have to create a custom branch and make pull requests to dev
branch. Once the branch is merged, you should remove it.
New packages will be publish when a pull request into main
branch is accepted.
- Copy the
library
folder insidetemplates
and paste as a new folder insidepackages
->packages/<your-library>
- Look for the keyword
TODO:
in your IDE / Editor inside that folder, this is a hint to places you need to setup. - Setup npm package -> Modify library
package.json
(packages/<your-library>/package.json
)name
to@coremarine/<your-library>
description
homepage
keywords
- Setup npm workspaces -> Add scripts in global / monorepo
package.json
:lint
format
build
test
test:coverage
- Setup CI/CD (Github Actions)
- Copy
library.yml
file insidetemplates
and paste as a new yml file<your-library>.yml
inside.github/workflows
folder - Change all TODO:
- Copy
- Document your library -> Modify
README.md
(packages/<your-library>/README.md
) - Start with your library by coding in
src
and testing intests
- Link your new library in the global / monorepo README
- Copy the
nodered
folder insidetemplates
and paste as a new folder ending with-nodered
insidepackages
->packages/<your-library>-nodered
- Look for the keyword
TODO:
in your IDE / Editor inside that folder, this is a hint to places you need to setup. - Setup npm package -> Modify library
package.json
(packages/<your-library>/package.json
)name
to@coremarine/<your-library>
description
homepage
keywords
node-red.nodes.cma-<your-component>
dependencies.@coremarine/<your-library>
- Setup npm workspaces -> Add scripts in global / monorepo
package.json
:nodered:docker
nodered:test
- Setup CI/CD (Github Actions)
- Copy
nodered.yml
file insidetemplates
and paste as a new yml file<your-library>-nodered.yml
inside.github/workflows
folder - Change all TODO:
- Copy
- Document your library -> Modify
README.md
(packages/<your-library>-nodered/README.md
) - Add component dependencies to package
Dockerfile
file - Rename project into package
docker-compose.yml
file - Start with your library by coding in
src
and testing intests
and seeing results with docker (all files there has a minimal scaffolding to start working on it). - Link your new library in the global / monorepo README