unicode-animations 0.1.2 → 0.1.3

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.2",
3
+ "version": "0.1.3",
4
4
  "description": "Unicode spinner animations as raw frame data",
5
5
  "type": "module",
6
6
  "exports": {
@@ -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+ pipes lifecycle script stdio, so isTTY is always false.
7
- // Use stderr (usually still connected to terminal) for the animation.
8
- // Skip in CI or when there's genuinely no terminal.
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
- const out = process.stderr.isTTY ? process.stderr : process.stdout.isTTY ? process.stdout : null;
11
- if (ci || !out) process.exit(0);
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;