Commit d7ec8c2
committed
fix(smol): skip CLI bootstrap for basic Node.js operations
The smol binary's bootstrap was trying to download the Socket CLI
on every invocation, including basic Node.js operations like:
- node -e '...' (eval mode)
- node --version
- node --help
- node (REPL)
This broke the smoke test during build because:
1. Smoke test runs: node -e 'console.log("✓ Binary can execute JavaScript")'
2. Bootstrap intercepts and tries to download @socketsecurity/cli@^X.X.X
3. Package doesn't exist on npm yet (unpublished version)
4. Download fails → build fails
Solution: Add shouldSkipCliBootstrap() check that detects:
- Eval mode (-e, --eval)
- Version/help flags (--version, -v, --help, -h)
- REPL mode (no arguments)
- Explicit skip (SOCKET_CLI_SKIP_BOOTSTRAP=1)
When detected, bootstrap returns 0 and lets Node.js execute normally.
This allows:
- Smoke tests to pass during build
- Using smol binary as a regular Node.js runtime
- Testing/debugging without CLI download
The CLI bootstrap still runs for actual CLI invocations.1 parent c87d8fc commit d7ec8c2
1 file changed
+46
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
15 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
16 | 58 | | |
17 | 59 | | |
18 | 60 | | |
19 | 61 | | |
20 | 62 | | |
21 | 63 | | |
22 | 64 | | |
23 | | - | |
24 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
25 | 69 | | |
26 | 70 | | |
27 | 71 | | |
| |||
0 commit comments