Add version bump script and docs#1308
Conversation
Add scripts/bump-version.mjs to validate and synchronize the version across root package.json, frontend/package.json, and frontend/src-tauri/Cargo.toml. Register a new npm script ('version:bump') and update CONTRIBUTING.md with release-management instructions and usage examples. The script enforces X.Y.Z numeric format, verifies current files before writing, prints a summary of changes, and reminds developers to run cargo check to regenerate Cargo.lock.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughAdds a Node.js CLI and npm script to bump an X.Y.Z version across root ChangesVersion Bump Automation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsStopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/bump-version.mjs (1)
1-143:⚠️ Potential issue | 🟠 Major | 🏗️ Heavy liftAdd automated tests for the version bump script’s critical paths.
This is release-critical automation, but no automated coverage is included for success path, invalid input, missing version field, and partial-failure handling.
As per coding guidelines, "Ensure that test code is automated, comprehensive, and follows testing best practices" and "Verify that all critical functionality is covered by tests."
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/bump-version.mjs` around lines 1 - 143, Add automated tests for scripts/bump-version.mjs covering the success path and failure modes: write unit/integration tests that invoke the script (e.g., via child_process.exec or by importing a testable entry function) to validate (1) successful bump updates rootPackageJsonPath/frontendPackageJsonPath/Cargo.toml and prints the summary when newVersion matches semverRegex; (2) invalid input (missing or malformed newVersion) causes the script to exit with a non-zero code and prints the appropriate error messages for newVersion/semverRegex checks; (3) missing "version" field in any of rootPackageJsonContent/frontendPackageJsonContent/cargoTomlContent triggers the corresponding error branch and exit; and (4) partial-failure/file-write errors (simulate fs.readFileSync/fs.writeFileSync throwing) cause the script to log the specific error and exit non-zero; use temp fixture files (or mock fs) and assert on file contents, exit codes, and console output for variables and symbols in the script such as newVersion, semverRegex, rootPackageJsonPath, frontendPackageJsonPath, cargoTomlPath, and the replacement behavior that produces updatedRootJsonContent/updatedFrontendJsonContent/updatedCargoTomlContent.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/bump-version.mjs`:
- Around line 111-131: The current sequential writes using fs.writeFileSync to
rootPackageJsonPath, frontendPackageJsonPath and cargoTomlPath can leave the
repo in a partially-updated state if one write fails; change the write strategy
in bump-version.mjs to perform atomic updates: write each updated*Content to a
temporary file (e.g., rootPackageJsonPath + ".tmp"), fsync/close it, then
fs.rename the temp over the target (or use atomic rename semantics) so the
replacement is atomic; if any step fails, roll back by removing any created
temps and do not rename any remaining files (or restore from backups created
before writes), and ensure errors from rename/failures are caught and cause
process.exit(1). Target symbols: updatedRootJsonContent,
updatedFrontendJsonContent, updatedCargoTomlContent, rootPackageJsonPath,
frontendPackageJsonPath, cargoTomlPath and the current try/catch write blocks.
---
Outside diff comments:
In `@scripts/bump-version.mjs`:
- Around line 1-143: Add automated tests for scripts/bump-version.mjs covering
the success path and failure modes: write unit/integration tests that invoke the
script (e.g., via child_process.exec or by importing a testable entry function)
to validate (1) successful bump updates
rootPackageJsonPath/frontendPackageJsonPath/Cargo.toml and prints the summary
when newVersion matches semverRegex; (2) invalid input (missing or malformed
newVersion) causes the script to exit with a non-zero code and prints the
appropriate error messages for newVersion/semverRegex checks; (3) missing
"version" field in any of
rootPackageJsonContent/frontendPackageJsonContent/cargoTomlContent triggers the
corresponding error branch and exit; and (4) partial-failure/file-write errors
(simulate fs.readFileSync/fs.writeFileSync throwing) cause the script to log the
specific error and exit non-zero; use temp fixture files (or mock fs) and assert
on file contents, exit codes, and console output for variables and symbols in
the script such as newVersion, semverRegex, rootPackageJsonPath,
frontendPackageJsonPath, cargoTomlPath, and the replacement behavior that
produces
updatedRootJsonContent/updatedFrontendJsonContent/updatedCargoTomlContent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 619c1396-014b-417c-a71d-93e01d3cf37b
📒 Files selected for processing (3)
CONTRIBUTING.mdpackage.jsonscripts/bump-version.mjs
Closes #1306
This pull request introduces a standardized process for managing and synchronizing version numbers across the project's main manifest files. It adds a new script to automate version bumps and updates the documentation to guide maintainers through the release process.
Release management automation:
scripts/bump-version.mjs, which validates a provided version number and updates theversionfield inpackage.json,frontend/package.json, andfrontend/src-tauri/Cargo.tomlto keep them in sync. The script checks for errors, prints a summary of changes, and reminds the user to regenerate the Cargo lock file.version:bumpin the rootpackage.jsonto run the version bump script easily from the command line.Documentation updates:
CONTRIBUTING.mdwith a new "Release Management" section, documenting the version synchronization requirement, how to use the version bump script, and additional steps for regenerating lock files.Additional Notes:
@rahulharpal1603, now, running
npm run version:bump -- 1.2.0in root directory will bump all the versions at once.AI Usage Disclosure:
Check one of the checkboxes below:
I have used the following AI models and tools: Gemini
Checklist
Summary by CodeRabbit
Documentation
New Features