Repository navigation
Conversation
The handler only covered the sourcemaps.init() stream, never the minifier, and Gulp 5 already reports failures from every stage and exits nonzero. It only duplicated the error line. Built output in dist/js is byte-identical; forced source-map and minifier failures still exit 1, standalone and inside parallel(). Closes uswds#6981
Contributor
|
✅ All commits on this PR have a verified signature. Thanks! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: uswds/uswds/.coderabbit.yaml Review profile: QUIET Plan: Advanced Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe shared ChangesJavaScript pipeline
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Refactor Suggested labels: 🚥 Pre-merge checks | ✅ 10✅ Passed checks (10 passed)
Comment |
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
Remove the redundant error handler from
jsPipeline. The handler sat on thesourcemaps.init()stream, logged the error, and emittedend. It never covered the minifier, and Gulp 5 already reports failures from every stage and exits nonzero, so the handler only duplicated the error line. Four lines deleted, no other change.Breaking change
This is not a breaking change. Successful build output is byte-identical (see validation), and no option, source map, or component behavior changes.
Related issue
Closes #6981. Follows up the investigation in #6850.
Problem and solution
A
.on("error")listener only covers the stream it is attached to, so the handler could never intercept a minifier failure. For the one stream it did cover, Gulp 5 surfaces the error to the task anyway, so the handler'sthis.emit("end")changed nothing about the exit status. The result was one error printed twice: once by the handler throughdutil.logError, once by Gulp's own reporter. Deleting the handler leaves Gulp's reporting as the single source of truth.dutilis still used elsewhere in the file, so the import stays.Validation
Node 24.21.0, matching
.nvmrc. Baseline isdevelopat adeb359.Successful output is unchanged.
gulp buildJSwas run twice ondevelopto confirm the output is deterministic, then once with this change. All six files indist/js(uswds.js,uswds.min.js,uswds.min.js.map,uswds-init.js,uswds-init.min.js,uswds-init.min.js.map) have identical sha256 before and after.Failures still surface and exit nonzero. A scratch gulpfile loads the real
tasks/javascript.jswith arequirehook that forces one stage to fail, and runscopyInitstandalone,bundleMainstandalone, and the exportedcompileJS(which isparallel(bundleMain, copyInit)). Output is redirected to a scratch directory. Two failure modes were exercised against both thedevelopfile and this change:developgulp-sourcemapsinit stream errorsgulp-uglifygiven unparseable JS (GulpUglifyError)In every case no
.min.jsis written and the task is reported as errored. The exit status is unchanged by this PR; only the duplicate log line goes away.Existing checks.
npm test: passes (128 Sass, 930 component, 71 tooling).npm run test:dist: 37 passing.eslint tasks/javascript.js: 0 errors. The one warning (unusedeslint-disabledirective on line 1) is pre-existing ondevelop. Prettier's trailing-comma diffs in this file are also pre-existing;tasks/is outsideprettier:check's scope, so they are left untouched to keep this diff minimal.Coordination with #6974
#6974 changes
jsPipeline's signature and theuglify()call a few lines below the deleted block. The two diffs do not overlap, but whichever merges second will need a trivial rebase. Either can go first.