release-it 19.2.1 → 19.2.2

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.
@@ -32,16 +32,26 @@ class GitBase extends Plugin {
32
32
  return latestTag ? latestTag.replace(prefix, '').replace(/^v/, '') : null;
33
33
  }
34
34
 
35
+ async getCommitsSinceLatestTag(commitsPath = '') {
36
+ const latestTagName = await this.getLatestTagName();
37
+ const ref = latestTagName ? `${latestTagName}..HEAD` : 'HEAD';
38
+ return this.exec(`git rev-list ${ref} --count ${commitsPath ? `-- ${commitsPath}` : ''}`, { options }).then(Number);
39
+ }
40
+
35
41
  async getChangelog() {
36
42
  const { snapshot } = this.config.getContext();
37
43
  const { latestTag, secondLatestTag } = this.config.getContext();
38
44
  const context = { latestTag, from: latestTag, to: 'HEAD' };
39
- const { changelog } = this.options;
45
+ const { changelog, commit } = this.options;
40
46
  if (!changelog) return null;
41
47
 
42
48
  if (latestTag && !this.config.isIncrement) {
43
- context.from = secondLatestTag;
44
- context.to = `${latestTag}^1`;
49
+ if ((await this.getCommitsSinceLatestTag()) === 0) {
50
+ context.from = secondLatestTag;
51
+ context.to = `${latestTag}^1`;
52
+ } else if (commit === false) {
53
+ context.to = 'HEAD^1';
54
+ }
45
55
  }
46
56
 
47
57
  // For now, snapshots do not get a changelog, as it often goes haywire (easy to add to release manually)
@@ -130,12 +130,6 @@ class Git extends GitBase {
130
130
  );
131
131
  }
132
132
 
133
- async getCommitsSinceLatestTag(commitsPath = '') {
134
- const latestTagName = await this.getLatestTagName();
135
- const ref = latestTagName ? `${latestTagName}..HEAD` : 'HEAD';
136
- return this.exec(`git rev-list ${ref} --count ${commitsPath ? `-- ${commitsPath}` : ''}`, { options }).then(Number);
137
- }
138
-
139
133
  async getUpstreamArgs(pushRepo) {
140
134
  if (pushRepo && !this.isRemoteName(pushRepo)) {
141
135
  // Use (only) `pushRepo` if it's configured and looks like a url
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-it",
3
- "version": "19.2.1",
3
+ "version": "19.2.2",
4
4
  "description": "Generic CLI tool to automate versioning and package publishing-related tasks.",
5
5
  "keywords": [
6
6
  "build",