Version Management Guide
Version Management Guide
Section titled “Version Management Guide”The project uses automated version synchronization to ensure that all documentation files always reflect the current version from package.json
. This prevents outdated version references in documentation and maintains consistency across the entire codebase.
Available Commands
Section titled “Available Commands”Check Version Consistency
Section titled “Check Version Consistency”npm run version:check
Checks if all documentation files have the correct version number. Exits with error code 1 if any files are outdated.
Synchronize Versions
Section titled “Synchronize Versions”npm run version:sync
Updates all documentation files to match the current version in package.json
.
Bump Version
Section titled “Bump Version”npm run version:bump [major|minor|patch]
Bumps the version in package.json
and automatically updates all documentation files.
Full Release Process
Section titled “Full Release Process”npm run version:release [major|minor|patch]
Runs the complete release process:
- Ensures clean git state and main branch
- Pulls latest changes
- Runs all tests
- Bumps version
- Updates documentation
- Commits and tags
- Pushes to remote
Dry Run
Section titled “Dry Run”npm run update:version:dry
Shows which files would be updated without making any changes.
Automation
Section titled “Automation”Pre-commit Hook
Section titled “Pre-commit Hook”When committing changes to package.json
that include a version change, the pre-commit hook automatically:
- Detects the version change
- Updates all documentation files
- Stages the updated files for commit
GitHub Actions
Section titled “GitHub Actions”Version Sync Workflow
Section titled “Version Sync Workflow”- Trigger: Push to main branch with
package.json
changes - Action: Checks version consistency and creates a commit if updates are needed
Version Bump Workflow
Section titled “Version Bump Workflow”- Trigger: Manual workflow dispatch
- Action: Creates a PR with version bump and documentation updates
Release Workflow
Section titled “Release Workflow”- Trigger: Git tags matching
v*.*.*
- Action: Full release process including NPM publish and Docker image creation
How Version Updates Work
Section titled “How Version Updates Work”The version update script (scripts/update-version.mjs
) searches for version patterns in:
- All
.md
files in the project root - All documentation in
starlight-docs/src/content/docs/
- Testing documentation in
testing/
- Other markdown files throughout the project
Updated Patterns
Section titled “Updated Patterns”The script updates patterns like:
v1.1.0version: 1.1.0puppeteer-mcp v1.1.0
Including NPM package version references throughout documentation files.
Best Practices
Section titled “Best Practices”Troubleshooting
Section titled “Troubleshooting”Version Check Fails
Section titled “Version Check Fails”If npm run version:check
fails:
npm run version:syncgit add -Agit commit -m "chore: sync documentation versions"
Pre-commit Hook Issues
Section titled “Pre-commit Hook Issues”If the pre-commit hook fails:
- Check if tests are passing:
npm test
- Check TypeScript:
npm run typecheck
- Manually sync versions:
npm run version:sync
Manual Version Update
Section titled “Manual Version Update”If you need to manually set a specific version:
npm version 1.0.14 --no-git-tag-versionnpm run version:syncgit add -Agit commit -m "chore: set version to 1.0.14"
Configuration
Section titled “Configuration”Version patterns are defined in scripts/update-version.mjs
. To add new patterns or exclude files, modify the script configuration.
Integration with Release Process
Section titled “Integration with Release Process”The version management system is fully integrated with the release process:
graph LR A[Developer runs version:release] --> B[Version bumped in package.json] B --> C[Documentation updated automatically] C --> D[Changes committed and tagged] D --> E[GitHub Actions triggered] E --> F[Build, test, and publish]
Complete Flow
Section titled “Complete Flow”- Developer runs
npm run version:release minor
- Version is bumped in
package.json
- All documentation is automatically updated
- Changes are committed and tagged
- GitHub Actions takes over for building, testing, and publishing
This ensures that every release has consistent version numbers across all documentation and package files.
Command Reference
Section titled “Command Reference”Command | Description | Use Case |
---|---|---|
npm run version:check | Verify version consistency | CI validation |
npm run version:sync | Update all documentation | Fix inconsistencies |
npm run version:bump [type] | Bump version and update docs | Development releases |
npm run version:release [type] | Full release process | Production releases |
npm run update:version:dry | Preview changes | Review before applying |
Version Types
Section titled “Version Types”Type | Description | Example |
---|---|---|
patch | Bug fixes and small changes | 1.0.13 → 1.0.14 |
minor | New features, backward compatible | 1.0.13 → 1.1.0 |
major | Breaking changes | 1.0.13 → 2.0.0 |
Related Documentation
Section titled “Related Documentation”- CI/CD Pipeline for release automation
- Development Workflow for development processes
- NPM Package Deployment for publishing
Conclusion
Section titled “Conclusion”The automated version management system ensures consistency across all project documentation and package files. By integrating with the CI/CD pipeline and providing comprehensive automation, it eliminates manual version maintenance tasks while ensuring accuracy and reliability throughout the release process.