release-it 19.2.1 → 19.2.3

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
@@ -408,7 +408,7 @@ class GitHub extends Release {
408
408
  async commentOnResolvedItems() {
409
409
  const { isDryRun } = this.config;
410
410
  const { host, owner, project: repo } = this.getContext('repo');
411
- const changelog = await this.getChangelog();
411
+ const changelog = this.config.getContext('changelog');
412
412
  const { comments } = this.options;
413
413
  const { submit, issue, pr } = comments ?? {};
414
414
  const context = this.getContext();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "release-it",
3
- "version": "19.2.1",
3
+ "version": "19.2.3",
4
4
  "description": "Generic CLI tool to automate versioning and package publishing-related tasks.",
5
5
  "keywords": [
6
6
  "build",
@@ -103,8 +103,6 @@
103
103
  "yargs-parser": "21.1.1"
104
104
  },
105
105
  "devDependencies": {
106
- "@eslint/compat": "1.4.1",
107
- "@eslint/eslintrc": "3.3.3",
108
106
  "@eslint/js": "9.39.2",
109
107
  "@octokit/request-error": "7.1.0",
110
108
  "@types/node": "25.0.3",
@@ -117,7 +115,7 @@
117
115
  "mock-stdio": "1.0.3",
118
116
  "prettier": "3.7.4",
119
117
  "remark-cli": "12.0.1",
120
- "remark-preset-webpro": "2.0.1",
118
+ "remark-preset-webpro": "2.1.0",
121
119
  "tar": "7.5.2",
122
120
  "typescript": "5.9.3"
123
121
  },