githublogen 0.0.4 → 0.1.0
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/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +7 -10
- package/dist/index.mjs +7 -10
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -13,7 +13,7 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
13
13
|
const fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
14
14
|
const cac__default = /*#__PURE__*/_interopDefaultCompat(cac);
|
|
15
15
|
|
|
16
|
-
const version = "0.0
|
|
16
|
+
const version = "0.1.0";
|
|
17
17
|
|
|
18
18
|
const cli = cac__default("githublogen");
|
|
19
19
|
cli.version(version).option("-t, --token <path>", "GitHub Token").option("--from <ref>", "From tag").option("--to <ref>", "To tag").option("--github <path>", "GitHub Repository, e.g. soybeanjs/githublogen").option("--name <name>", "Name of the release").option("--contributors", "Show contributors section").option("--prerelease", "Mark release as prerelease").option("-d, --draft", "Mark release as draft").option("--output <path>", "Output to file instead of sending to GitHub").option("--capitalize", "Should capitalize for each comment message").option("--emoji", "Use emojis in section titles", { default: true }).option("--group", "Nest commit messages under their scopes").option("--dry", "Dry run").help();
|
package/dist/cli.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { generate, hasTagOnGitHub, isRepoShallow, sendRelease } from './index.mj
|
|
|
6
6
|
import 'ohmyfetch';
|
|
7
7
|
import 'convert-gitmoji';
|
|
8
8
|
|
|
9
|
-
const version = "0.0
|
|
9
|
+
const version = "0.1.0";
|
|
10
10
|
|
|
11
11
|
const cli = cac("githublogen");
|
|
12
12
|
cli.version(version).option("-t, --token <path>", "GitHub Token").option("--from <ref>", "From tag").option("--to <ref>", "To tag").option("--github <path>", "GitHub Repository, e.g. soybeanjs/githublogen").option("--name <name>", "Name of the release").option("--contributors", "Show contributors section").option("--prerelease", "Mark release as prerelease").option("-d, --draft", "Mark release as draft").option("--output <path>", "Output to file instead of sending to GitHub").option("--capitalize", "Should capitalize for each comment message").option("--emoji", "Use emojis in section titles", { default: true }).option("--group", "Nest commit messages under their scopes").option("--dry", "Dry run").help();
|
package/dist/index.cjs
CHANGED
|
@@ -94,27 +94,25 @@ async function resolveAuthorInfo(options, info) {
|
|
|
94
94
|
return info;
|
|
95
95
|
if (!options.token)
|
|
96
96
|
return info;
|
|
97
|
-
const authorInfo = { ...info };
|
|
98
97
|
try {
|
|
99
98
|
const data = await ohmyfetch.$fetch(`https://api.github.com/search/users?q=${encodeURIComponent(info.email)}`, {
|
|
100
99
|
headers: getHeaders(options)
|
|
101
100
|
});
|
|
102
|
-
|
|
101
|
+
info.login = data.items[0].login;
|
|
103
102
|
} catch {
|
|
104
103
|
}
|
|
105
|
-
if (
|
|
106
|
-
return
|
|
107
|
-
}
|
|
104
|
+
if (info.login)
|
|
105
|
+
return info;
|
|
108
106
|
if (info.commits.length) {
|
|
109
107
|
try {
|
|
110
108
|
const data = await ohmyfetch.$fetch(`https://api.github.com/repos/${options.github}/commits/${info.commits[0]}`, {
|
|
111
109
|
headers: getHeaders(options)
|
|
112
110
|
});
|
|
113
|
-
|
|
114
|
-
} catch {
|
|
111
|
+
info.login = data.author.login;
|
|
112
|
+
} catch (e) {
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
|
-
return
|
|
115
|
+
return info;
|
|
118
116
|
}
|
|
119
117
|
async function resolveAuthors(commits, options) {
|
|
120
118
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -411,8 +409,7 @@ async function generate(options) {
|
|
|
411
409
|
const rawCommits = await getGitDiff(resolved.from, resolved.to);
|
|
412
410
|
const commits = parseCommits(rawCommits, resolved);
|
|
413
411
|
if (resolved.contributors) {
|
|
414
|
-
|
|
415
|
-
Object.assign(resolved, authorInfo);
|
|
412
|
+
await resolveAuthors(commits, resolved);
|
|
416
413
|
}
|
|
417
414
|
const md = generateMarkdown(commits, resolved);
|
|
418
415
|
return { config: resolved, md, commits };
|
package/dist/index.mjs
CHANGED
|
@@ -92,27 +92,25 @@ async function resolveAuthorInfo(options, info) {
|
|
|
92
92
|
return info;
|
|
93
93
|
if (!options.token)
|
|
94
94
|
return info;
|
|
95
|
-
const authorInfo = { ...info };
|
|
96
95
|
try {
|
|
97
96
|
const data = await $fetch(`https://api.github.com/search/users?q=${encodeURIComponent(info.email)}`, {
|
|
98
97
|
headers: getHeaders(options)
|
|
99
98
|
});
|
|
100
|
-
|
|
99
|
+
info.login = data.items[0].login;
|
|
101
100
|
} catch {
|
|
102
101
|
}
|
|
103
|
-
if (
|
|
104
|
-
return
|
|
105
|
-
}
|
|
102
|
+
if (info.login)
|
|
103
|
+
return info;
|
|
106
104
|
if (info.commits.length) {
|
|
107
105
|
try {
|
|
108
106
|
const data = await $fetch(`https://api.github.com/repos/${options.github}/commits/${info.commits[0]}`, {
|
|
109
107
|
headers: getHeaders(options)
|
|
110
108
|
});
|
|
111
|
-
|
|
112
|
-
} catch {
|
|
109
|
+
info.login = data.author.login;
|
|
110
|
+
} catch (e) {
|
|
113
111
|
}
|
|
114
112
|
}
|
|
115
|
-
return
|
|
113
|
+
return info;
|
|
116
114
|
}
|
|
117
115
|
async function resolveAuthors(commits, options) {
|
|
118
116
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -409,8 +407,7 @@ async function generate(options) {
|
|
|
409
407
|
const rawCommits = await getGitDiff(resolved.from, resolved.to);
|
|
410
408
|
const commits = parseCommits(rawCommits, resolved);
|
|
411
409
|
if (resolved.contributors) {
|
|
412
|
-
|
|
413
|
-
Object.assign(resolved, authorInfo);
|
|
410
|
+
await resolveAuthors(commits, resolved);
|
|
414
411
|
}
|
|
415
412
|
const md = generateMarkdown(commits, resolved);
|
|
416
413
|
return { config: resolved, md, commits };
|