-
Notifications
You must be signed in to change notification settings - Fork 1
fix: add build-time version sync for manifest.json #25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Release-please's extra-files config wasn't updating manifest.json, causing Chrome Web Store uploads to fail with version mismatch. Solution: - Add scripts/sync-version.js to copy version from package.json - Run sync-version automatically before build and build:zip - Remove broken extra-files config from release-please-config.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds build-time version synchronization to ensure manifest.json always matches package.json during builds and releases. The previous approach using release-please's extra-files configuration was not updating the manifest, causing Chrome Web Store upload failures due to version mismatches.
Changes:
- Added
scripts/sync-version.jsto copy version from package.json to manifest.json - Integrated sync-version into build and build:zip npm scripts using command chaining
- Removed non-functional
extra-filesand obsoleterelease-asconfiguration from release-please-config.json
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/sync-version.js | New script that synchronizes version from package.json to manifest.json before builds |
| package.json | Adds sync-version script and integrates it into build and build:zip commands |
| release-please-config.json | Removes broken extra-files config and obsolete release-as setting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| console.log('✓ manifest.json updated'); | ||
| } | ||
|
|
||
| syncVersion(); |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The syncVersion function lacks error handling for file I/O operations and JSON parsing. In contrast, build.js (lines 72-83) wraps its main execution in a try-catch block with proper error messages and exit codes. This script should follow the same pattern to handle cases where:
- Files don't exist or can't be read
- JSON parsing fails due to malformed files
- File writing fails due to permissions or disk space
Without error handling, the script will crash with unhelpful stack traces instead of providing clear error messages to developers.
| syncVersion(); | |
| if (require.main === module) { | |
| try { | |
| syncVersion(); | |
| } catch (err) { | |
| console.error('Failed to sync version:', err && err.message ? err.message : err); | |
| if (err && err.stack) { | |
| console.error(err.stack); | |
| } | |
| process.exitCode = 1; | |
| } | |
| } |
| const pkg = JSON.parse(fs.readFileSync(PACKAGE_PATH, 'utf8')); | ||
| const manifest = JSON.parse(fs.readFileSync(MANIFEST_PATH, 'utf8')); | ||
|
|
||
| if (pkg.version === manifest.version) { | ||
| console.log(`Version already in sync: ${pkg.version}`); | ||
| return; | ||
| } | ||
|
|
||
| console.log(`Syncing version: ${manifest.version} -> ${pkg.version}`); | ||
| manifest.version = pkg.version; |
Copilot
AI
Jan 25, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The script doesn't validate that pkg.version exists before attempting to use it. If package.json is missing the version field, this will assign 'undefined' to manifest.version, corrupting the manifest file. Consider adding validation similar to build.js line 37-38 which validates the manifest version field exists.
Summary
Add build-time version sync to ensure manifest.json always matches package.json.
Problem
Release-please's
extra-filesconfig wasn't updating manifest.json during releases. This caused Chrome Web Store uploads to fail with version mismatch.Solution
scripts/sync-version.jsto copy version from package.json to manifest.jsonbuildandbuild:zipextra-filesconfig from release-please-config.jsonTest plan
npm run buildsyncs version and validates