embedboard-cli 0.1.0-alpha.44 → 0.1.0-alpha.46
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 +1 -1
- package/bin/install-progress.js +31 -77
- package/package.json +2 -2
package/README.md
CHANGED
package/bin/install-progress.js
CHANGED
|
@@ -1,78 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
-
import { tmpdir, arch, platform } from "node:os";
|
|
6
|
-
import { join } from "node:path";
|
|
2
|
+
import { writeFileSync } from "node:fs";
|
|
3
|
+
import { arch, platform } from "node:os";
|
|
7
4
|
|
|
8
5
|
const phase = process.argv[2] ?? "postinstall";
|
|
9
6
|
const target = `${platform()}-${arch()}`;
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
" const line = '[Embed Labs] ' + String(percent).padStart(3, ' ') + '% ' + message + '\\n';",
|
|
40
|
-
" if (process.env.EMBEDLABS_INSTALL_NO_TTY === '1') { process.stdout.write(line); return; }",
|
|
41
|
-
" try { fs.writeFileSync(process.platform === 'win32' ? '\\\\\\\\.\\\\CONOUT$' : '/dev/tty', line, { flag: 'a' }); }",
|
|
42
|
-
" catch { process.stdout.write(line); }",
|
|
43
|
-
"}",
|
|
44
|
-
"const timer = setInterval(() => {",
|
|
45
|
-
" if (fs.existsSync(stopPath) || tick >= 180) { clearInterval(timer); process.exit(0); }",
|
|
46
|
-
" const step = steps[Math.min(tick, steps.length - 1)];",
|
|
47
|
-
" writeProgress(step[0], step[1]);",
|
|
48
|
-
" tick += 1;",
|
|
49
|
-
"}, 1000);"
|
|
50
|
-
].join("\n");
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function stopWorker() {
|
|
54
|
-
writeFileSync(stopPath, "stop", "utf8");
|
|
55
|
-
try {
|
|
56
|
-
const state = JSON.parse(readFileSync(statePath, "utf8"));
|
|
57
|
-
if (typeof state.pid === "number") {
|
|
58
|
-
try {
|
|
59
|
-
process.kill(state.pid, "SIGTERM");
|
|
60
|
-
} catch {}
|
|
61
|
-
}
|
|
62
|
-
} catch {}
|
|
63
|
-
rmQuiet(statePath);
|
|
64
|
-
rmQuiet(stopPath);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async function finishProgress() {
|
|
68
|
-
for (const [percent, message] of [
|
|
69
|
-
[88, "install: verifying commands"],
|
|
70
|
-
[94, "install: finalizing installation"],
|
|
71
|
-
[100, "install: complete"]
|
|
72
|
-
]) {
|
|
73
|
-
writeProgress(percent, message);
|
|
74
|
-
await sleep(1000);
|
|
75
|
-
}
|
|
7
|
+
const steps = phase === "preinstall"
|
|
8
|
+
? [
|
|
9
|
+
[5, `install: initializing (${target})`],
|
|
10
|
+
[10, "install: checking platform"],
|
|
11
|
+
[15, "install: resolving packages"],
|
|
12
|
+
[20, "install: preparing dependency graph"],
|
|
13
|
+
[25, "install: downloading packages"],
|
|
14
|
+
[30, "install: downloading packages"],
|
|
15
|
+
[35, "install: extracting packages"],
|
|
16
|
+
[40, "install: extracting packages"],
|
|
17
|
+
[45, "install: preparing CLI"],
|
|
18
|
+
[50, "install: preparing CLI"],
|
|
19
|
+
[55, "install: preparing native bridge"],
|
|
20
|
+
[60, "install: preparing native bridge"],
|
|
21
|
+
[65, "install: preparing command links"],
|
|
22
|
+
[70, "install: preparing command links"],
|
|
23
|
+
[75, "install: waiting for npm"],
|
|
24
|
+
[80, "install: waiting for npm"],
|
|
25
|
+
[84, "install: waiting for npm"]
|
|
26
|
+
]
|
|
27
|
+
: [
|
|
28
|
+
[88, "install: verifying commands"],
|
|
29
|
+
[94, "install: finalizing installation"],
|
|
30
|
+
[100, "install: complete"]
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
for (const [percent, message] of steps) {
|
|
34
|
+
writeProgress(percent, message);
|
|
35
|
+
await sleep(1000);
|
|
76
36
|
}
|
|
77
37
|
|
|
78
38
|
function writeProgress(percent, message) {
|
|
@@ -91,9 +51,3 @@ function writeProgress(percent, message) {
|
|
|
91
51
|
function sleep(ms) {
|
|
92
52
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
93
53
|
}
|
|
94
|
-
|
|
95
|
-
function rmQuiet(filePath) {
|
|
96
|
-
try {
|
|
97
|
-
rmSync(filePath, { force: true });
|
|
98
|
-
} catch {}
|
|
99
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "embedboard-cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.46",
|
|
4
4
|
"description": "EmbedBoard CLI alias package for Embed Labs Cloud integration testing.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"README.md"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@kvell007/embed-labs-cli": "0.1.0-alpha.
|
|
19
|
+
"@kvell007/embed-labs-cli": "0.1.0-alpha.44"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public",
|