forbocai 0.3.11 → 0.3.12
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 +1 -1
- package/postinstall.js +17 -11
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -26,27 +26,33 @@ Welcome to the Future of NPC Intelligence.
|
|
|
26
26
|
`;
|
|
27
27
|
|
|
28
28
|
function showBanner() {
|
|
29
|
+
const out = '\n' + msg;
|
|
29
30
|
try {
|
|
30
31
|
if (process.platform !== 'win32') {
|
|
31
32
|
const tty = fs.openSync('/dev/tty', 'w');
|
|
32
|
-
fs.writeSync(tty,
|
|
33
|
+
fs.writeSync(tty, out);
|
|
33
34
|
fs.closeSync(tty);
|
|
34
|
-
|
|
35
|
-
const out = '\n' + msg;
|
|
36
|
-
process.stdout.write(out);
|
|
37
|
-
process.stderr.write(out);
|
|
35
|
+
return;
|
|
38
36
|
}
|
|
37
|
+
// Windows: try writing to the real console so output isn't lost when npm pipes stdout/stderr
|
|
38
|
+
const winConsoles = ['CONOUT$', 'CON'];
|
|
39
|
+
for (const name of winConsoles) {
|
|
40
|
+
try {
|
|
41
|
+
const fd = fs.openSync(name, 'w');
|
|
42
|
+
fs.writeSync(fd, out);
|
|
43
|
+
fs.closeSync(fd);
|
|
44
|
+
return;
|
|
45
|
+
} catch (_) { /* try next */ }
|
|
46
|
+
}
|
|
47
|
+
// Fallback: stdout + stderr (may be piped/buffered by npm)
|
|
48
|
+
process.stdout.write(out);
|
|
49
|
+
process.stderr.write(out);
|
|
39
50
|
} catch (e) {
|
|
40
51
|
console.log(msg);
|
|
41
52
|
}
|
|
42
53
|
}
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
// Defer so our output appears after npm's summary (audit, "changed X packages", etc.).
|
|
46
|
-
setTimeout(showBanner, 150);
|
|
47
|
-
} else {
|
|
48
|
-
showBanner();
|
|
49
|
-
}
|
|
55
|
+
showBanner();
|
|
50
56
|
|
|
51
57
|
// DO NOT require the SDK here - it causes ESM/CJS compatibility issues
|
|
52
58
|
// The SDK is loaded when the user imports it in their code
|