Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch has not been deployed
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
yarn format:write/yarn format:checkfail on Linux arm64 (and any platform other than macOS, Linux x64 and Windows): theclang-format@1.8.0npm package only bundles binaries for those, and its wrapper throws forlinux_arm64. The bundled binary is clang-format 13.0.1.Instead of patching the package, this adds a small script,
scripts/clang-format.mjs, that theformat:clang:*scripts now call. Theclang-formatdevDependency stays a plain^1.8.0(for its bundled binaries), and the Yarn patch is gone.The script does what the package wrapper does for our use:
--glob=<pattern>args with Node's built-infs.globSync(.nvmrcis Node 22.20), and passes the remaining args plus the matched files to the binary, exiting with its exit code. It errors if the glob matches nothing, since clang-format would otherwise read stdin.$CLANG_FORMAT_BINARY, if set,darwin_x64, as the package does),clang-formatonPATH. Anything inside anode_modulesdirectory or starting with#!is skipped, so it never picks a package manager shim and can't call itself.pip install clang-format==13.0.1or setCLANG_FORMAT_BINARY.It calls the native binary directly and never the package's JS wrapper.
scripts/is not in the npm packagefiles.CONTRIBUTING.mddocuments the lookup order.Test Plan
Dev tooling only, no app behavior change, so no device evidence. On a Linux arm64 machine with clang-format 13.0.1 at
~/.local/bin/clang-format, withulimit -ucapped to guard against recursion:yarn install --immutable: passes;yarn.lockhas no clang-format patch entryyarn format:checkandyarn format:write: pass, no diff afterwardsglobfor both the check and write patternsyarn lint,yarn test(3 suites, 90 tests),yarn build: passnpm pack --dry-run: noscripts/entriesCLANG_FORMAT_BINARY=<path> yarn format:clang:check: passes;CLANG_FORMAT_BINARY=/nonexistent: clear error, exit 1PATH: clear error with install hint, exit 1#!shim that re-invokes the script placed first onPATH: skipped, no recursion--dry-run --Werror: reports the violation, exit 1CLANG_FORMAT_BINARY: version warning printed