unicode-animations 0.1.2 → 0.1.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unicode-animations",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Unicode spinner animations as raw frame data",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"sideEffects": false,
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsup",
|
|
23
|
-
"postinstall": "node scripts/postinstall.
|
|
23
|
+
"postinstall": "node scripts/postinstall.cjs",
|
|
24
24
|
"prepublishOnly": "npm run build"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
@@ -3,12 +3,22 @@
|
|
|
3
3
|
// Postinstall animation — showcases a few spinners side-by-side for ~1.5s
|
|
4
4
|
// Skips gracefully in CI or non-interactive environments
|
|
5
5
|
|
|
6
|
-
// npm 7+
|
|
7
|
-
//
|
|
8
|
-
|
|
6
|
+
// npm 7+ captures ALL lifecycle script stdio (stdout + stderr) and swallows
|
|
7
|
+
// output on success. The only way to reach the real terminal is /dev/tty.
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const tty = require('tty');
|
|
10
|
+
|
|
9
11
|
const ci = process.env.CI || process.env.CONTINUOUS_INTEGRATION || process.env.GITHUB_ACTIONS;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
if (ci) process.exit(0);
|
|
13
|
+
|
|
14
|
+
let out;
|
|
15
|
+
try {
|
|
16
|
+
const fd = fs.openSync('/dev/tty', 'w');
|
|
17
|
+
out = new tty.WriteStream(fd);
|
|
18
|
+
} catch {
|
|
19
|
+
// No controlling terminal (CI, Docker, piped, etc.)
|
|
20
|
+
process.exit(0);
|
|
21
|
+
}
|
|
12
22
|
|
|
13
23
|
try {
|
|
14
24
|
const DURATION = 1500;
|
|
@@ -32,7 +42,7 @@ try {
|
|
|
32
42
|
|
|
33
43
|
out.write(hide);
|
|
34
44
|
|
|
35
|
-
const cleanup = () => out.write(show);
|
|
45
|
+
const cleanup = () => { try { out.write(show); } catch {} };
|
|
36
46
|
process.on('SIGINT', () => { cleanup(); process.exit(0); });
|
|
37
47
|
|
|
38
48
|
let tick = 0;
|