fix(tools): format chrome-extension manifest.json after version sync - #404
Merged
Conversation
…in release script
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.
Description
Fixes the release automation added in #394: after
syncChromeExtensionManifestVersion()rewritespackages/chrome-extension/manifest.json'sversionfield viaJSON.stringify(manifest, null, 2), the file's short arrays (permissions,resources,matches) get expanded onto multiple lines, which doesn't match oxfmt's formatting (it collapses arrays that fit on one line). SincecommitVersionChanges()runs a normalgit commit, lefthook'spre-commithook runsoxfmt --checkon the staged file and fails, aborting the release commit.See the failed run: https://github.com/callstackincubator/rozenite/actions/runs/31677909005/job/94376470953
Related Issue
N/A — no existing issue for this change.
Context
Rather than hand-matching oxfmt's array-collapsing rules in the manual
JSON.stringifyoutput,syncChromeExtensionManifestVersion()now runsoxfmt --writeon the file immediately after writing it, so the staged file is already correctly formatted regardless of future oxfmt config changes.Testing
manifest.jsonand confirmed the pre-existingJSON.stringifyoutput failsoxfmt --check(arrays expand to multi-line) while the fixed code (oxfmt --writeafter writing) passes.pnpm exec oxfmt --check scripts/release/release.mjspnpm exec eslint scripts/release/release.mjs— pre-existing unrelatedno-undeferrors forconsole/Bufferconfirmed present before this change too.