catylst 1.0.11 → 1.0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/postinstall.js +10 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catylst",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "Generate customized Kotlin Multiplatform projects with an interactive wizard",
5
5
  "keywords": [
6
6
  "kotlin",
package/postinstall.js CHANGED
@@ -35,20 +35,19 @@ const bold = (s) => `\x1b[1m${s}\x1b[0m`;
35
35
  const dim = (s) => `\x1b[2m${s}\x1b[0m`;
36
36
  const purple = (s) => `\x1b[35m${s}\x1b[0m`;
37
37
 
38
- // npm v7+ pipes ALL stdout/stderr from postinstall — nothing reaches the terminal.
39
- // Writing to /dev/tty bypasses the pipe and goes directly to the user's terminal.
40
- // Falls back to stderr if /dev/tty is unavailable (CI, Windows, non-TTY shells).
41
- let tty = process.stderr;
38
+ /*
39
+ * npm v7+ pipes ALL postinstall stdout/stderr nothing reaches the terminal.
40
+ * fs.writeSync on /dev/tty bypasses the pipe synchronously; no open handles,
41
+ * no event-loop delay, process exits the moment the last write completes.
42
+ * Falls back to stderr fd (2) on CI / Windows where /dev/tty is unavailable.
43
+ */
44
+ let ttyFd = 2;
42
45
  try {
43
- // accessSync throws on CI/Windows where /dev/tty doesn't exist or isn't writable.
44
- // Only open the stream if the device is confirmed accessible.
45
46
  fs.accessSync("/dev/tty", fs.constants.W_OK);
46
- const t = fs.createWriteStream("/dev/tty");
47
- t.on("error", () => {}); // suppress errors — fallback already set above
48
- tty = t;
47
+ ttyFd = fs.openSync("/dev/tty", "w");
49
48
  } catch (_) {}
50
- const print = (s) => tty.write(s + "\n");
51
- const printRaw = (s) => tty.write(s);
49
+ const print = (s) => fs.writeSync(ttyFd, s + "\n");
50
+ const printRaw = (s) => fs.writeSync(ttyFd, s);
52
51
 
53
52
  // ── Tips & jokes shown while cloning / downloading ───────────────────────────
54
53
 
@@ -273,11 +272,4 @@ function downloadJar() {
273
272
  print(" " + dim("Or non-interactive:"));
274
273
  print(" " + dim("catylst --package com.example.app --name MyApp"));
275
274
  print("");
276
-
277
- // The /dev/tty WriteStream holds the event loop open after all output is
278
- // written, making the process appear to hang. Close it so the process exits
279
- // on its own without npm having to send SIGINT.
280
- if (tty !== process.stderr) {
281
- tty.end(() => process.exit(0));
282
- }
283
275
  })();