1 unstable release
new 0.1.0 | Apr 23, 2025 |
---|
#7 in #bump
63KB
1K
SLoC
project-version
A cross-language project version bumper CLI that supports multiple project types.
Features
- Bump the version number in project files (major, minor, or patch)
- Set a specific version number directly
- Support for multiple project types:
- Node.js (package.json)
- Python (pyproject.toml)
- Rust (Cargo.toml)
- Go (version.go files)
- Ruby (Gemfile, gemspec, version.rb)
- Automatically update CHANGELOG files
- Automatically update lock files with appropriate package managers
- npm, yarn, pnpm, bun for Node.js
- uv, poetry, pipenv, pdm for Python
- cargo for Rust
- bundle for Ruby
- go mod for Go
- Git integration - commit changes and tag releases
- Dry-run mode for safer execution
Installation
From crates.io
cargo install project-version
From Source
git clone https://github.com/osteele/project-version.git
cd project-version
cargo install --path .
Usage
project-version [OPTIONS] [DIRECTORY] [COMMAND]
Commands:
bump
- Bump project version (major, minor, or patch)set
- Set project version to a specific version numberhelp
- Print help information
Arguments:
[DIRECTORY]
- Project directory to bump (defaults to current directory)
Options:
-v, --verbose
- Verbose output-n, --dry-run
- Dry run (no file modifications or git operations)-h, --help
- Print help-V, --version
- Print version
Bump Command Options:
[BUMP_TYPE]
- Type of version bump to perform: major, minor, or patch (default: patch)--no-commit
- Skip committing changes--no-tag
- Skip tagging the commit--force-tag
- Force tag creation (overwrite existing tag)
Set Command Options:
<VERSION>
- Version number to set (must be a valid semver string, can include optional 'v' prefix)--no-commit
- Skip committing changes--no-tag
- Skip tagging the commit--force-tag
- Force tag creation (overwrite existing tag)--force
- Force setting version even if it's lower than current version
Examples
# Show current version and available commands
project-version
# Bump patch version in current directory
project-version bump
# Bump minor version
project-version bump minor
# Bump major version with verbose output
project-version bump major --verbose
# Set a specific version (with or without v prefix)
project-version set 2.0.0
project-version set v2.0.0
# Set a lower version (requires --force)
project-version set 1.0.0 --force
# Dry run to see what would happen
project-version bump --dry-run
project-version set 2.0.0 --dry-run
# Bump version without creating a git commit
project-version bump --no-commit
# Bump version in a specific directory
project-version /path/to/project bump
Development Setup
This project uses just as a command runner for development tasks.
Quick Start
-
Install dependencies:
cargo build
-
Install the pre-commit tool (if not already installed):
pip install pre-commit
-
Set up the development environment:
just setup
For more detailed development instructions, see DEVELOPMENT.md.
Supported Project Files
- Node.js: Updates the version field in package.json
- Detects and runs npm, yarn, pnpm, or bun to update dependencies
- Python: Updates the version in pyproject.toml
- Detects and runs uv, poetry, pipenv, pdm, or pip to update dependencies
- Rust: Updates the version in Cargo.toml
- Runs cargo update to update dependencies
- Go: Updates version strings in version.go files
- Runs go mod tidy to update dependencies
- Ruby: Updates versions in gemspec and version.rb files
- Runs bundle install to update dependencies
Acknowledgements
project-version is built with:
- clap - Command line argument parsing
- semver - Semantic versioning
- anyhow - Error handling
- regex - Regular expressions
- toml - TOML parsing
- serde - Serialization framework
- serde_json - JSON handling
- chrono - Date and time handling
- colored - Terminal colors
- dialoguer - User prompts
License
MIT Oliver Steele
Dependencies
~8–18MB
~225K SLoC