Skip to content

Commit 030de9d

Browse files
committedFeb 11, 2019
fix(version): Exit with an error when --github-release is combined with --no-changelog
1 parent 83c33a3 commit 030de9d

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed
 

‎commands/version/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ To authenticate with GitHub, the following environment variables can be defined.
174174
- `GHE_API_URL` - When using GitHub Enterprise, an absolute URL to the API.
175175
- `GHE_VERSION` - When using GitHub Enterprise, the currently installed GHE version. [Supports the following versions](https://github.com/octokit/plugin-enterprise-rest.js).
176176

177+
> NOTE: When using this option, you cannot pass [`--no-changelog`](#--no-changelog).
178+
177179
### `--ignore-changes`
178180

179181
Ignore changes in files matched by glob(s) when detecting changed packages.
@@ -252,6 +254,8 @@ lerna version --conventional-commits --no-changelog
252254

253255
When using `conventional-commits`, do not generate any `CHANGELOG.md` files.
254256

257+
> NOTE: When using this option, you cannot pass [`--github-release`](#--github-release).
258+
255259
### `--no-commit-hooks`
256260

257261
By default, `lerna version` will allow git commit hooks to run when committing version changes.

‎commands/version/__tests__/version-github-release.test.js

+13
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ test("--github-release throws an error if --conventional-commits is not passed",
4040
expect.hasAssertions();
4141
});
4242

43+
test("--github-release throws an error if --no-changelog also passed", async () => {
44+
const cwd = await initFixture("independent");
45+
46+
try {
47+
await lernaVersion(cwd)("--github-release", "--conventional-commits", "--no-changelog");
48+
} catch (err) {
49+
expect(err.message).toBe("To create a Github Release, you cannot pass --no-changelog");
50+
expect(client.repos.createRelease).not.toHaveBeenCalled();
51+
}
52+
53+
expect.hasAssertions();
54+
});
55+
4356
test("--github-release marks a version as a pre-release if it contains a valid part", async () => {
4457
const cwd = await initFixture("normal");
4558

‎commands/version/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ class VersionCommand extends Command {
7474
);
7575
}
7676

77+
if (this.createReleases && this.options.changelog === false) {
78+
throw new ValidationError("ERELEASE", "To create a Github Release, you cannot pass --no-changelog");
79+
}
80+
7781
this.gitOpts = {
7882
amend,
7983
commitHooks,

0 commit comments

Comments
 (0)
Please sign in to comment.