From 529e6f33c0ab1954c2908780d656da32b7546720 Mon Sep 17 00:00:00 2001 From: Shinrai Date: Sat, 3 Oct 2026 18:38:33 -0700 Subject: [PATCH] docs: add the v2.1.8 changelog and promote it in What's New Covers #45 (setup-device restored), #46 (per-remote emitters, no crash on an unheard error), #41 (Apache-2.0 relicense, changelog backfill, README restructure) and #48. Also corrects v2.1.7: the README restructure and backfill landed after it, and v2.1.7 has now been published to npm. --- README.md | 11 ++++--- docs/changelog/v2/v2.1.7.md | 9 +---- docs/changelog/v2/v2.1.8.md | 65 +++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+), 13 deletions(-) create mode 100644 docs/changelog/v2/v2.1.8.md diff --git a/README.md b/README.md index 17e6308..532cdbf 100644 --- a/README.md +++ b/README.md @@ -14,19 +14,20 @@ Every remote is an event source: operations report through structured `log` even ## ✨ What's New -### Latest: v2.1.7 (October 2026) +### Latest: v2.1.8 (October 2026) -- **CommonJS entry fixed** — `require("@cldmv/node-android-tv-remote")` now loads the ESM build directly through Node's synchronous `require(esm)` and exports `createAndroidTVRemote` alongside `createRemote`, so `require()` and `import` expose the same factories. On Node.js without `require(esm)` (older than ^20.19.0 / >=22.12.0) it throws a clear `ERR_REQUIRE_ESM` that points to `import()`, instead of a bare loader error (#39). -- [View full v2.1.7 Changelog](https://github.com/CLDMV/node-android-tv-remote/blob/master/docs/changelog/v2/v2.1.7.md) +- **Independent remotes, and no crash on an unheard error** — each remote now has its own event emitter, so two TVs no longer receive each other's events. An `error` with no listener is logged (a `log` event with level `"error"`, and `NODE_DEBUG=android-tv-remote`) instead of thrown, while the failing call still rejects ([#46](https://github.com/CLDMV/node-android-tv-remote/pull/46)). +- **`npm run setup-device` works again** — the script, broken since v2.1.0, now runs the setup steps through the v2 remote ([#45](https://github.com/CLDMV/node-android-tv-remote/pull/45)). The package is also relicensed under Apache-2.0 ([#41](https://github.com/CLDMV/node-android-tv-remote/pull/41)). +- [View full v2.1.8 Changelog](https://github.com/CLDMV/node-android-tv-remote/blob/master/docs/changelog/v2/v2.1.8.md) ### Recent Releases +- **v2.1.7** (October 2026) — CommonJS entry loads the ESM build directly, fails clearly without `require(esm)`, and exports `createAndroidTVRemote` ([Changelog](https://github.com/CLDMV/node-android-tv-remote/blob/master/docs/changelog/v2/v2.1.7.md)) - **v2.1.6** (October 2026) — CI only: the in-repo PR mirror job runs instead of being skipped; `sharp` lockfile and `@cldmv/vitest-runner` bumps ([Changelog](https://github.com/CLDMV/node-android-tv-remote/blob/master/docs/changelog/v2/v2.1.6.md)) - **v2.1.5** (October 2026) — maintenance: v4.29.2 workflow sync with bundle-size measurement, required-check mirror fix, uniform file headers; no runtime change ([Changelog](https://github.com/CLDMV/node-android-tv-remote/blob/master/docs/changelog/v2/v2.1.5.md)) - **v2.1.4** (September 2026) — `@devicefarmer/adbkit` 3.3.9 in the lockfile, dead code removed from the screencap path, bot signing secrets wired into the release workflows ([Changelog](https://github.com/CLDMV/node-android-tv-remote/blob/master/docs/changelog/v2/v2.1.4.md)) -- **v2.1.3** (September 2026) — Vitest 5 toolchain and a Prettier pass over the source; no behavior change ([Changelog](https://github.com/CLDMV/node-android-tv-remote/blob/master/docs/changelog/v2/v2.1.3.md)) -> **Note:** v2.1.1 through v2.1.7 have been released on GitHub but not yet published to npm, where the latest version is v2.1.0. See the changelogs for what changed in between, including the Node.js 20.9.0 floor introduced in v2.1.1. +> **Note:** v2.1.1 through v2.1.6 were released on GitHub but never published to npm; npm went from v2.1.0 straight to v2.1.7. See the changelogs for what changed in between, including the Node.js 20.9.0 floor from v2.1.1. 📚 **For complete version history and detailed release notes, see the [docs/changelog/](https://github.com/CLDMV/node-android-tv-remote/tree/master/docs/changelog/) folder.** diff --git a/docs/changelog/v2/v2.1.7.md b/docs/changelog/v2/v2.1.7.md index ef0b72e..733cead 100644 --- a/docs/changelog/v2/v2.1.7.md +++ b/docs/changelog/v2/v2.1.7.md @@ -35,14 +35,7 @@ const remote = await createAndroidTVRemote({ ip: "192.168.1.100" }); --- -## 📚 Documentation - -- **NEW:** [docs/changelog/v2/v2.1.7.md](./v2.1.7.md) — this changelog. -- README — restructured to the CLDMV README layout (badges, What's New, Installation with Node.js requirements, Documentation index, Links), with the changelog history backfilled for every earlier release under `docs/changelog/`. - ---- - ## Upgrade notes - No breaking changes — drop-in for v2.1.6. CommonJS consumers need Node.js ^20.19.0 or >=22.12.0, as they already did; on older Node.js the error message is now explicit, and `import()` remains the way to load the package there. -- v2.1.1 through v2.1.7 were released on GitHub but have not reached npm, where the latest published version is still v2.1.0. Upgrading from npm's v2.1.0 picks up everything in between, including the Node.js 20.9.0 floor from v2.1.1. +- v2.1.1 through v2.1.6 were released on GitHub but never published to npm. v2.1.7 is the first version on npm after v2.1.0, so upgrading from npm's v2.1.0 picks up everything in between, including the Node.js 20.9.0 floor from v2.1.1. diff --git a/docs/changelog/v2/v2.1.8.md b/docs/changelog/v2/v2.1.8.md new file mode 100644 index 0000000..124e8aa --- /dev/null +++ b/docs/changelog/v2/v2.1.8.md @@ -0,0 +1,65 @@ +# @cldmv/node-android-tv-remote v2.1.8 Changelog + +**Release Date**: October 2026 +**Release Type**: Patch +**Branch**: `release/2.1.8` + +--- + +## Overview + +Version 2.1.8 makes remotes independent of each other and stops an unheard `error` event from crashing the process. Each remote now has its own event emitter, so two TVs no longer see each other's events. When no `error` listener is attached, an error is logged instead of thrown, and the failing call still reports it. It also restores `npm run setup-device`, which had been broken since v2.1.0, and relicenses the package under Apache-2.0. + +--- + +## 🐛 Bug Fixes + +### Each remote has its own event emitter ([#46](https://github.com/CLDMV/node-android-tv-remote/pull/46), fixes [#43](https://github.com/CLDMV/node-android-tv-remote/issues/43)) + +The event emitter and its helper functions were created once at module level and shared by every remote returned by `createRemote()`. With two TVs, listeners on one remote received the other remote's connect, disconnect, log and error events, and `off()` on one affected the other. Every remote now gets its own emitter. + +### An `error` with no listener no longer crashes the process ([#46](https://github.com/CLDMV/node-android-tv-remote/pull/46), fixes [#44](https://github.com/CLDMV/node-android-tv-remote/issues/44)) + +The remote is an event emitter, and Node.js throws when `error` is emitted with no listener. Even a failed auto-connect inside `createRemote()`, before the caller could attach a listener, crashed the process. Now `error` is emitted only when a listener is attached. Otherwise the error goes out as a `log` event with level `"error"` (the `Error` is in `data.error`) and to `NODE_DEBUG=android-tv-remote`. The failing call still reports it: commands reject and `initPromise` rejects. A failed auto-connect is no longer an unhandled promise rejection for callers who never await `initPromise`. `connect()` and `disconnect()` still resolve with the `Error` rather than rejecting, as before. + +### `npm run setup-device` works again ([#45](https://github.com/CLDMV/node-android-tv-remote/pull/45), fixes [#42](https://github.com/CLDMV/node-android-tv-remote/issues/42)) + +`scripts/setup-device.mjs` imported `src/lib/adb/setup.mjs`, which was deleted in v2.1.0, so the script failed with a module-not-found error, and it was still published. It now runs the setup steps through the v2 remote: connect, apply the keep-awake settings with `setSettings`, wake the device with `ensureAwake`, go to the home screen, and always disconnect, even when a step fails. All three scripts in `scripts/` now run their command only when executed directly and export `main()`, so importing them has no side effects. + +--- + +## 📄 License + +The package is relicensed from MIT to Apache-2.0 ([#41](https://github.com/CLDMV/node-android-tv-remote/pull/41)). The repository now has a `LICENSE` file; before this it had none, although `package.json` declared MIT. + +--- + +## 🧪 Tests + +- `tests/scripts.test.vitest.mjs` imports every file under `scripts/`, so a dangling import fails CI, and tests the setup flow against a fake remote. +- `tests/events.test.vitest.mjs` mocks `@devicefarmer/adbkit`, so no real ADB or network connections are made. It checks that two remotes are independent, and that errors with and without a listener are reported correctly for `connect`, `keyboard.key` and auto-connect. +- Line coverage rises from about 13% to about 23%. + +--- + +## 📚 Documentation + +- **NEW:** [docs/changelog/v2/v2.1.8.md](./v2.1.8.md): this changelog. +- **NEW:** changelog files for every earlier release, v1.0.0 through v2.1.7, under [docs/changelog/](../) ([#41](https://github.com/CLDMV/node-android-tv-remote/pull/41)). +- README restructured to the CLDMV layout: badges, What's New, Installation with Node.js requirements, Documentation index and Links ([#41](https://github.com/CLDMV/node-android-tv-remote/pull/41)). It also fixes the install and import examples, which used the wrong package name (`android-tv-remote`). +- The README now says an `error` listener is optional and describes where unheard errors go ([#48](https://github.com/CLDMV/node-android-tv-remote/pull/48)). + +--- + +## 🔧 Dependencies + +_No dependency updates._ + +--- + +## Upgrade notes + +- No breaking changes: drop-in for [v2.1.7](./v2.1.7.md). +- If you ran several remotes and relied on one remote's listeners also receiving another remote's events, that was the bug fixed here; attach listeners to each remote. +- Code that kept the process alive only because an unheard `error` crashed it no longer crashes: listen for `error`, or for `log` events with level `"error"`, if you want to act on failures without awaiting the call. +- The license is now Apache-2.0.