@emasoft/svg-matrix 1.0.14 → 1.0.15
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/bin/svg-matrix.js +0 -0
- package/package.json +1 -1
- package/scripts/postinstall.js +25 -3
package/bin/svg-matrix.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
* @fileoverview Post-install welcome message for @emasoft/svg-matrix
|
|
4
4
|
* Displays a summary of CLI commands and API functions after npm install.
|
|
5
5
|
*
|
|
6
|
+
* Note: npm 7+ suppresses lifecycle script output by default.
|
|
7
|
+
* We write directly to /dev/tty on Unix to bypass this.
|
|
8
|
+
*
|
|
6
9
|
* @module scripts/postinstall
|
|
7
10
|
* @license MIT
|
|
8
11
|
*/
|
|
9
12
|
|
|
10
|
-
import { readFileSync } from 'fs';
|
|
13
|
+
import { readFileSync, createWriteStream, existsSync } from 'fs';
|
|
11
14
|
import { fileURLToPath } from 'url';
|
|
12
15
|
import { dirname, join } from 'path';
|
|
13
16
|
|
|
@@ -68,9 +71,24 @@ function pad(s, w) {
|
|
|
68
71
|
return s + ' '.repeat(Math.max(0, w - visible));
|
|
69
72
|
}
|
|
70
73
|
|
|
74
|
+
// Get a writable stream that bypasses npm's output suppression
|
|
75
|
+
function getOutputStream() {
|
|
76
|
+
// On Unix, try to write directly to /dev/tty (the terminal)
|
|
77
|
+
// This bypasses npm's stdout/stderr redirection
|
|
78
|
+
if (process.platform !== 'win32' && existsSync('/dev/tty')) {
|
|
79
|
+
try {
|
|
80
|
+
return createWriteStream('/dev/tty');
|
|
81
|
+
} catch {
|
|
82
|
+
// Fall back to stderr
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// On Windows or if /dev/tty fails, use stderr
|
|
86
|
+
return process.stderr;
|
|
87
|
+
}
|
|
88
|
+
|
|
71
89
|
function showWelcome() {
|
|
90
|
+
// Skip in CI environments - no need to clutter build logs
|
|
72
91
|
if (isCI()) process.exit(0);
|
|
73
|
-
if (!process.stdout.isTTY) process.exit(0);
|
|
74
92
|
|
|
75
93
|
const version = getVersion();
|
|
76
94
|
const c = getColors(shouldDisableColors());
|
|
@@ -84,7 +102,11 @@ function showWelcome() {
|
|
|
84
102
|
const hr = B.h.repeat(W);
|
|
85
103
|
const R = (s) => pad(s, W);
|
|
86
104
|
|
|
87
|
-
|
|
105
|
+
// Get output stream that bypasses npm suppression
|
|
106
|
+
const out = getOutputStream();
|
|
107
|
+
const write = (s) => out.write(s);
|
|
108
|
+
|
|
109
|
+
write(`
|
|
88
110
|
${c.cyan}${B.tl}${hr}${B.tr}${c.reset}
|
|
89
111
|
${c.cyan}${B.v}${c.reset}${R(` ${c.bright}@emasoft/svg-matrix${c.reset} v${version}`)}${c.cyan}${B.v}${c.reset}
|
|
90
112
|
${c.cyan}${B.v}${c.reset}${R(` ${c.dim}Arbitrary-precision SVG transforms with decimal.js${c.reset}`)}${c.cyan}${B.v}${c.reset}
|