Skip to content

release: v2.1.8 - restore npm run setup-device on the v2 remote API - #47

Merged
cldmv-bot[bot] merged 24 commits into
masterfrom
next
Oct 5, 2026
Merged

cldmv-bot[bot] merged 24 commits into
masterfrom
next

Conversation

@cldmv-bot

@cldmv-bot cldmv-bot Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

@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. The dev tooling for file headers moves to @cldmv/fix-headers 2.2.0 and @cldmv/configs 1.2.4.


🐛 Bug Fixes

Each remote has its own event emitter (#46, fixes #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, fixes #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, fixes #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). 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: this changelog.
  • NEW: changelog files for every earlier release, v1.0.0 through v2.1.7, under docs/changelog/ (#41).
  • README restructured to the CLDMV layout: badges, What's New, Installation with Node.js requirements, Documentation index and Links (#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).

🔧 Dependencies

Both are dev dependencies and affect only the npm run fix:headers script, which extends @cldmv/configs/fix-headers.json. Only package.json and the lockfile changed; no file headers were restamped and the published package is unaffected.

  • @cldmv/fix-headers ^2.1.1 → ^2.2.0, in two steps. 2.1.4 (#50) no longer writes a JavaScript comment into JSON or Markdown files, processes every repeated --input, and never walks dependency folders such as node_modules. 2.2.0 (#52) makes @Last modified by follow edits to a file's content only, so a run that merely rewrites a header keeps the recorded editor.
  • @cldmv/configs ^1.2.0 → ^1.2.4 (#52). The shared fix-headers config now sets forceAuthorUpdate and forceLastModifiedAuthorUpdate to false, so @Author keeps the file's creator and @Last modified by changes only with real content edits. The 1.2.1 and 1.2.2 releases of that package only changed its own CI.

Upgrade notes

  • No breaking changes: drop-in for v2.1.7.
  • 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.
👥 Contributors

coverage

Metric Coverage
Statements 23.2%
Branches 20.3%
Functions 40.6%
Lines 23.7%

Avg: 26.9% · f5dcd8f · Node lts/*

Co-authored-by: Shinrai Shinrai@users.noreply.github.com

Shinrai and others added 11 commits October 3, 2026 16:59
Adds a per-version changelog under docs/changelog/v1/ and v2/ for every
shipped release, written from the published npm tarballs (1.x-2.1.0) and
from each release commit's diff (2.1.1 onward). Breaking changes that
shipped in minor or patch releases are called out with upgrade steps.
v2.1.1 onward were released on GitHub but have not reached npm.
Adds docs/changelog/v2/v2.1.7.md and reorganizes the README to the
CLDMV layout: intro, badges, What's New (v2.1.7 Latest plus four recent
releases linking their changelog files), key features, installation
with Node.js and ADB requirements, quick start, usage, API, documentation
index, contributing, links and license. Install and import examples now
use the real package name @cldmv/node-android-tv-remote, the broken
promise-chain example is fixed, and createAndroidTVRemote is documented.
Replace the MIT license with the Apache License 2.0 in LICENSE, package.json and the README.
scripts/setup-device.mjs still imported src/lib/adb/setup.mjs, which was
removed in v2.1.0, so `npm run setup-device` died with a module-not-found
error. The setup steps still exist on the v2 remote (setSettings,
ensureAwake, press.home), so the script now drives those through
createRemote() instead of the removed AndroidTVSetup helper: connect,
apply the keep-awake settings, wake the device, return to the home screen
and always disconnect.

All scripts now run their CLI only when executed directly and export
main(), so tests/scripts.test.vitest.mjs can import every file under
scripts/ — a dangling import there now fails CI. The setup flow is
covered against a fake remote (no ADB or network).

Fixes #42
…nheard error

All remotes shared one module-level EventEmitter, so with two TVs each
remote's listeners received the other's connect, log and error events,
and off() on one affected the other (#43). The emitter and the emitLog /
emitError / handleDisconnectError helpers are now created per remote by
createEventChannel() inside createRemote().

An `error` event with no listener made EventEmitter throw, crashing the
consumer on the first connection or protocol error — including a failed
auto-connect inside createRemote(), before a listener could be attached
(#44). emitError now emits `error` only when a listener exists; otherwise
it emits a `log` event with level "error" (the Error in data.error) and
writes to NODE_DEBUG=android-tv-remote. The failing operation still
surfaces the error: commands reject, connect()/disconnect() resolve with
the Error as before, and initPromise rejects. initPromise also gets a
no-op handler so a failed auto-connect isn't an unhandled rejection for
callers who never await it.

Tests mock @devicefarmer/adbkit (no ADB, device or socket): two remotes
are independent for internal events, custom emits and off(); errors with
and without a listener for connect, keyboard.key and auto-connect.

Fixes #43
Fixes #44
@cldmv-bot cldmv-bot Bot added ! release → master v4 flow: persistent next → master release PR (carries the next feature release) release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments labels Oct 4, 2026
@cldmv-bot

cldmv-bot Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor Author

🔒 Dependency Review

  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ✅ 0 package(s) with unknown licenses
  • ✅ 0 denied package(s)
  • ✅ 0 package(s) with OpenSSF Scorecard score < 3

Full job summary

@cldmv-bot

cldmv-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Bundle size increased

File Raw Δ Raw Gzipped Δ Gzipped
index.cjs 1.5 kB — 787 B —
index.mjs 898 B — 477 B —
scripts/postinstall.mjs 2.8 kB +410 B (+16.4%) ⚠️ 1.1 kB +158 B
scripts/setup-device.mjs 3.4 kB +1.8 kB (+120.0%) ⚠️ 1.5 kB +702 B
scripts/wake-tv.mjs 1.8 kB +496 B (+37.5%) ⚠️ 956 B +226 B
src/lib/android-tv-remote.mjs 67.8 kB +1.5 kB (+2.3%) ⚠️ 16.0 kB +472 B
Total 78.2 kB +4.2 kB 20.8 kB +1.5 kB

📊 Generated by bundle-size. Brotli sizes also measured but omitted from the table for brevity.

Shinrai and others added 9 commits October 3, 2026 18:06
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.
Bumps @cldmv/fix-headers to 2.1.4 and re-runs npm run fix:headers. 0 files' headers were restamped.
Bumps @cldmv/fix-headers from 2.1.4 to 2.2.0. No file headers changed.
Shinrai and others added 4 commits October 4, 2026 19:07
Raises the range from ^1.2.0 (locked 1.2.0) to ^1.2.4. Configs 1.2.4 sets forceAuthorUpdate and forceLastModifiedAuthorUpdate to false, so with fix-headers 2.2.0 @author is never rewritten and @last modified by changes only on real content edits. Ran fix:headers under the new config: 0 files restamped.
@cldmv-bot
cldmv-bot Bot merged commit 0a3eff8 into master Oct 5, 2026
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Touches core library / runtime source code area: tests Touches test files, fixtures, or test infrastructure ! release → master v4 flow: persistent next → master release PR (carries the next feature release) release Marks a pull request as a pending release — merge to publish a new version semver: patch This release contains only backwards-compatible bug fixes type: bug Something is broken or not behaving as expected type: dependencies Relates to dependency updates, version bumps, or package management type: documentation Relates to docs, README updates, guides, or inline code comments

Projects

None yet

1 participant