fix(build): fix runtime bugs in build scripts#1148
Merged
Conversation
This was referenced Apr 1, 2026
- 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).
9478197 to
c5e10af
Compare
divmain
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
esbuild.cli.build.mjs:envVarReplacementPluginwas running beforeunicodeTransformPlugindespite comment saying "must run AFTER unicode transform". Swapped order.build.mjs:watchResult?.codecan be undefined whenspawnreturns null. Added null check with?? 1fallback.Promise.all->Promise.allSettledpattern inbuild.mjs,download-assets.mjs, anddownload-iocraft-binaries.mjs:Promise.allshort-circuits on first rejection, swallowing other results.Promise.allSettledwithr.status === 'rejected'properly catches all failures.createBuildRunnerinesbuild-shared.mjs: catch block never rethrew, so callers usingallSettledcould not detect failures.cli/package.json(e2e:smol,build:sea:internal:bootstrap,publish:sea).Split from #1140.
Test plan
pnpm --filter @socketsecurity/cli run buildsucceedspnpm --filter @socketsecurity/cli run build --watchhandles spawn failures gracefullyNote
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
envVarReplacementPluginruns afterunicodeTransformPlugin, and by hardening watch-mode spawn handling whenspawn()returns null.Build and download scripts now use
Promise.allSettled(andcreateBuildRunnerrethrows 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 unusedpackage.jsonscripts (publish:sea,e2e:smol,build:sea:internal:bootstrap).Written by Cursor Bugbot for commit 9478197. Configure here.