@cldmv/node-android-tv-remote 2.1.0 → 2.1.7

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/README.md CHANGED
@@ -77,7 +77,6 @@ npm install android-tv-remote
77
77
 
78
78
  ### Basic Usage
79
79
 
80
- ```js
81
80
  ```js
82
81
  // ESM (Node.js with type: "module" in package.json)
83
82
  import createRemote from "android-tv-remote";
@@ -95,10 +94,9 @@ await remote.press.ok();
95
94
 
96
95
  // Or chain promises
97
96
  createRemote({ ip: "192.168.1.100" })
98
- .then(remote => remote.press.home())
99
- .then(() => remote.press.up())
100
- .then(() => remote.press.ok());
101
- ```
97
+ .then((remote) => remote.press.home())
98
+ .then(() => remote.press.up())
99
+ .then(() => remote.press.ok());
102
100
  ```
103
101
 
104
102
  ### Event-Driven Usage (Recommended)
@@ -132,7 +130,7 @@ remote.on("screencap-complete", (data) => {
132
130
 
133
131
  // Use the remote
134
132
  await remote.press.home();
135
- await remote.screencap({ filepath: './screenshot.png' });
133
+ await remote.screencap({ filepath: "./screenshot.png" });
136
134
  ```
137
135
 
138
136
  ### Async Initialization
@@ -148,11 +146,10 @@ remote.on("log", console.log);
148
146
  await remote.press.play();
149
147
 
150
148
  // Or use .then()
151
- createRemote({ ip: "192.168.1.100" })
152
- .then(remote => {
153
- remote.on("log", console.log);
154
- return remote.press.play();
155
- });
149
+ createRemote({ ip: "192.168.1.100" }).then((remote) => {
150
+ remote.on("log", console.log);
151
+ return remote.press.play();
152
+ });
156
153
  ```
157
154
 
158
155
  ### Screenshot Functionality
@@ -171,31 +168,31 @@ const stream = await remote.screencap();
171
168
  const resizedStream = await remote.screencap({ width: 1280, height: 720 });
172
169
 
173
170
  // Save screenshot to file (non-blocking)
174
- await remote.screencap({ filepath: './screenshot.png' });
171
+ await remote.screencap({ filepath: "./screenshot.png" });
175
172
 
176
173
  // Resized screenshot saved to file
177
- await remote.screencap({
178
- width: 640,
179
- height: 360,
180
- filepath: './thumbnail.png'
174
+ await remote.screencap({
175
+ width: 640,
176
+ height: 360,
177
+ filepath: "./thumbnail.png"
181
178
  });
182
179
 
183
180
  // Quick thumbnail (default 240px width)
184
181
  const thumbStream = await remote.thumbnail();
185
182
 
186
183
  // Custom thumbnail dimensions
187
- const customThumb = await remote.thumbnail({
188
- width: 320,
189
- height: 180,
190
- filepath: './thumb.png'
184
+ const customThumb = await remote.thumbnail({
185
+ width: 320,
186
+ height: 180,
187
+ filepath: "./thumb.png"
191
188
  });
192
189
 
193
190
  // Access last screenshot data
194
- console.log('Last screenshot available:', !!remote.lastScreencapData);
191
+ console.log("Last screenshot available:", !!remote.lastScreencapData);
195
192
 
196
193
  // Listen for screenshot events
197
- remote.on('screencap-complete', (data) => {
198
- console.log(`Screenshot completed in ${data.timing.total}ms`);
194
+ remote.on("screencap-complete", (data) => {
195
+ console.log(`Screenshot completed in ${data.timing.total}ms`);
199
196
  });
200
197
  ```
201
198
 
@@ -216,24 +213,24 @@ const isAwake = await remote.ensureAwake();
216
213
 
217
214
  // Configure optimal settings for remote control
218
215
  await remote.setSettings(); // Set optimal settings
219
- await remote.setSettings('get'); // Get current settings
216
+ await remote.setSettings("get"); // Get current settings
220
217
 
221
218
  // Wait for device to finish booting (after reboot)
222
219
  await remote.waitBootComplete(60000); // 60 second timeout
223
220
 
224
221
  // Connection management
225
222
  await remote.connect();
226
- console.log('Connected:', remote.isConnected);
223
+ console.log("Connected:", remote.isConnected);
227
224
  await remote.disconnect();
228
225
 
229
226
  // Listen for device management events
230
- remote.on('log', (data) => {
231
- if (data.source === 'reboot') {
232
- console.log(`Reboot: ${data.message}`);
233
- }
234
- if (data.source === 'ensureAwake') {
235
- console.log(`Wake: ${data.message}`);
236
- }
227
+ remote.on("log", (data) => {
228
+ if (data.source === "reboot") {
229
+ console.log(`Reboot: ${data.message}`);
230
+ }
231
+ if (data.source === "ensureAwake") {
232
+ console.log(`Wake: ${data.message}`);
233
+ }
237
234
  });
238
235
  ```
239
236
 
@@ -251,35 +248,35 @@ await remote.keyboard.text("Hello World!");
251
248
  await remote.keyboard.text("user@example.com");
252
249
 
253
250
  // Individual character input
254
- await remote.keyboard.key.h(); // Types "h"
255
- await remote.keyboard.key.e(); // Types "e"
256
- await remote.keyboard.key.l(); // Types "l"
257
- await remote.keyboard.key.l(); // Types "l"
258
- await remote.keyboard.key.o(); // Types "o"
251
+ await remote.keyboard.key.h(); // Types "h"
252
+ await remote.keyboard.key.e(); // Types "e"
253
+ await remote.keyboard.key.l(); // Types "l"
254
+ await remote.keyboard.key.l(); // Types "l"
255
+ await remote.keyboard.key.o(); // Types "o"
259
256
 
260
257
  // Shifted characters (only available for keys that change when shifted)
261
- await remote.keyboard.key.shift.h(); // Types "H"
262
- await remote.keyboard.key.shift.one(); // Types "!"
258
+ await remote.keyboard.key.shift.h(); // Types "H"
259
+ await remote.keyboard.key.shift.one(); // Types "!"
263
260
  await remote.keyboard.key.shift.semicolon(); // Types ":"
264
261
 
265
262
  // Special characters and symbols
266
- await remote.keyboard.key.space(); // Types " "
263
+ await remote.keyboard.key.space(); // Types " "
267
264
  await remote.keyboard.key.exclamation(); // Types "!"
268
- await remote.keyboard.key.at(); // Types "@"
269
- await remote.keyboard.key.hash(); // Types "#"
270
- await remote.keyboard.key.dollar(); // Types "$"
265
+ await remote.keyboard.key.at(); // Types "@"
266
+ await remote.keyboard.key.hash(); // Types "#"
267
+ await remote.keyboard.key.dollar(); // Types "$"
271
268
 
272
269
  // Control keys
273
- await remote.keyboard.key.tab(); // Tab character
274
- await remote.keyboard.key.enter(); // Enter/Return
275
- await remote.keyboard.key.backspace(); // Backspace
270
+ await remote.keyboard.key.tab(); // Tab character
271
+ await remote.keyboard.key.enter(); // Enter/Return
272
+ await remote.keyboard.key.backspace(); // Backspace
276
273
 
277
274
  // Using keycode fallback (when available for regular keys)
278
- await remote.keyboard.key.a.keycode(); // Sends keycode instead of character
275
+ await remote.keyboard.key.a.keycode(); // Sends keycode instead of character
279
276
 
280
277
  // Note: Shift variants are only available for keys that actually change
281
- // when shifted (letters, numbers, and some symbols). Special characters
282
- // like @, #, !, etc. don't have shift variants since they're already
278
+ // when shifted (letters, numbers, and some symbols). Special characters
279
+ // like @, #, !, etc. don't have shift variants since they're already
283
280
  // the shifted form. Shift keys only support text input, not keycodes,
284
281
  // since Android ADB doesn't support sending multiple keycodes simultaneously.
285
282
  ```
package/index.cjs CHANGED
@@ -1,14 +1,16 @@
1
1
  /**
2
+ *
2
3
  * @Project: @cldmv/node-android-tv-remote
3
4
  * @Filename: /index.cjs
4
- * @Date: 2025-10-15 10:29:19 -07:00 (1760549359)
5
- * @Author: Nate Hyson <CLDMV>
5
+ * @Date: 2025-10-15T10:29:19-07:00 (1760549359)
6
+ * @Author: Nate Corcoran <CLDMV>
6
7
  * @Email: <Shinrai@users.noreply.github.com>
7
8
  * -----
8
- * @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
9
- * @Last modified time: 2025-10-15 10:39:45 -07:00 (1760549985)
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-10-02T12:16:13-07:00 (1790968573)
10
11
  * -----
11
- * @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
12
14
  */
13
15
 
14
16
  /**
@@ -19,12 +21,22 @@
19
21
  *
20
22
  * @module @cldmv/node-android-tv-remote/cjs
21
23
  */
24
+ "use strict";
22
25
 
23
- const { createRequire } = require("module");
24
- const requireESM = createRequire(__filename);
26
+ // index.cjs is a thin wrapper: it loads index.mjs through Node's synchronous require(esm).
27
+ // Node.js versions without require(esm) would fail with a bare ERR_REQUIRE_ESM, so fail
28
+ // early with a message that says what to do instead.
29
+ if (!process.features?.require_module) {
30
+ const error = new Error(
31
+ `@cldmv/node-android-tv-remote: require() needs Node.js ^20.19.0 or >=22.12.0 (this is ${process.version}). On older Node.js, load the package with import() instead.`
32
+ );
33
+ error.code = "ERR_REQUIRE_ESM";
34
+ throw error;
35
+ }
25
36
 
26
- const { default: createRemote } = requireESM("./index.mjs");
37
+ const { default: createRemote, createAndroidTVRemote } = require("./index.mjs");
27
38
 
28
39
  module.exports = createRemote;
29
40
  module.exports.createRemote = createRemote;
41
+ module.exports.createAndroidTVRemote = createAndroidTVRemote;
30
42
  module.exports.default = createRemote;
package/index.mjs CHANGED
@@ -1,14 +1,16 @@
1
1
  /**
2
+ *
2
3
  * @Project: @cldmv/node-android-tv-remote
3
4
  * @Filename: /index.mjs
4
- * @Date: 2025-10-15 10:29:19 -07:00 (1760549359)
5
- * @Author: Nate Hyson <CLDMV>
5
+ * @Date: 2025-10-15T10:29:19-07:00 (1760549359)
6
+ * @Author: Nate Corcoran <CLDMV>
6
7
  * @Email: <Shinrai@users.noreply.github.com>
7
8
  * -----
8
- * @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
9
- * @Last modified time: 2025-10-15 10:40:23 -07:00 (1760550023)
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-10-02T12:16:14-07:00 (1790968574)
10
11
  * -----
11
- * @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
12
14
  */
13
15
 
14
16
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cldmv/node-android-tv-remote",
3
- "version": "2.1.0",
3
+ "version": "2.1.7",
4
4
  "description": "A Node.js library for controlling Android TV devices via ADB keycodes and text input.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -10,9 +10,20 @@
10
10
  }
11
11
  },
12
12
  "scripts": {
13
- "test": "jest",
14
13
  "postinstall": "node scripts/postinstall.mjs",
15
- "setup-device": "node scripts/setup-device.mjs"
14
+ "setup-device": "node scripts/setup-device.mjs",
15
+ "build": "echo '✓ no build step'",
16
+ "build:ci": "echo '✓ no build step'",
17
+ "test": "node tests/run-vitest.mjs && npm run test:cjs",
18
+ "test:cjs": "node --test tests/cjs/entry.test.cjs",
19
+ "test:watch": "vitest --config .configs/vitest.config.mjs",
20
+ "coverage": "node tests/run-vitest.mjs --coverage-quiet && npm run test:cjs",
21
+ "ci:coverage": "npm run coverage",
22
+ "lint": "eslint --config eslint.config.mjs .",
23
+ "lint:fix": "eslint --config eslint.config.mjs . --fix",
24
+ "format": "prettier --config .prettierrc --write .",
25
+ "format:check": "prettier --config .prettierrc --check .",
26
+ "fix:headers": "fix-headers --config .configs/fix-headers.json"
16
27
  },
17
28
  "keywords": [
18
29
  "android",
@@ -52,15 +63,26 @@
52
63
  ],
53
64
  "dependencies": {
54
65
  "@devicefarmer/adbkit": "^3.3.8",
55
- "sharp": "^0.34.4"
56
- },
57
- "devDependencies": {
58
- "jest": "^30.0.5"
66
+ "sharp": "^0.35.3"
59
67
  },
60
68
  "publishConfig": {
61
69
  "access": "public"
62
70
  },
63
71
  "engines": {
64
- "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
72
+ "node": ">=20.9.0"
73
+ },
74
+ "devDependencies": {
75
+ "@cldmv/configs": "^1.2.0",
76
+ "@cldmv/fix-headers": "^2.1.1",
77
+ "@cldmv/vitest-runner": "^1.2.0",
78
+ "@eslint/css": "^2.0.0",
79
+ "@eslint/js": "^10.0.1",
80
+ "@eslint/json": "^2.0.1",
81
+ "@eslint/markdown": "^8.0.3",
82
+ "@vitest/coverage-v8": "^5.0.0",
83
+ "eslint": "^10.8.0",
84
+ "globals": "^17.9.0",
85
+ "prettier": "^3.9.6",
86
+ "vitest": "^5.0.0"
65
87
  }
66
88
  }
@@ -1,14 +1,16 @@
1
1
  /**
2
+ *
2
3
  * @Project: @cldmv/node-android-tv-remote
3
4
  * @Filename: /scripts/postinstall.mjs
4
- * @Date: 2025-10-15 10:19:05 -07:00 (1760548745)
5
- * @Author: Nate Hyson <CLDMV>
5
+ * @Date: 2025-10-15T10:19:05-07:00 (1760548745)
6
+ * @Author: Nate Corcoran <CLDMV>
6
7
  * @Email: <Shinrai@users.noreply.github.com>
7
8
  * -----
8
- * @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
9
- * @Last modified time: 2025-10-16 06:45:20 -07:00 (1760622320)
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-10-02T12:16:14-07:00 (1790968574)
10
11
  * -----
11
- * @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
12
14
  */
13
15
 
14
16
  /**
@@ -21,7 +23,7 @@ function hasAdb() {
21
23
  try {
22
24
  execSync("adb version", { stdio: "ignore" });
23
25
  return true;
24
- } catch (e) {
26
+ } catch (_) {
25
27
  return false;
26
28
  }
27
29
  }
@@ -1,15 +1,18 @@
1
1
  /**
2
+ *
2
3
  * @Project: @cldmv/node-android-tv-remote
3
4
  * @Filename: /scripts/setup-device.mjs
4
- * @Date: 2025-10-15 10:19:05 -07:00 (1760548745)
5
- * @Author: Nate Hyson <CLDMV>
5
+ * @Date: 2025-10-15T10:19:05-07:00 (1760548745)
6
+ * @Author: Nate Corcoran <CLDMV>
6
7
  * @Email: <Shinrai@users.noreply.github.com>
7
8
  * -----
8
- * @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
9
- * @Last modified time: 2025-10-16 06:45:06 -07:00 (1760622306)
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-10-02T12:16:14-07:00 (1790968574)
10
11
  * -----
11
- * @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
12
14
  */
15
+
13
16
  import readline from "readline";
14
17
  import AndroidTVSetup from "../src/lib/adb/setup.mjs";
15
18
 
@@ -1,14 +1,16 @@
1
1
  /**
2
+ *
2
3
  * @Project: @cldmv/node-android-tv-remote
3
4
  * @Filename: /scripts/wake-tv.mjs
4
- * @Date: 2025-10-15 20:44:49 -07:00 (1760586289)
5
- * @Author: Nate Hyson <CLDMV>
5
+ * @Date: 2025-10-15T20:44:49-07:00 (1760586289)
6
+ * @Author: Nate Corcoran <CLDMV>
6
7
  * @Email: <Shinrai@users.noreply.github.com>
7
8
  * -----
8
- * @Last modified by: Nate Hyson <CLDMV> (Shinrai@users.noreply.github.com)
9
- * @Last modified time: 2025-10-15 20:46:13 -07:00 (1760586373)
9
+ * @Last modified by: Nate Corcoran <CLDMV> (Shinrai@users.noreply.github.com)
10
+ * @Last modified time: 2026-10-02T12:16:14-07:00 (1790968574)
10
11
  * -----
11
- * @Copyright: Copyright (c) 2013-2025 Catalyzed Motivation Inc. All rights reserved.
12
+ * @Copyright: Copyright (c) 2013-2026 Catalyzed Motivation Inc. All rights reserved.
13
+ *
12
14
  */
13
15
 
14
16
  /**