Commit b6f2154
authored
fix: stream custom build/publish command output and surface real failures (#118)
## Problem
During a release, `@varlock/bumpy` ran user-defined
`buildCommand`/`publishCommand` through `runAsync`, which **buffered**
all child output (nothing reached CI logs live) and, on failure, threw
an error containing only `stderr` — discarding `stdout`. When a custom
publish like `vsce publish` wrote its real error (an expired marketplace
`VSCE_PAT`) to **stdout** and exited non-zero, the actual cause was
invisible — CI showed only a generic `Command failed` wrapper plus bun's
exit notice.
This degraded every non-npm / custom publish path (vsce, ovsx, anything
bespoke), making failures un-debuggable. npm publishing has its own path
and was unaffected.
## Fix
- **New `runStreaming(cmd, opts)`** in `shell.ts` — runs via `spawn`
(`shell: true`), **tees** child stdout/stderr to the parent process live
so output appears in CI as it happens, while also capturing both
streams. On non-zero exit it rejects with `Command failed (exit code N):
<cmd>` plus the captured output.
- **`buildCommand` / `publishCommand`** in the publish pipeline now use
`runStreaming`. Internal git/npm/pack helpers (which parse captured
stdout) stay on the capturing runners, including `checkPublished`.
- **Belt-and-suspenders:** `runAsync` / `runArgsAsync` now include
`stdout` (not just `stderr`) in their thrown errors.
## Tests
New `test/utils/shell.test.ts` asserts a command writing its error to
**stdout** then exiting non-zero surfaces that text in the rejected
error (for `runStreaming`, `runAsync`, and `runArgsAsync`), plus stderr
and exit-code coverage.
- `bun run test` → **303 pass, 0 fail**
- `tsc --noEmit`, `oxlint`, `oxfmt --check` all clean
## Acceptance criteria
- [x] A failing `publishCommand` surfaces the child's actual stdout
**and** stderr
- [x] `buildCommand`/`publishCommand` output streams live, not just on
failure
- [x] Internal git/npm capture-and-parse operations unchanged (full
suite passes)
- [x] Unit test for the stdout-only failure case
- [x] Changeset / bump file added (patch → 1.14.1)
## Incident reference
https://github.com/dmno-dev/varlock/actions/runs/27600876636/job/816023529621 parent 0a9292c commit b6f2154
4 files changed
Lines changed: 99 additions & 6 deletions
File tree
- .bumpy
- packages/bumpy
- src
- core
- utils
- test/utils
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
68 | 117 | | |
69 | 118 | | |
70 | 119 | | |
| |||
102 | 151 | | |
103 | 152 | | |
104 | 153 | | |
105 | | - | |
| 154 | + | |
106 | 155 | | |
107 | 156 | | |
108 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 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 | + | |
0 commit comments