| 158 | } |
| 159 | |
| 160 | function resolveTag(pkgName, pkgVersion) { |
| 161 | let exact = `${pkgName}@${pkgVersion}`; |
| 162 | let check = spawn('git', ['rev-parse', '--verify', exact], {encoding: 'utf8'}); |
| 163 | if (check.status === 0) { |
| 164 | return exact; |
| 165 | } |
| 166 | // Exact tag doesn't exist (e.g. a patch bump without a new tag) — fall back to the |
| 167 | // most recent tag for this package using git's version sort. |
| 168 | let list = spawn('git', ['tag', '-l', '--sort=version:refname', `${pkgName}@*`], { |
| 169 | encoding: 'utf8' |
| 170 | }); |
| 171 | let tags = list.stdout.trim().split('\n').filter(Boolean); |
| 172 | return tags.length > 0 ? tags[tags.length - 1] : null; |
| 173 | } |
| 174 | |
| 175 | async function renderCommitLine(commit) { |
| 176 | let message = ''; |