devicerent 0.1.0 → 0.2.1
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 +52 -2
- package/bin/devicerent.mjs +16 -1
- package/bin/nodeCheck.mjs +36 -0
- package/dist/devicerent.mjs +3440 -216
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,9 +1,54 @@
|
|
|
1
1
|
# devicerent
|
|
2
2
|
|
|
3
3
|
DeviceRent from your terminal. Rent a **real** Android phone by the minute,
|
|
4
|
-
install your APK, run
|
|
4
|
+
install your APK, run a Quick test or Espresso, get a hosted Appium URL, or hand
|
|
5
5
|
the phone to DeviceyAI — everything the website does except show you the live
|
|
6
|
-
screen.
|
|
6
|
+
screen. You don't need to know how to code to use it.
|
|
7
|
+
|
|
8
|
+
## Start here
|
|
9
|
+
|
|
10
|
+
You need [Node.js](https://nodejs.org) 22 or newer (the LTS download). Then open
|
|
11
|
+
a terminal — on Windows press Start and type **Terminal**, on a Mac press ⌘-Space
|
|
12
|
+
and type **Terminal** — and type:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx devicerent
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
That opens a guided session:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
╭──────────────────────────────────────────────────╮
|
|
22
|
+
│ ✻ Welcome to DeviceRent │
|
|
23
|
+
│ Real Android phones, rented by the minute. │
|
|
24
|
+
│ you@example.com · Pro · Wallet €12.50 │
|
|
25
|
+
╰──────────────────────────────────────────────────╯
|
|
26
|
+
╭──────────────────────────────────────────────────╮
|
|
27
|
+
│ > rent a phone │
|
|
28
|
+
╰──────────────────────────────────────────────────╯
|
|
29
|
+
/ for commands · ? for help no phone rented
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then just say what you want, in plain words:
|
|
33
|
+
|
|
34
|
+
| Type | What happens |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `rent` | Pick a phone from a menu; it shows **your** price and asks before billing starts |
|
|
37
|
+
| *drag your `.apk` onto the window* | Installs it on the rented phone, then offers to open it |
|
|
38
|
+
| `test my app` | The Quick test: opens your app, taps around, reports any crash |
|
|
39
|
+
| `take a screenshot` | Saves a picture of the phone's screen to Downloads and opens it |
|
|
40
|
+
| `open Settings and turn on dark mode` | Anything else in plain words goes to DeviceyAI, which does it on the phone (it asks first, and uses AI credits) |
|
|
41
|
+
| `I'm done` | Stops the rental (it asks first; the phone is wiped afterwards) |
|
|
42
|
+
| `balance` · `topup` · `plans` | Your wallet and plan; payment opens Stripe in your browser |
|
|
43
|
+
| `/` | Every command, with a live menu — ↑↓ to choose, Enter to run |
|
|
44
|
+
|
|
45
|
+
Leaving with a phone still rented asks whether to stop it first. Arrow keys,
|
|
46
|
+
Enter and Esc work in every menu; Ctrl-C stops whatever is running.
|
|
47
|
+
|
|
48
|
+
## One command at a time (scripts and CI)
|
|
49
|
+
|
|
50
|
+
Every command also works on its own, exactly as before, and that is what
|
|
51
|
+
scripts and CI should use:
|
|
7
52
|
|
|
8
53
|
```bash
|
|
9
54
|
npm install -g devicerent # Node 22 or newer
|
|
@@ -15,6 +60,11 @@ devicerent test quick com.example.app --report quick-test.md
|
|
|
15
60
|
devicerent stop
|
|
16
61
|
```
|
|
17
62
|
|
|
63
|
+
`devicerent` with no command opens the guided session only when a person is at
|
|
64
|
+
a terminal. Piped, with `--json`, under `CI`, or with
|
|
65
|
+
`DEVICERENT_NO_INTERACTIVE=1`, it prints the help text instead, and every
|
|
66
|
+
command's output and exit code are unchanged.
|
|
67
|
+
|
|
18
68
|
## Signing in
|
|
19
69
|
|
|
20
70
|
`devicerent login` opens `devicerent.net` in your browser and asks you to
|
package/bin/devicerent.mjs
CHANGED
|
@@ -2,4 +2,19 @@
|
|
|
2
2
|
// The published entry point. Everything lives in the bundle `npm run build`
|
|
3
3
|
// writes to dist/ — the CLI imports the web app's own device and DeviceyAI
|
|
4
4
|
// modules from src/lib, so it cannot run from source without the bundler.
|
|
5
|
-
|
|
5
|
+
//
|
|
6
|
+
// The Node version is checked FIRST, and the bundle loaded with a dynamic
|
|
7
|
+
// import (a static one would be hoisted above the check): on an old Node the
|
|
8
|
+
// bundle dies with an error nobody can act on, and the people this tool is
|
|
9
|
+
// for are told what to install instead.
|
|
10
|
+
import { loadFailedMessage, nodeTooOld, tooOldMessage } from "./nodeCheck.mjs";
|
|
11
|
+
|
|
12
|
+
if (nodeTooOld(process.version)) {
|
|
13
|
+
process.stderr.write(tooOldMessage(process.version));
|
|
14
|
+
process.exitCode = 1;
|
|
15
|
+
} else {
|
|
16
|
+
import("../dist/devicerent.mjs").catch((err) => {
|
|
17
|
+
process.stderr.write(loadFailedMessage(err));
|
|
18
|
+
process.exitCode = 1;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Kept to syntax every Node from 12 on can parse: this file has to run on the
|
|
2
|
+
// old Node it is warning about.
|
|
3
|
+
|
|
4
|
+
export var MIN_NODE_MAJOR = 22;
|
|
5
|
+
|
|
6
|
+
/** True when `version` ("v20.11.1" or "20.11.1") is older than we support. */
|
|
7
|
+
export function nodeTooOld(version) {
|
|
8
|
+
var major = Number(String(version).replace(/^v/, "").split(".")[0]);
|
|
9
|
+
return !(major >= MIN_NODE_MAJOR);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function tooOldMessage(version) {
|
|
13
|
+
return (
|
|
14
|
+
"DeviceRent needs Node.js " +
|
|
15
|
+
MIN_NODE_MAJOR +
|
|
16
|
+
" or newer, and this computer has " +
|
|
17
|
+
version +
|
|
18
|
+
".\n" +
|
|
19
|
+
"Install the LTS version from https://nodejs.org, open a new terminal, then run: npx devicerent\n"
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The bundle itself failed to load: a file missing from a broken install, or
|
|
25
|
+
* a dependency whose download did not finish. One sentence and what to do,
|
|
26
|
+
* not a stack trace.
|
|
27
|
+
*/
|
|
28
|
+
export function loadFailedMessage(err) {
|
|
29
|
+
var first = String((err && err.message) || err).split("\n")[0];
|
|
30
|
+
return (
|
|
31
|
+
"DeviceRent could not start: " +
|
|
32
|
+
first +
|
|
33
|
+
"\n" +
|
|
34
|
+
"Reinstall it and try again: npx devicerent@latest (or, if you installed it: npm install -g devicerent@latest)\n"
|
|
35
|
+
);
|
|
36
|
+
}
|