Fix: align the esbuild license banner with the repo's canonical Apache-2.0 header - #670
Open
AmaadMartin wants to merge 2 commits into
Open
Fix: align the esbuild license banner with the repo's canonical Apache-2.0 header#670AmaadMartin wants to merge 2 commits into
AmaadMartin wants to merge 2 commits into
Conversation
added 2 commits
August 5, 2026 01:55
The `licenseHeaderText` banner in all three build scripts indented its comment body with two spaces, so the header at the top of every published artifact did not match the shape `scripts/check_license.sh` enforces on sources. Re-indent the literals to one space and pin the shape with a test.
Git checks the build scripts out with CRLF on Windows, so the LF-exact pattern failed on the windows-latest CI runner. Normalize the line terminator before matching; the assertion is about the indentation.
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.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
N/A
Problem:
core/build.js,integrations/build.jsanddev/build.jseachdefine a
licenseHeaderTextbanner that indents its comment body with twospaces. Every other
.ts/.jsfile in the repo uses one space, and so does theperl pattern in
scripts/check_license.sh. esbuild writes that banner verbatimas the first bytes of every published artifact, so the header at the top of
dist/does not match the shape the repo enforces on its own sources.Solution: Re-indent the four interior lines of the literal to one space in
all three scripts. The three scripts stay standalone and dependency-free, so I
fixed the literals in place instead of extracting a shared constant — a
cross-workspace import to deduplicate a five-line string is a worse trade. The
banner is a comment, so no runtime behaviour changes.
Scope note:
scripts/check_license.shis unanchored, so it passes today. Theaccurate claim is that the pattern anchored to the start of the file fails on
every artifact before this change and passes after it. Missing banners on
non-bundled ESM and web output are a separate defect and are out of scope here.
Collision check: I searched the 569 open PRs on this fork for adjacent work.
PRs #553, #555, #552 and #430 touch
core/build.jsandintegrations/build.js,but all of them edit the banner assembly logic, not the
licenseHeaderTextliteral. #482 touches
dev/build.jsbut only removes a@ts-ignore. No PRlands this change, so I branched from
main.Testing Plan
Unit Tests:
New test:
tests/integration/build_scripts/license_header_test.ts. It readseach of the three build scripts, extracts the
licenseHeaderTextliteral, andasserts the body matches the anchored, whitespace-exact equivalent of the
pattern in
scripts/check_license.sh.Mutation proof. I restored the two-space indent in
core/build.jsonly andre-ran the test. It fails and names that file:
I also proved the missing-literal path. Renaming the constant in
dev/build.jsfails that case with
dev/build.js does not define licenseHeaderText. Bothscripts were restored afterwards.
The first push failed on
windows-latestonly. Git checks the build scriptsout with CRLF there, so the LF-exact pattern did not match. The test now
normalizes the line terminator before matching. I reproduced the failure
locally by converting
core/build.jsto CRLF, confirmed the fix passes, andre-ran the mutation proof to confirm the normalization does not mask a
two-space indent.
Coverage:
vitest.config.tsrestrictscoverage.includetocore/src,dev/srcandintegrations/src, so the build scripts record nocoverage and the thresholds do not move. The test exercises all three literals.
Manual End-to-End (E2E) Tests:
Applying the
check_license.shpattern anchored with\Ato the bundledartifacts, before and after the fix:
bash scripts/check_license.shstill exits 0(
All files have the correct license header).Checklist