@neferbyte/cherry-release-cli 1.0.9 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/cherry-release +38 -20
  2. package/package.json +1 -1
@@ -8,29 +8,47 @@ WORKTREE_DIR="/tmp/cherry-release-test"
8
8
  WORKTREES_TO_CLEAN=()
9
9
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
10
10
 
11
- # ─── Parse --force flag ──────────────────────────────────────────────────────
11
+ # ─── Parse flags ──────────────────────────────────────────────────────────────
12
12
 
13
13
  FORCE_ALL=false
14
14
  FORCE_development=false
15
15
  FORCE_staging=false
16
16
  FORCE_production=false
17
-
18
- if [[ "$1" == "--force" ]]; then
19
- shift
20
- if [[ $# -eq 0 ]]; then
21
- FORCE_ALL=true
22
- else
23
- for arg in "$@"; do
24
- case "$arg" in
25
- development) FORCE_development=true ;;
26
- staging) FORCE_staging=true ;;
27
- production) FORCE_production=true ;;
28
- *) echo -e "\033[1;31mError:\033[0m Unknown branch '$arg'. Valid branches: development staging production" >&2; exit 1 ;;
17
+ BUMP_TYPE="patch"
18
+
19
+ while [[ $# -gt 0 ]]; do
20
+ case "$1" in
21
+ --force)
22
+ shift
23
+ if [[ $# -eq 0 || "$1" == --* ]]; then
24
+ FORCE_ALL=true
25
+ else
26
+ while [[ $# -gt 0 && "$1" != --* ]]; do
27
+ case "$1" in
28
+ development) FORCE_development=true ;;
29
+ staging) FORCE_staging=true ;;
30
+ production) FORCE_production=true ;;
31
+ *) echo -e "\033[1;31mError:\033[0m Unknown branch '$1'. Valid branches: development staging production" >&2; exit 1 ;;
32
+ esac
33
+ shift
34
+ done
35
+ fi
36
+ ;;
37
+ --bump)
38
+ shift
39
+ if [[ $# -eq 0 ]]; then
40
+ echo -e "\033[1;31mError:\033[0m --bump requires an argument (major, minor, patch)" >&2; exit 1
41
+ fi
42
+ case "$1" in
43
+ major|minor|patch) BUMP_TYPE="$1"; shift ;;
44
+ *) echo -e "\033[1;31mError:\033[0m Invalid bump type '$1'. Must be major, minor, or patch" >&2; exit 1 ;;
29
45
  esac
30
- done
31
- shift $#
32
- fi
33
- fi
46
+ ;;
47
+ *)
48
+ echo -e "\033[1;31mError:\033[0m Unknown option '$1'. Usage: cherry-release [--bump major|minor|patch] [--force [branch ...]]" >&2; exit 1
49
+ ;;
50
+ esac
51
+ done
34
52
 
35
53
  # ─── Helpers ──────────────────────────────────────────────────────────────────
36
54
 
@@ -224,7 +242,7 @@ if should_deploy "development" "$staging_count"; then
224
242
  step "Deploying to development"
225
243
  git checkout development
226
244
  git pull --ff-only
227
- "$SCRIPT_DIR/cherry-release-version" patch
245
+ "$SCRIPT_DIR/cherry-release-version" "$BUMP_TYPE"
228
246
  git push --follow-tags origin development
229
247
  echo -e " \033[1;32m✓\033[0m development released"
230
248
  else
@@ -243,7 +261,7 @@ if should_deploy "staging" "${#staging_commits[@]}"; then
243
261
  done
244
262
  git push origin staging
245
263
  fi
246
- "$SCRIPT_DIR/cherry-release-version" patch
264
+ "$SCRIPT_DIR/cherry-release-version" "$BUMP_TYPE"
247
265
  git push --follow-tags origin staging
248
266
  echo -e " \033[1;32m✓\033[0m staging released"
249
267
  else
@@ -262,7 +280,7 @@ if should_deploy "production" "${#production_commits[@]}"; then
262
280
  done
263
281
  git push origin production
264
282
  fi
265
- "$SCRIPT_DIR/cherry-release-version" patch
283
+ "$SCRIPT_DIR/cherry-release-version" "$BUMP_TYPE"
266
284
  git push --follow-tags origin production
267
285
  echo -e " \033[1;32m✓\033[0m production released"
268
286
  else
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neferbyte/cherry-release-cli",
3
- "version": "1.0.9",
3
+ "version": "1.1.0",
4
4
  "description": "Cherry-pick commits across environment branches and tag releases",
5
5
  "license": "MIT",
6
6
  "bin": {