Skip to content

chore: relicense under Apache-2.0 - #41

Merged
Shinrai merged 3 commits into
nextfrom
docs/changelog-backfill
Oct 4, 2026
Merged

Shinrai merged 3 commits into
nextfrom
docs/changelog-backfill

Conversation

@cldmv-bot

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

Copy link
Copy Markdown
Contributor

🚀 What's Changed

💥 Breaking Changes

No breaking changes

✨ Features

No new features

🐛 Bug Fixes

No bug fixes

📦 Dependencies

No dependency updates

🔧 Other Changes

👥 Contributors

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.
@cldmv-bot cldmv-bot Bot changed the title docs: add v2.1.7 release notes and restructure the README chore: relicense under Apache-2.0 Oct 4, 2026
@cldmv-bot

cldmv-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor Author

Auto-normalized PR title: rewrote PR title to match the highest-priority commit type (chore).

  • Before: docs: add v2.1.7 release notes and restructure the README
  • After: chore: relicense under Apache-2.0

If this isn't what you want, edit the title — the normalizer won't re-fire as long as the title stays conventional.

@cldmv-bot cldmv-bot Bot added the type: dependencies Relates to dependency updates, version bumps, or package management label Oct 4, 2026
@Shinrai
Shinrai merged commit 74d9360 into next Oct 4, 2026
28 checks passed
@cldmv-bot
cldmv-bot Bot deleted the docs/changelog-backfill branch October 4, 2026 00:40
cldmv-bot Bot added a commit that referenced this pull request Oct 5, 2026
# @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](#46), fixes [#43](#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](#46), fixes [#44](#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](#45), fixes [#42](#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](#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](#41)).
- README restructured to the CLDMV layout: badges, What's New, Installation with Node.js requirements, Documentation index and Links ([#41](#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](#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](#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](#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](#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](./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.



<details>
<summary>👥 Contributors</summary>

- @Shinrai

</details>

---

<!-- coverage-start -->

![coverage](https://img.shields.io/badge/coverage-26.9%25-red?style=for-the-badge&logo=vitest&logoColor=white)

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

*Avg: **26.9%** · `f5dcd8f` · Node lts/**

<!-- coverage-end -->

<!-- co-authors -->

Co-authored-by: Shinrai <Shinrai@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

! docs → next v4 flow: docs contributor PR targeting the next integration branch 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

Development

Successfully merging this pull request may close these issues.

1 participant