@jfrog-boost/boost 0.11.0 → 0.11.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": "@jfrog-boost/boost",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "description": "Boost CLI — compress agent/CI tool output (prebuilt binary wrapper)",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://boost.jfrog.com",
@@ -26,11 +26,11 @@
26
26
  "node": ">=18"
27
27
  },
28
28
  "optionalDependencies": {
29
- "@jfrog-boost/boost-darwin-arm64": "0.11.0",
30
- "@jfrog-boost/boost-darwin-x64": "0.11.0",
31
- "@jfrog-boost/boost-linux-arm64": "0.11.0",
32
- "@jfrog-boost/boost-linux-x64": "0.11.0",
33
- "@jfrog-boost/boost-win32-x64": "0.11.0"
29
+ "@jfrog-boost/boost-darwin-arm64": "0.11.2",
30
+ "@jfrog-boost/boost-darwin-x64": "0.11.2",
31
+ "@jfrog-boost/boost-linux-arm64": "0.11.2",
32
+ "@jfrog-boost/boost-linux-x64": "0.11.2",
33
+ "@jfrog-boost/boost-win32-x64": "0.11.2"
34
34
  },
35
35
  "keywords": [
36
36
  "boost",
@@ -5,15 +5,23 @@
5
5
  * After a global `npm i -g @jfrog-boost/boost`, run `boost init` so the terms
6
6
  * prompt and agent integrations match the shell installer path.
7
7
  *
8
+ * npm lifecycle scripts never get a TTY on stdin/stdout/stderr (even when the
9
+ * parent `npm` is interactive). Skipping on `process.stderr.isTTY` therefore
10
+ * skipped init for every real `npm i -g`. Instead we attach stdio to the
11
+ * controlling terminal (`/dev/tty`, or CONIN$/CONOUT$ on Windows) — same idea
12
+ * as `install.sh`'s `boost init </dev/tty` — so Go's `isTTY()` and prompts work.
13
+ *
8
14
  * Skips (exit 0) when:
9
15
  * - not a global install (local dependency)
10
- * - CI / non-TTY (cannot prompt)
16
+ * - CI
11
17
  * - BOOST_SKIP_INIT is set
18
+ * - no controlling terminal
12
19
  * - the platform binary is missing
13
20
  *
14
21
  * Never fails the npm install: init errors print a hint and exit 0.
15
22
  */
16
23
 
24
+ const fs = require('fs');
17
25
  const { spawnSync } = require('child_process');
18
26
  const { resolveBinaryPath } = require('../lib/platform');
19
27
 
@@ -28,35 +36,59 @@ function skipReason() {
28
36
  if (process.env.CI === 'true' || process.env.CI === '1') {
29
37
  return 'CI';
30
38
  }
31
- // Match boost's isTTY(): prompts need a real terminal on stderr.
32
- if (!process.stderr.isTTY) {
33
- return 'non-TTY';
34
- }
35
39
  return null;
36
40
  }
37
41
 
38
- const reason = skipReason();
39
- if (reason) {
40
- console.log(`→ Skipping boost init (${reason}). Run \`boost init\` when ready.`);
41
- process.exit(0);
42
+ /** Open the controlling terminal for child stdio, or null if none. */
43
+ function openControllingStdio() {
44
+ try {
45
+ if (process.platform === 'win32') {
46
+ return [fs.openSync('\\\\.\\CONIN$', 'r'), fs.openSync('\\\\.\\CONOUT$', 'w'), fs.openSync('\\\\.\\CONOUT$', 'w')];
47
+ }
48
+ // Separate in/out fds so the child sees a real char device on stderr
49
+ // (Go's isTTY checks stderr) while still reading prompts from the TTY.
50
+ return [fs.openSync('/dev/tty', 'r'), fs.openSync('/dev/tty', 'w'), fs.openSync('/dev/tty', 'w')];
51
+ } catch {
52
+ return null;
53
+ }
42
54
  }
43
55
 
44
- let bin;
45
- try {
46
- bin = resolveBinaryPath();
47
- } catch (err) {
48
- console.warn(`→ Skipping boost init: ${err.message || err}`);
49
- process.exit(0);
50
- }
56
+ function run() {
57
+ const reason = skipReason();
58
+ if (reason) {
59
+ console.log(`→ Skipping boost init (${reason}). Run \`boost init\` when ready.`);
60
+ process.exit(0);
61
+ }
51
62
 
52
- console.log('→ Running boost init…');
53
- const result = spawnSync(bin, ['init'], { stdio: 'inherit' });
54
- if (result.error) {
55
- console.warn(`→ boost init failed to start: ${result.error.message || result.error}`);
56
- console.warn(' Run `boost init` manually when ready.');
63
+ const stdio = openControllingStdio();
64
+ if (!stdio) {
65
+ console.log('→ Skipping boost init (no controlling TTY). Run `boost init` when ready.');
66
+ process.exit(0);
67
+ }
68
+
69
+ let bin;
70
+ try {
71
+ bin = resolveBinaryPath();
72
+ } catch (err) {
73
+ console.warn(`→ Skipping boost init: ${err.message || err}`);
74
+ process.exit(0);
75
+ }
76
+
77
+ console.log('→ Running boost init…');
78
+ const result = spawnSync(bin, ['init'], { stdio });
79
+ if (result.error) {
80
+ console.warn(`→ boost init failed to start: ${result.error.message || result.error}`);
81
+ console.warn(' Run `boost init` manually when ready.');
82
+ process.exit(0);
83
+ }
84
+ if (result.status !== 0) {
85
+ console.warn('→ boost init exited non-zero; run `boost init` manually when ready.');
86
+ }
57
87
  process.exit(0);
58
88
  }
59
- if (result.status !== 0) {
60
- console.warn('→ boost init exited non-zero; run `boost init` manually when ready.');
89
+
90
+ if (require.main === module) {
91
+ run();
61
92
  }
62
- process.exit(0);
93
+
94
+ module.exports = { skipReason, openControllingStdio };