@soybeanjs/changelog 0.0.4 → 0.0.6

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
@@ -58,6 +58,7 @@ function join(array, glue = ", ", finalGlue = " and ") {
58
58
 
59
59
  const VERSION_REG = /v\d+\.\d+\.\d+(-(beta|alpha)\.\d+)?/;
60
60
  const VERSION_REG_OF_MARKDOWN = /## \[v\d+\.\d+\.\d+(-(beta|alpha)\.\d+)?]/g;
61
+ const VERSION_WITH_RELEASE = /release\sv\d+\.\d+\.\d+(-(beta|alpha)\.\d+)?/;
61
62
 
62
63
  async function getTotalGitTags() {
63
64
  const tagStr = await execCommand("git", ["--no-pager", "tag", "-l", "--sort=creatordate"]);
@@ -130,13 +131,13 @@ async function getGitDiff(from, to = "HEAD") {
130
131
  const gitCommits = rwaGitLines.map((line) => {
131
132
  const [firstLine, ...body] = line.split("\n");
132
133
  const [message, shortHash, authorName, authorEmail] = firstLine.split("|");
133
- const gitCommmit = {
134
+ const gitCommit = {
134
135
  message,
135
136
  shortHash,
136
137
  author: { name: authorName, email: authorEmail },
137
138
  body: body.join("\n")
138
139
  };
139
- return gitCommmit;
140
+ return gitCommit;
140
141
  });
141
142
  return gitCommits;
142
143
  }
@@ -165,8 +166,8 @@ function parseGitCommit(commit) {
165
166
  references.push({ value: commit.shortHash, type: "hash" });
166
167
  description = description.replace(PullRequestRE, "").trim();
167
168
  const authors = [commit.author];
168
- const matchs = commit.body.matchAll(CoAuthoredByRegex);
169
- for (const $match of matchs) {
169
+ const matches = commit.body.matchAll(CoAuthoredByRegex);
170
+ for (const $match of matches) {
170
171
  const { name = "", email = "" } = $match.groups || {};
171
172
  const author = {
172
173
  name: name.trim(),
@@ -416,7 +417,7 @@ function getGitUserAvatar(userName) {
416
417
  }
417
418
  function createContributorLine(contributors) {
418
419
  let loginLine = "";
419
- let unloginLine = "";
420
+ let unLoginLine = "";
420
421
  contributors.forEach((contributor, index) => {
421
422
  const { name, email, login } = contributor;
422
423
  if (!login) {
@@ -424,7 +425,7 @@ function createContributorLine(contributors) {
424
425
  if (index < contributors.length - 1) {
425
426
  line += ",&nbsp;";
426
427
  }
427
- unloginLine += line;
428
+ unLoginLine += line;
428
429
  } else {
429
430
  const githubUrl = getUserGithub(login);
430
431
  const avatar = getGitUserAvatar(login);
@@ -432,10 +433,11 @@ function createContributorLine(contributors) {
432
433
  }
433
434
  });
434
435
  return `${loginLine}
435
- ${unloginLine}`;
436
+ ${unLoginLine}`;
436
437
  }
437
438
  function generateMarkdown(params) {
438
- const { commits, options, showTitle, contributors } = params;
439
+ const { options, showTitle, contributors } = params;
440
+ const commits = params.commits.filter((commit) => commit.description.match(VERSION_WITH_RELEASE) === null);
439
441
  const lines = [];
440
442
  const isNewVersion = !VERSION_REG.test(options.to);
441
443
  const version = isNewVersion ? options.newVersion : options.to;
package/dist/index.d.ts CHANGED
@@ -70,7 +70,7 @@ interface ChangelogOption {
70
70
  */
71
71
  regenerate: boolean;
72
72
  /**
73
- * version from package.json, with preffix "v"
73
+ * version from package.json, with prefix "v"
74
74
  * @description if the options "to" is not specified, the version will be used
75
75
  */
76
76
  newVersion: string;
package/dist/index.mjs CHANGED
@@ -51,6 +51,7 @@ function join(array, glue = ", ", finalGlue = " and ") {
51
51
 
52
52
  const VERSION_REG = /v\d+\.\d+\.\d+(-(beta|alpha)\.\d+)?/;
53
53
  const VERSION_REG_OF_MARKDOWN = /## \[v\d+\.\d+\.\d+(-(beta|alpha)\.\d+)?]/g;
54
+ const VERSION_WITH_RELEASE = /release\sv\d+\.\d+\.\d+(-(beta|alpha)\.\d+)?/;
54
55
 
55
56
  async function getTotalGitTags() {
56
57
  const tagStr = await execCommand("git", ["--no-pager", "tag", "-l", "--sort=creatordate"]);
@@ -123,13 +124,13 @@ async function getGitDiff(from, to = "HEAD") {
123
124
  const gitCommits = rwaGitLines.map((line) => {
124
125
  const [firstLine, ...body] = line.split("\n");
125
126
  const [message, shortHash, authorName, authorEmail] = firstLine.split("|");
126
- const gitCommmit = {
127
+ const gitCommit = {
127
128
  message,
128
129
  shortHash,
129
130
  author: { name: authorName, email: authorEmail },
130
131
  body: body.join("\n")
131
132
  };
132
- return gitCommmit;
133
+ return gitCommit;
133
134
  });
134
135
  return gitCommits;
135
136
  }
@@ -158,8 +159,8 @@ function parseGitCommit(commit) {
158
159
  references.push({ value: commit.shortHash, type: "hash" });
159
160
  description = description.replace(PullRequestRE, "").trim();
160
161
  const authors = [commit.author];
161
- const matchs = commit.body.matchAll(CoAuthoredByRegex);
162
- for (const $match of matchs) {
162
+ const matches = commit.body.matchAll(CoAuthoredByRegex);
163
+ for (const $match of matches) {
163
164
  const { name = "", email = "" } = $match.groups || {};
164
165
  const author = {
165
166
  name: name.trim(),
@@ -409,7 +410,7 @@ function getGitUserAvatar(userName) {
409
410
  }
410
411
  function createContributorLine(contributors) {
411
412
  let loginLine = "";
412
- let unloginLine = "";
413
+ let unLoginLine = "";
413
414
  contributors.forEach((contributor, index) => {
414
415
  const { name, email, login } = contributor;
415
416
  if (!login) {
@@ -417,7 +418,7 @@ function createContributorLine(contributors) {
417
418
  if (index < contributors.length - 1) {
418
419
  line += ",&nbsp;";
419
420
  }
420
- unloginLine += line;
421
+ unLoginLine += line;
421
422
  } else {
422
423
  const githubUrl = getUserGithub(login);
423
424
  const avatar = getGitUserAvatar(login);
@@ -425,10 +426,11 @@ function createContributorLine(contributors) {
425
426
  }
426
427
  });
427
428
  return `${loginLine}
428
- ${unloginLine}`;
429
+ ${unLoginLine}`;
429
430
  }
430
431
  function generateMarkdown(params) {
431
- const { commits, options, showTitle, contributors } = params;
432
+ const { options, showTitle, contributors } = params;
433
+ const commits = params.commits.filter((commit) => commit.description.match(VERSION_WITH_RELEASE) === null);
432
434
  const lines = [];
433
435
  const isNewVersion = !VERSION_REG.test(options.to);
434
436
  const version = isNewVersion ? options.newVersion : options.to;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/changelog",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "generate changelog form git tags and commits for github",
5
5
  "author": {
6
6
  "name": "Soybean",
@@ -34,19 +34,19 @@
34
34
  "dependencies": {
35
35
  "cli-progress": "3.12.0",
36
36
  "convert-gitmoji": "0.1.3",
37
- "dayjs": "1.11.8",
37
+ "dayjs": "1.11.9",
38
38
  "execa": "7.1.1",
39
- "ofetch": "1.1.0"
39
+ "ofetch": "1.1.1"
40
40
  },
41
41
  "devDependencies": {
42
- "@soybeanjs/cli": "0.6.0",
42
+ "@soybeanjs/cli": "0.6.2",
43
43
  "@types/cli-progress": "3.11.0",
44
- "@types/node": "20.3.0",
45
- "eslint": "8.42.0",
46
- "eslint-config-soybeanjs": "0.4.9",
47
- "simple-git-hooks": "2.8.1",
44
+ "@types/node": "20.4.5",
45
+ "eslint": "8.45.0",
46
+ "eslint-config-soybeanjs": "0.5.3",
47
+ "simple-git-hooks": "2.9.0",
48
48
  "tsx": "3.12.7",
49
- "typescript": "5.1.3",
49
+ "typescript": "5.1.6",
50
50
  "unbuild": "1.2.1"
51
51
  },
52
52
  "simple-git-hooks": {