unicode-animations 0.1.1 → 0.1.2

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.1",
3
+ "version": "0.1.2",
4
4
  "description": "Unicode spinner animations as raw frame data",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,9 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // Postinstall animation — showcases a few spinners side-by-side for ~1.5s
4
- // Skips gracefully in non-TTY environments (CI, piped output)
4
+ // Skips gracefully in CI or non-interactive environments
5
5
 
6
- if (!process.stdout.isTTY) process.exit(0);
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.
9
+ 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);
7
12
 
8
13
  try {
9
14
  const DURATION = 1500;
@@ -25,9 +30,9 @@ try {
25
30
  const green = '\x1B[32m';
26
31
  const reset = '\x1B[0m';
27
32
 
28
- process.stdout.write(hide);
33
+ out.write(hide);
29
34
 
30
- const cleanup = () => process.stdout.write(show);
35
+ const cleanup = () => out.write(show);
31
36
  process.on('SIGINT', () => { cleanup(); process.exit(0); });
32
37
 
33
38
  let tick = 0;
@@ -37,13 +42,13 @@ try {
37
42
  if (Date.now() - start >= DURATION) {
38
43
  clearInterval(timer);
39
44
  const done = `${clearLine} ${green}${bold}✔${reset} ${bold}unicode-animations${reset} — 22 spinners ready\n`;
40
- process.stdout.write(done);
45
+ out.write(done);
41
46
  cleanup();
42
47
  return;
43
48
  }
44
49
 
45
50
  const chars = spinners.map(s => s.frames[tick % s.frames.length]);
46
- process.stdout.write(`${clearLine} ${chars.join(' ')}`);
51
+ out.write(`${clearLine} ${chars.join(' ')}`);
47
52
  tick++;
48
53
  }, INTERVAL);
49
54
  } catch {