Skip to content

fix(build): fix runtime bugs in build scripts#1148

Merged
jdalton merged 1 commit intomainfrom
fix/build-runtime-bugs
Apr 2, 2026
Merged

fix(build): fix runtime bugs in build scripts#1148
jdalton merged 1 commit intomainfrom
fix/build-runtime-bugs

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton jdalton commented Apr 1, 2026

Summary

  • Fix plugin ordering in esbuild.cli.build.mjs: envVarReplacementPlugin was running before unicodeTransformPlugin despite comment saying "must run AFTER unicode transform". Swapped order.
  • Fix watch mode crash in build.mjs: watchResult?.code can be undefined when spawn returns null. Added null check with ?? 1 fallback.
  • Fix Promise.all -> Promise.allSettled pattern in build.mjs, download-assets.mjs, and download-iocraft-binaries.mjs: Promise.all short-circuits on first rejection, swallowing other results. Promise.allSettled with r.status === 'rejected' properly catches all failures.
  • Fix createBuildRunner in esbuild-shared.mjs: catch block never rethrew, so callers using allSettled could not detect failures.
  • Remove dead script entries from cli/package.json (e2e:smol, build:sea:internal:bootstrap, publish:sea).

Split from #1140.

Test plan

  • pnpm --filter @socketsecurity/cli run build succeeds
  • pnpm --filter @socketsecurity/cli run build --watch handles spawn failures gracefully
  • Asset download scripts report all failures (not just the first)

Note

Medium Risk
Touches the CLI build pipeline (esbuild config, asset downloads, post-processing), so failures could block releases; changes are localized and mostly improve error handling and ordering.

Overview
Fixes several CLI build/runtime edge cases by correcting esbuild plugin ordering so envVarReplacementPlugin runs after unicodeTransformPlugin, and by hardening watch-mode spawn handling when spawn() returns null.

Build and download scripts now use Promise.allSettled (and createBuildRunner rethrows on failure) so parallel steps reliably surface all failures instead of short-circuiting on the first rejection, with clearer error output. Also removes a few unused package.json scripts (publish:sea, e2e:smol, build:sea:internal:bootstrap).

Written by Cursor Bugbot for commit 9478197. Configure here.

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

Comment @cursor review or bugbot run to trigger another review on this PR

@jdalton jdalton mentioned this pull request Apr 1, 2026
2 tasks
- Fix plugin ordering in esbuild.cli.build.mjs: envVarReplacementPlugin
  was running before unicodeTransformPlugin despite comment saying after.
  Swap order so unicode transform runs first.
- Fix watch mode crash in build.mjs: watchResult?.code can be undefined
  when spawn returns null. Add null check and fallback ?? 1.
- Fix allSettled pattern in build.mjs post-processing: Promise.all
  swallows individual rejections. Switch to Promise.allSettled with
  proper rejection detection.
- Fix allSettled pattern in download-assets.mjs: same Promise.all issue,
  now uses Promise.allSettled with r.status === 'rejected' check.
- Fix allSettled pattern in download-iocraft-binaries.mjs: same fix.
- Fix createBuildRunner in esbuild-shared.mjs: catch block never
  rethrew, so callers using allSettled could not detect failures.
- Remove dead script entries from cli/package.json (e2e:smol,
  build:sea:internal:bootstrap, publish:sea).
@jdalton jdalton force-pushed the fix/build-runtime-bugs branch from 9478197 to c5e10af Compare April 2, 2026 00:00
@jdalton jdalton merged commit 1909e57 into main Apr 2, 2026
8 of 10 checks passed
@jdalton jdalton deleted the fix/build-runtime-bugs branch April 2, 2026 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants