Initial Commit
This commit is contained in:
37
scripts/version-bump.sh
Executable file
37
scripts/version-bump.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if a parameter was provided
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: ./version-bump.sh [major|minor|patch]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Read current version
|
||||
current_version=$(node -p "require('./package.json').version")
|
||||
IFS='.' read -r major minor patch <<< "$current_version"
|
||||
|
||||
# Update version based on parameter
|
||||
case "$1" in
|
||||
"major")
|
||||
new_version="$((major + 1)).0.0"
|
||||
;;
|
||||
"minor")
|
||||
new_version="$major.$((minor + 1)).0"
|
||||
;;
|
||||
"patch")
|
||||
new_version="$major.$minor.$((patch + 1))"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid parameter. Use: major, minor, or patch"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Update package.json
|
||||
node -e "
|
||||
const pkg = require('./package.json');
|
||||
pkg.version = '$new_version';
|
||||
require('fs').writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
|
||||
"
|
||||
|
||||
echo "Version bumped from $current_version to $new_version"
|
||||
Reference in New Issue
Block a user