semantic-release-next-version 0.1.2 → 0.1.4

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.
package/README.md CHANGED
@@ -90,13 +90,9 @@ jobs:
90
90
  MODE=""
91
91
  if [ "${{ github.ref }}" = "refs/heads/main" ]; then MODE="--release"; fi
92
92
  VERSION=$(npx next-version-helper $MODE)
93
- if [ -z "$VERSION" ]; then
94
- echo "semantic-release did not return a next version." >&2
95
- exit 1
96
- fi
97
93
  echo "version=$VERSION" >> "$GITHUB_OUTPUT"
98
- env:
99
- DEBUG: semantic-release-next-version,semantic-release:* # to enable debugging
94
+ # env:
95
+ # DEBUG: semantic-release-next-version,semantic-release:* # enable for debugging
100
96
  ```
101
97
 
102
98
  Now other jobs can use the version:
@@ -131,7 +127,7 @@ import { getNextVersion } from 'semantic-release-next-version'
131
127
  const version = await getNextVersion({
132
128
  cwd: process.cwd(),
133
129
  release: false,
134
- mainBranch: 'main', // override if your primary branch differs
130
+ defaultBranch: 'main', // override if your primary branch differs
135
131
  })
136
132
  console.log(version)
137
133
  ```
@@ -142,7 +138,8 @@ console.log(version)
142
138
 
143
139
  - `--release` / `-r`: return plain `x.y.z` (no preview suffix).
144
140
  - `--cwd <path>`: run against a different working directory (useful when you call from a temp folder).
145
- - `--main-branch <name>`: set the primary release branch (default: `main`).
141
+ - `--default-branch <name>`: set the primary release branch (default: `main`).
142
+ - `--main-branch <name>`: deprecated alias for `--default-branch`.
146
143
  - `--help` / `--version`
147
144
 
148
145
  ---
@@ -151,9 +148,11 @@ console.log(version)
151
148
 
152
149
  - On `main` branch with `--release` → returns `x.y.z`.
153
150
  - On any branch without `--release` → returns `x.y.z-preview-<hash>`.
154
- - If there is no new release exits with an error
151
+ - If there is no new release in preview mode returns `<currentVersion>-preview-<hash>`.
152
+ - If there is no new release with `--release` → exits with an error.
153
+ - `currentVersion` is resolved from the latest semantic version tag, then falls back to `package.json` version.
155
154
  - Uses `@semantic-release/commit-analyzer` by default (must be installed).
156
- - Main branch defaults to `main`; override with `--main-branch` or `mainBranch` in code.
155
+ - Default branch defaults to `main`; override with `--default-branch` or `defaultBranch` in code.
157
156
  - `--cwd` lets you run the CLI outside the repo root (for example after `npm pack`).
158
157
 
159
158
  ---
@@ -177,4 +176,4 @@ MIT
177
176
 
178
177
  - Enable verbose logs by setting `DEBUG=semantic-release-next-version` (optionally add `,semantic-release:*` for semantic-release internals).
179
178
  - In GitHub Actions, you can set `DEBUG` in a step that runs the CLI (the CI smoke test does this).
180
- - When running from a packed tarball or temp dir, pass `--cwd /path/to/repo` and `--main-branch <branch>` so branch detection stays correct.
179
+ - When running from a packed tarball or temp dir, pass `--cwd /path/to/repo` and `--default-branch <branch>` so branch detection stays correct.