embedlabs-cli 0.1.0-alpha.4 → 0.1.0-alpha.41
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 +37 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { writeFileSync } from "node:fs";
|
|
3
|
+
import { arch, platform } from "node:os";
|
|
4
|
+
|
|
5
|
+
const phase = process.argv[2] === "preinstall" ? "preinstall" : "postinstall";
|
|
6
|
+
const target = `${platform()}-${arch()}`;
|
|
7
|
+
|
|
8
|
+
const steps = phase === "preinstall"
|
|
9
|
+
? [
|
|
10
|
+
[3, `install: initializing (${target})`],
|
|
11
|
+
[8, "install: preparing npm package graph"],
|
|
12
|
+
[15, "install: resolving Embed Labs package"]
|
|
13
|
+
]
|
|
14
|
+
: [
|
|
15
|
+
[85, "install: linking CLI command"],
|
|
16
|
+
[95, "install: finalizing package"],
|
|
17
|
+
[100, "install: complete"]
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
for (const [percent, message] of steps) {
|
|
21
|
+
writeProgress(percent, message);
|
|
22
|
+
await sleep(1000);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function writeProgress(percent, message) {
|
|
26
|
+
const line = `[Embed Labs] ${String(percent).padStart(3, " ")}% ${message}\n`;
|
|
27
|
+
process.stdout.write(line);
|
|
28
|
+
if (!process.stdout.isTTY && process.env.EMBEDLABS_INSTALL_NO_TTY !== "1") {
|
|
29
|
+
try {
|
|
30
|
+
writeFileSync(platform() === "win32" ? "\\\\.\\CONOUT$" : "/dev/tty", line, { flag: "a" });
|
|
31
|
+
} catch {}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function sleep(ms) {
|
|
36
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
37
|
+
}
|
package/package.json
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "embedlabs-cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.41",
|
|
4
4
|
"description": "EmbedBoard CLI alias package for Embed Labs Cloud integration testing.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
8
|
"embedlabs-cli": "bin/embedlabs-cli.js"
|
|
9
9
|
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"preinstall": "node bin/install-progress.js preinstall",
|
|
12
|
+
"postinstall": "node bin/install-progress.js postinstall"
|
|
13
|
+
},
|
|
10
14
|
"files": [
|
|
11
15
|
"bin",
|
|
12
16
|
"README.md"
|
|
13
17
|
],
|
|
14
18
|
"dependencies": {
|
|
15
|
-
"@kvell007/embed-labs-cli": "0.1.0-alpha.
|
|
19
|
+
"@kvell007/embed-labs-cli": "0.1.0-alpha.41"
|
|
16
20
|
},
|
|
17
21
|
"publishConfig": {
|
|
18
22
|
"access": "public",
|