@rayu-dev/rayu-cli 1.1.7 → 1.1.9
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/dist/rayu.js +223 -170
- package/package.json +1 -1
- package/scripts/postinstall.cjs +20 -6
package/package.json
CHANGED
package/scripts/postinstall.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
|
+
const os = require('os');
|
|
5
|
+
const path = require('path');
|
|
4
6
|
|
|
5
7
|
const message = [
|
|
6
8
|
'',
|
|
@@ -22,13 +24,25 @@ const message = [
|
|
|
22
24
|
'',
|
|
23
25
|
].join('\n') + '\n';
|
|
24
26
|
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
+
// Write the first-run marker so the binary does not show the message again
|
|
28
|
+
function writeMarker() {
|
|
29
|
+
try {
|
|
30
|
+
const dir = path.join(os.homedir(), '.rayu');
|
|
31
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
32
|
+
fs.writeFileSync(path.join(dir, '.installed'), 'postinstall', 'utf8');
|
|
33
|
+
} catch (_) {}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// npm v7+ pipes lifecycle script stdout/stderr, so we open /dev/tty directly
|
|
37
|
+
// to write straight to the user's terminal (proven to work with PTY parent).
|
|
27
38
|
try {
|
|
28
|
-
const
|
|
29
|
-
fs.writeSync(
|
|
30
|
-
fs.closeSync(
|
|
39
|
+
const fd = fs.openSync('/dev/tty', 'w');
|
|
40
|
+
fs.writeSync(fd, message);
|
|
41
|
+
fs.closeSync(fd);
|
|
42
|
+
// Postinstall showed the message — mark as done so binary skips it
|
|
43
|
+
writeMarker();
|
|
31
44
|
} catch (_) {
|
|
32
|
-
//
|
|
45
|
+
// No controlling terminal (CI, Docker, Windows) — fall through.
|
|
46
|
+
// The binary will show the message on the user's first rayu run instead.
|
|
33
47
|
process.stdout.write(message);
|
|
34
48
|
}
|