node-red-contrib-aedes 0.15.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/nodejs.yml +1 -1
- package/CHANGELOG.md +10 -0
- package/README.md +9 -2
- package/aedes.html +29 -19
- package/aedes.js +181 -172
- package/locales/de/aedes.html +110 -0
- package/locales/de/aedes.json +50 -0
- package/locales/en-US/aedes.html +103 -12
- package/locales/en-US/aedes.json +10 -1
- package/package.json +6 -4
- package/test/aedes_last_will_spec.js +25 -48
- package/test/aedes_qos_spec.js +83 -77
- package/test/aedes_retain_spec.js +84 -78
- package/test/aedes_spec.js +260 -67
- package/test/aedes_ws_spec.js +112 -38
- package/test/test-utils.js +17 -0
- package/docs/DEV-SETUP.md +0 -86
- package/docs/MIGRATION-PLAN-0.51-TO-1.0.md +0 -349
- package/docs/MIGRATION-PLAN-NODE-RED-4.md +0 -107
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
# Migration Plan: Node-RED 4 Best Practices
|
|
2
|
-
|
|
3
|
-
## Context
|
|
4
|
-
|
|
5
|
-
The project was started with Node-RED v2 but `package.json` already requires `>=3.0.0`. Node-RED v3 went EOL June 2025. Only v4 is actively maintained. This plan aligns the project with Node-RED v4 best practices while keeping the changes minimal and low-risk.
|
|
6
|
-
|
|
7
|
-
## Recommended Order: Run this BEFORE the Aedes v1 migration
|
|
8
|
-
|
|
9
|
-
Rationale:
|
|
10
|
-
- These changes are small, low-risk, and independently testable
|
|
11
|
-
- They establish a clean, verified baseline before the larger Aedes rewrite
|
|
12
|
-
- The close handler update to `(removed, done)` carries over naturally into the Aedes migration's restructured close handler
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## TASK 1: Update `node-red` version field in package.json
|
|
17
|
-
|
|
18
|
-
**File:** `package.json` line 21
|
|
19
|
-
|
|
20
|
-
### 1.1 Keep minimum Node-RED version at >=3.0.0
|
|
21
|
-
- No change needed -- `"version": ">=3.0.0"` already includes v4
|
|
22
|
-
- Keeps broader compatibility for users still on v3
|
|
23
|
-
|
|
24
|
-
---
|
|
25
|
-
|
|
26
|
-
## TASK 2: Update close handler to use `removed` parameter
|
|
27
|
-
|
|
28
|
-
**File:** `aedes.js` line 410
|
|
29
|
-
|
|
30
|
-
### 2.1 Add `removed` parameter
|
|
31
|
-
Available since Node-RED v0.17. Compatible with v2, v3, and v4.
|
|
32
|
-
|
|
33
|
-
**Current:**
|
|
34
|
-
```javascript
|
|
35
|
-
this.on('close', function (done) {
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**New:**
|
|
39
|
-
```javascript
|
|
40
|
-
this.on('close', function (removed, done) {
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### 2.2 Optional: use `removed` for cleaner logging
|
|
44
|
-
```javascript
|
|
45
|
-
this.on('close', function (removed, done) {
|
|
46
|
-
if (removed) {
|
|
47
|
-
node.debug('Node removed or disabled');
|
|
48
|
-
} else {
|
|
49
|
-
node.debug('Node restarting');
|
|
50
|
-
}
|
|
51
|
-
// ... existing cleanup ...
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Note: The close handler has a **15-second timeout** enforced by Node-RED. The current nested callback chain should stay well within that, but keep it in mind.
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## TASK 3: Add missing dev dependencies to package.json
|
|
59
|
-
|
|
60
|
-
**File:** `package.json`
|
|
61
|
-
|
|
62
|
-
### 3.1 Add semistandard and snazzy to devDependencies
|
|
63
|
-
The test script uses `semistandard` and `snazzy` but they're **not listed in devDependencies**. They only work if globally installed, which breaks `npm test` for other contributors.
|
|
64
|
-
|
|
65
|
-
Add to `devDependencies`:
|
|
66
|
-
```json
|
|
67
|
-
"semistandard": "^17.0.0",
|
|
68
|
-
"snazzy": "^9.0.0"
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### 3.2 Alternative: Replace with ESLint (optional, larger scope)
|
|
72
|
-
`semistandard` was [last updated Aug 2024](https://github.com/standard/semistandard) and is not actively maintained. ESLint is the modern standard. However, this is a larger change -- consider deferring to a separate effort.
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
## TASK 4: Verify test helper version
|
|
77
|
-
|
|
78
|
-
**File:** `package.json` line 12
|
|
79
|
-
|
|
80
|
-
### 4.1 Already up to date
|
|
81
|
-
`node-red-node-test-helper` v0.3.6 (Jan 2025) is the latest. Your `^0.3.6` is correct. No change needed.
|
|
82
|
-
|
|
83
|
-
Notable: v0.3.5 added async `start`/`stop`/`load` support, which will be useful during the Aedes migration when tests need to `await _initPromise`.
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
## TASK 5: Run tests and verify
|
|
88
|
-
|
|
89
|
-
### 5.1 Install and test
|
|
90
|
-
```bash
|
|
91
|
-
npm install
|
|
92
|
-
npm test
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
### 5.2 Verify all existing tests still pass
|
|
96
|
-
No functional changes were made -- only the close handler signature and package metadata.
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Summary of changes
|
|
101
|
-
|
|
102
|
-
| Task | Risk | Effort | Backward compat |
|
|
103
|
-
|------|------|--------|-----------------|
|
|
104
|
-
| node-red version field | None | Trivial | v2+ (if >=3.0.0) or v4+ |
|
|
105
|
-
| close(removed, done) | None | Trivial | v2+ (since v0.17) |
|
|
106
|
-
| Add semistandard/snazzy to devDeps | None | Trivial | All versions |
|
|
107
|
-
| Test helper version | None | None | Already current |
|