Skip to content

Commit 1bef495

Browse files
committed
Add validation and required package fields
1 parent 9b755da commit 1bef495

3 files changed

Lines changed: 51 additions & 26 deletions

File tree

‎README.md‎

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ node-red-node-typescript-starter/
5151
- `name` - should be a [scoped name](https://docs.npmjs.com/cli/v8/using-npm/scope) as per [Node-RED recommendations](https://nodered.org/blog/2022/01/31/introducing-scorecard#changing-our-recommended-naming-convention)
5252
- `version`
5353
- `description`
54+
- `repository`
55+
- `keywords` - add the `node-red` keyword to help make your nodes discoverable within the npm repository. **Do NOT add** it until you are happy that the node is stable and working correctly, and documented sufficiently for others to be able to use it.
56+
- `author`
57+
- `node-red`.`version` - specify supported node-red versions
58+
- `engines`.`node` - specify supported node.js versions
5459
3. Install dependencies: `npm install`.
5560

5661
## Developing Nodes
@@ -61,20 +66,6 @@ Build, Test & Start Node-RED with your node set on the palette, in Watch mode:
6166
npm run dev
6267
```
6368

64-
## Building Node Set
65-
66-
Create a production build:
67-
68-
```
69-
npm run build
70-
```
71-
72-
Start Node-RED with the built node set on the palette:
73-
74-
```
75-
npm run start
76-
```
77-
7869
## Adding Nodes
7970

8071
You can quickly scaffold a new node and add it to the node set. Use the following command to create `my-new-node-type` node:
@@ -105,6 +96,28 @@ npm run add-node my-new-node-config config
10596

10697
If you want to make your own template available, add it to `./utils/templates/`.
10798

99+
## Building Node Set
100+
101+
Create a production build:
102+
103+
```
104+
npm run build
105+
```
106+
107+
Start Node-RED with the built node set on the palette:
108+
109+
```
110+
npm run start
111+
```
112+
113+
## Validation
114+
115+
Before publishing the package you built, run the full suite of validation tests to see how your [Node Scorecard](https://nodered.org/blog/2022/01/31/introducing-scorecard) will look on Flow Library:
116+
117+
```
118+
npm run validate
119+
```
120+
108121
## Backers 💝
109122

110123
[[Become a backer](https://mynode.alexkaul.com/gh-donate)]

‎package-lock.json‎

Lines changed: 8 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22
"name": "@my-scope/node-red-sample",
33
"version": "0.4.0",
44
"description": "Description of the node set here",
5+
"repository": "https://github.com/alexk111/node-red-node-typescript-starter",
6+
"keywords": [
7+
"node-red"
8+
],
9+
"author": "Alex Kaul",
10+
"node-red": {
11+
"version": ">=1.3.0",
12+
"nodes": {
13+
"transform-text": "./dist/nodes/transform-text/transform-text.js"
14+
}
15+
},
16+
"engines": {
17+
"node": ">=20.0.0"
18+
},
19+
"license": "MIT",
520
"type": "module",
621
"scripts": {
722
"add-node": "node ./utils/add-node.cjs",
@@ -12,6 +27,7 @@
1227
"build:runtime:watch": "tsc -p tsconfig.runtime.watch.json --watch --preserveWatchOutput",
1328
"build": "rm -rf dist && npm run copy && npm run build:editor && npm run build:runtime",
1429
"start": "npm run nr:setup && npm run nr:start",
30+
"validate": "npx node-red-dev validate",
1531
"test": "node --experimental-vm-modules node_modules/.bin/jest --forceExit --detectOpenHandles --colors",
1632
"test:watch": "node --experimental-vm-modules node_modules/.bin/jest --forceExit --detectOpenHandles --watchAll",
1733
"nr:setup": "cp -n ./node_modules/node-red/settings.js ./node-red-data/settings.cjs && cd node-red-data && npm install ..",
@@ -21,13 +37,6 @@
2137
"lint": "prettier --check '**/*.{js,ts,md}'; eslint --ext .js,.ts .",
2238
"lint:fix": "prettier --write '**/*.{js,ts,md}'; eslint --ext .js,.ts . --fix"
2339
},
24-
"author": "Alex Kaul",
25-
"license": "MIT",
26-
"node-red": {
27-
"nodes": {
28-
"transform-text": "./dist/nodes/transform-text/transform-text.js"
29-
}
30-
},
3140
"files": [
3241
"dist/"
3342
],

0 commit comments

Comments
 (0)