@soybeanjs/changelog 0.3.16 → 0.3.17

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/dist/index.cjs CHANGED
@@ -2048,6 +2048,15 @@ function getFromToTags(tags) {
2048
2048
  });
2049
2049
  return result.reverse();
2050
2050
  }
2051
+ async function getGitMainBranchName() {
2052
+ const main = await execCommand("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
2053
+ return main;
2054
+ }
2055
+ async function getCurrentGitBranch() {
2056
+ const tag = await execCommand("git", ["tag", "--points-at", "HEAD"]);
2057
+ const main = getGitMainBranchName();
2058
+ return tag || main;
2059
+ }
2051
2060
  async function getGitHubRepo() {
2052
2061
  const url = await execCommand("git", ["config", "--get", "remote.origin.url"]);
2053
2062
  const match = url.match(/github\.com[/:]([\w\d._-]+?)\/([\w\d._-]+?)(\.git)?$/i);
@@ -2480,7 +2489,9 @@ ${md}
2480
2489
  // src/index.ts
2481
2490
  async function getChangelogMarkdown(options, showTitle = true) {
2482
2491
  const opts = await createOptions(options);
2483
- const gitCommits = await getGitCommits(opts.from, opts.to);
2492
+ const current = await getCurrentGitBranch();
2493
+ const to = opts.tags.includes(opts.to) ? opts.to : current;
2494
+ const gitCommits = await getGitCommits(opts.from, to);
2484
2495
  const resolvedLogins = /* @__PURE__ */ new Map();
2485
2496
  const { commits, contributors } = await getGitCommitsAndResolvedAuthors(gitCommits, opts.github, resolvedLogins);
2486
2497
  const markdown = generateMarkdown({ commits, options: opts, showTitle, contributors });
package/dist/index.js CHANGED
@@ -112,6 +112,15 @@ function getFromToTags(tags) {
112
112
  });
113
113
  return result.reverse();
114
114
  }
115
+ async function getGitMainBranchName() {
116
+ const main = await execCommand("git", ["rev-parse", "--abbrev-ref", "HEAD"]);
117
+ return main;
118
+ }
119
+ async function getCurrentGitBranch() {
120
+ const tag = await execCommand("git", ["tag", "--points-at", "HEAD"]);
121
+ const main = getGitMainBranchName();
122
+ return tag || main;
123
+ }
115
124
  async function getGitHubRepo() {
116
125
  const url = await execCommand("git", ["config", "--get", "remote.origin.url"]);
117
126
  const match = url.match(/github\.com[/:]([\w\d._-]+?)\/([\w\d._-]+?)(\.git)?$/i);
@@ -543,7 +552,9 @@ ${md}
543
552
  // src/index.ts
544
553
  async function getChangelogMarkdown(options, showTitle = true) {
545
554
  const opts = await createOptions(options);
546
- const gitCommits = await getGitCommits(opts.from, opts.to);
555
+ const current = await getCurrentGitBranch();
556
+ const to = opts.tags.includes(opts.to) ? opts.to : current;
557
+ const gitCommits = await getGitCommits(opts.from, to);
547
558
  const resolvedLogins = /* @__PURE__ */ new Map();
548
559
  const { commits, contributors } = await getGitCommitsAndResolvedAuthors(gitCommits, opts.github, resolvedLogins);
549
560
  const markdown = generateMarkdown({ commits, options: opts, showTitle, contributors });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@soybeanjs/changelog",
3
3
  "type": "module",
4
- "version": "0.3.16",
4
+ "version": "0.3.17",
5
5
  "description": "generate changelog form git tags and commits for github",
6
6
  "author": {
7
7
  "name": "Soybean",