@soybeanjs/changelog 0.0.1 → 0.0.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.
package/dist/index.cjs CHANGED
@@ -236,11 +236,11 @@ async function getGitCommitsAndResolvedAuthors(commits, github, resolvedLogins)
236
236
  const map = /* @__PURE__ */ new Map();
237
237
  for await (const commit of commits) {
238
238
  const resolvedAuthors = [];
239
- for await (const [index, author] of Object.entries(commit.authors)) {
239
+ for await (const [index, author] of commit.authors.entries()) {
240
240
  const { email, name } = author;
241
241
  if (email && name) {
242
242
  const commitHashes = [];
243
- if (index === "0") {
243
+ if (index === 0) {
244
244
  commitHashes.push(commit.shortHash);
245
245
  }
246
246
  const resolvedAuthor = {
@@ -298,7 +298,7 @@ function createDefaultOptions() {
298
298
  to: "",
299
299
  tags: [],
300
300
  tagDateMap: /* @__PURE__ */ new Map(),
301
- capitalize: true,
301
+ capitalize: false,
302
302
  emoji: true,
303
303
  titles: {
304
304
  breakingChanges: "\u{1F6A8} Breaking Changes"
@@ -434,10 +434,10 @@ ${unloginLine}`;
434
434
  function generateMarkdown(params) {
435
435
  const { commits, options, showTitle, contributors } = params;
436
436
  const lines = [];
437
- const url = `https://github.com/${options.github.repo}/compare/${options.from}...${options.to}`;
437
+ const isNewVersion = !VERSION_REG.test(options.to);
438
+ const version = isNewVersion ? options.newVersion : options.to;
439
+ const url = `https://github.com/${options.github.repo}/compare/${options.from}...${version}`;
438
440
  if (showTitle) {
439
- const isNewVersion = !VERSION_REG.test(options.to);
440
- const version = isNewVersion ? options.newVersion : options.to;
441
441
  const date = isNewVersion ? dayjs__default().format("YY-MM-DD") : options.tagDateMap.get(options.to);
442
442
  let title = `## [${version}](${url})`;
443
443
  if (date) {
@@ -524,6 +524,9 @@ async function getTotalChangelogMarkdown(options, showProgress = true) {
524
524
  );
525
525
  }
526
526
  const tags = getFromToTags(opts.tags);
527
+ if (tags.length === 0) {
528
+ return getChangelogMarkdown(opts);
529
+ }
527
530
  bar?.start(tags.length, 0);
528
531
  let markdown = "";
529
532
  const resolvedLogins = /* @__PURE__ */ new Map();
package/dist/index.mjs CHANGED
@@ -229,11 +229,11 @@ async function getGitCommitsAndResolvedAuthors(commits, github, resolvedLogins)
229
229
  const map = /* @__PURE__ */ new Map();
230
230
  for await (const commit of commits) {
231
231
  const resolvedAuthors = [];
232
- for await (const [index, author] of Object.entries(commit.authors)) {
232
+ for await (const [index, author] of commit.authors.entries()) {
233
233
  const { email, name } = author;
234
234
  if (email && name) {
235
235
  const commitHashes = [];
236
- if (index === "0") {
236
+ if (index === 0) {
237
237
  commitHashes.push(commit.shortHash);
238
238
  }
239
239
  const resolvedAuthor = {
@@ -291,7 +291,7 @@ function createDefaultOptions() {
291
291
  to: "",
292
292
  tags: [],
293
293
  tagDateMap: /* @__PURE__ */ new Map(),
294
- capitalize: true,
294
+ capitalize: false,
295
295
  emoji: true,
296
296
  titles: {
297
297
  breakingChanges: "\u{1F6A8} Breaking Changes"
@@ -427,10 +427,10 @@ ${unloginLine}`;
427
427
  function generateMarkdown(params) {
428
428
  const { commits, options, showTitle, contributors } = params;
429
429
  const lines = [];
430
- const url = `https://github.com/${options.github.repo}/compare/${options.from}...${options.to}`;
430
+ const isNewVersion = !VERSION_REG.test(options.to);
431
+ const version = isNewVersion ? options.newVersion : options.to;
432
+ const url = `https://github.com/${options.github.repo}/compare/${options.from}...${version}`;
431
433
  if (showTitle) {
432
- const isNewVersion = !VERSION_REG.test(options.to);
433
- const version = isNewVersion ? options.newVersion : options.to;
434
434
  const date = isNewVersion ? dayjs().format("YY-MM-DD") : options.tagDateMap.get(options.to);
435
435
  let title = `## [${version}](${url})`;
436
436
  if (date) {
@@ -517,6 +517,9 @@ async function getTotalChangelogMarkdown(options, showProgress = true) {
517
517
  );
518
518
  }
519
519
  const tags = getFromToTags(opts.tags);
520
+ if (tags.length === 0) {
521
+ return getChangelogMarkdown(opts);
522
+ }
520
523
  bar?.start(tags.length, 0);
521
524
  let markdown = "";
522
525
  const resolvedLogins = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/changelog",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "generate changelog form git tags and commits for github",
5
5
  "author": {
6
6
  "name": "Soybean",
@@ -36,31 +36,33 @@
36
36
  "convert-gitmoji": "0.1.3",
37
37
  "dayjs": "1.11.8",
38
38
  "execa": "7.1.1",
39
- "ofetch": "1.0.1"
39
+ "ofetch": "1.1.0"
40
40
  },
41
41
  "devDependencies": {
42
- "@soybeanjs/cli": "0.5.2",
42
+ "@soybeanjs/cli": "0.6.0",
43
43
  "@types/cli-progress": "3.11.0",
44
- "@types/node": "20.2.5",
45
- "eslint": "8.41.0",
46
- "eslint-config-soybeanjs": "0.4.7",
44
+ "@types/node": "20.3.0",
45
+ "eslint": "8.42.0",
46
+ "eslint-config-soybeanjs": "0.4.9",
47
47
  "simple-git-hooks": "2.8.1",
48
48
  "tsx": "3.12.7",
49
- "typescript": "5.0.4",
49
+ "typescript": "5.1.3",
50
50
  "unbuild": "1.2.1"
51
51
  },
52
52
  "simple-git-hooks": {
53
53
  "commit-msg": "pnpm soy git-commit-verify",
54
54
  "pre-commit": "pnpm typecheck && pnpm soy lint-staged"
55
55
  },
56
- "github-token": "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",
56
+ "soybean": {
57
+ "useSoybeanToken": true
58
+ },
57
59
  "scripts": {
58
60
  "build": "pnpm typecheck && unbuild",
59
61
  "lint": "eslint . --fix",
60
- "format": "soy prettier-format",
62
+ "format": "soy prettier-write",
61
63
  "commit": "soy git-commit",
62
64
  "cleanup": "soy cleanup",
63
- "update-pkg": "soy update-pkg",
65
+ "ncu": "soy ncu",
64
66
  "publish-pkg": "pnpm -r publish --access public",
65
67
  "typecheck": "tsc --noEmit",
66
68
  "release": "soy release && pnpm build && pnpm publish-pkg"