homebridge-brother-printer 0.4.0 → 0.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0 - 2026-11-22
4
+
5
+ No new settings; with your current config, 0.5.0 behaves like 0.4.0. Check your Node.js version
6
+ before updating (below).
7
+
8
+ ### Changed
9
+ - **Requires Node.js 22.19 or later, 24 or 26** (dropped 18 and 20, which no longer get security updates; on Node 22, 22.19 is the minimum across the author's plugins). Check with `node -v` or on the Homebridge UI's status page before updating.
10
+ - Development only, nothing changes for users: TypeScript 6.0 and the same ESLint and
11
+ Dependabot setup as the author's other plugins. ESLint checks for likely bugs (unhandled
12
+ promises and similar) instead of formatting; it runs once in CI, on Node 24, while the tests
13
+ still run on every supported Node version.
14
+ - Development only: lint refuses `any` in the plugin's code (the config's printer list is read as
15
+ `unknown` and each entry checked, as it already was). New tests set up real printer
16
+ accessories through the platform: registering, reusing cached ones, duplicate names, removing
17
+ printers taken out of the config, a printer that fails to set up, shutdown, cached toner tiles,
18
+ and an error while updating HomeKit.
19
+ - Development only: the same release and CI workflows as the author's other plugins. Publishing a GitHub release publishes it to npm (with trusted publishing; the package and its checksum are added to the release); each repository's checks are its `verify`, `test:matrix` and `release:check` scripts.
20
+
3
21
  ## 0.4.0 - 2026-11-08
4
22
 
5
23
  ### Changed
package/README.md CHANGED
@@ -46,7 +46,7 @@ While the printer can't be reached, all of them show No Response.
46
46
  read-only is enough). The default community is `public`.
47
47
  - A fixed address for the printer: reserve its IP in your router, or use its mDNS
48
48
  hostname (for example `brn3c2af4919dfc.local`).
49
- - Homebridge 1.6 or later (including 2.x), Node.js 18, 20, 22 or 24.
49
+ - Homebridge 1.6 or later (including 2.x), Node.js 22 (22.19 or later), 24 or 26.
50
50
 
51
51
  ## Installation
52
52
 
@@ -192,6 +192,8 @@ npm run build # build only
192
192
 
193
193
  `npm publish` lints and tests first.
194
194
 
195
+ Releases are published to npm by GitHub Actions (`.github/workflows/publish.yml`, the same in the author's other plugins) when a GitHub release is published. The tag must be `v` followed by the version in `package.json`, the release needs notes (the CHANGELOG section for the version), and **Set as a pre-release** must be ticked exactly for a version with a `-`. The workflow runs `npm run release:check`, adds the package and its `SHA256SUMS` to the release, and publishes that package with npm's trusted publishing: a `-dev-` version to npm's `dev` tag, any other pre-release to `beta`, a stable version to `latest`. **Run workflow** with a release's tag publishes a release that already exists. CI (`.github/workflows/ci.yml`, also shared) runs `npm run verify` on Node 24 and `npm run test:matrix` on Node 22, 24 and 26.
196
+
195
197
  ## License
196
198
 
197
199
  MIT
@@ -19,7 +19,7 @@ if (!host) {
19
19
  })
20
20
  .catch((err) => {
21
21
  const e = err;
22
- console.error(`Couldn't read ${host}: ${e?.message || err}`);
22
+ console.error(`Couldn't read ${host}: ${e?.message || String(err)}`);
23
23
  console.error('Check the address, and that SNMP is enabled on the printer (Network > Protocol).');
24
24
  process.exit(1);
25
25
  });
package/dist/platform.js CHANGED
@@ -25,7 +25,7 @@ class BrotherPrinterPlatform {
25
25
  }
26
26
  catch (err) {
27
27
  const e = err;
28
- this.log.error(`Setup failed: ${e?.stack || err}`);
28
+ this.log.error(`Setup failed: ${e?.stack || String(err)}`);
29
29
  }
30
30
  });
31
31
  this.api.on('shutdown', () => this.printers.forEach((p) => p.stop()));
@@ -34,7 +34,9 @@ class BrotherPrinterPlatform {
34
34
  this.cached.set(accessory.UUID, accessory);
35
35
  }
36
36
  setup() {
37
- const entries = Array.isArray(this.config.printers) ? this.config.printers : [];
37
+ // Homebridge types the config as any: a list of entries, each checked below
38
+ const printers = this.config.printers;
39
+ const entries = Array.isArray(printers) ? printers : [];
38
40
  const active = new Set();
39
41
  entries.forEach((rawEntry, idx) => {
40
42
  if (!rawEntry || !String(rawEntry.host || '').trim()) {
@@ -68,7 +70,7 @@ class BrotherPrinterPlatform {
68
70
  }
69
71
  catch (err) {
70
72
  const e = err;
71
- this.log.error(`[${name}] Couldn't set up this printer: ${e?.message || err}`);
73
+ this.log.error(`[${name}] Couldn't set up this printer: ${e?.message || String(err)}`);
72
74
  return;
73
75
  }
74
76
  if (isNew) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "homebridge-brother-printer",
3
3
  "displayName": "Brother Printer",
4
- "version": "0.4.0",
4
+ "version": "0.5.0",
5
5
  "description": "Brother laser and inkjet printers in HomeKit: printing state, problem alerts and toner or ink levels, read locally over SNMP.",
6
6
  "author": "Manuel Zamfir",
7
7
  "license": "MIT",
@@ -27,10 +27,13 @@
27
27
  "scripts": {
28
28
  "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
29
29
  "typecheck": "tsc -p .",
30
- "lint": "eslint . && npm run typecheck",
30
+ "lint": "eslint . --max-warnings=0 && npm run typecheck",
31
31
  "test": "node --import tsx --test test/*.test.ts",
32
32
  "prepare": "npm run build",
33
- "prepublishOnly": "npm run lint && npm test"
33
+ "prepublishOnly": "npm run lint && npm test",
34
+ "verify": "npm run lint && npm run build && npm test",
35
+ "test:matrix": "npm run build && npm test",
36
+ "release:check": "npm run verify"
34
37
  },
35
38
  "keywords": [
36
39
  "homebridge-plugin",
@@ -46,21 +49,21 @@
46
49
  "snmp"
47
50
  ],
48
51
  "engines": {
49
- "node": "^18.20.0 || ^20.15.0 || ^22.0.0 || ^24.0.0",
52
+ "node": "^22.19.0 || ^24.0.0 || ^26.0.0",
50
53
  "homebridge": "^1.6.0 || ^2.0.0"
51
54
  },
52
55
  "dependencies": {
53
56
  "net-snmp": "^3.29.2"
54
57
  },
55
58
  "devDependencies": {
56
- "@eslint/js": "^9.17.0",
59
+ "@eslint/js": "^10.0.1",
57
60
  "@types/net-snmp": "^3.23.0",
58
- "@types/node": "^18.19.130",
59
- "eslint": "^9.17.0",
60
- "globals": "^15.14.0",
61
+ "@types/node": "^22.20.5",
62
+ "eslint": "^10.15.0",
63
+ "globals": "^17.14.0",
61
64
  "homebridge": "^2.5.0",
62
65
  "tsx": "^4.23.15",
63
- "typescript": "~5.9",
64
- "typescript-eslint": "^8.72.1"
66
+ "typescript": "~6.0.3",
67
+ "typescript-eslint": "^8.73.0"
65
68
  }
66
69
  }