githublogen 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/cli.cjs +2 -1
- package/dist/cli.mjs +2 -1
- package/dist/index.cjs +14 -4
- package/dist/index.mjs +14 -4
- package/package.json +2 -1
package/dist/cli.cjs
CHANGED
|
@@ -13,12 +13,13 @@ 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.0.3";
|
|
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();
|
|
20
20
|
cli.command("").action(async (args) => {
|
|
21
21
|
args.token = args.token || process.env.GITHUB_TOKEN;
|
|
22
|
+
console.log("args.token: ", args.token);
|
|
22
23
|
try {
|
|
23
24
|
console.log();
|
|
24
25
|
console.log(kolorist.dim(`${kolorist.bold("github")}logen `) + kolorist.dim(`v${version}`));
|
package/dist/cli.mjs
CHANGED
|
@@ -6,12 +6,13 @@ 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.0.3";
|
|
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();
|
|
13
13
|
cli.command("").action(async (args) => {
|
|
14
14
|
args.token = args.token || process.env.GITHUB_TOKEN;
|
|
15
|
+
console.log("args.token: ", args.token);
|
|
15
16
|
try {
|
|
16
17
|
console.log();
|
|
17
18
|
console.log(dim(`${bold("github")}logen `) + dim(`v${version}`));
|
package/dist/index.cjs
CHANGED
|
@@ -99,8 +99,11 @@ async function resolveAuthorInfo(options, info) {
|
|
|
99
99
|
const data = await ohmyfetch.$fetch(`https://api.github.com/search/users?q=${encodeURIComponent(info.email)}`, {
|
|
100
100
|
headers: getHeaders(options)
|
|
101
101
|
});
|
|
102
|
+
console.log("fetch github user: ", data);
|
|
102
103
|
authorInfo.login = data.items[0].login;
|
|
103
|
-
} catch {
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.log("error: ", error);
|
|
106
|
+
console.log("error fetch github user");
|
|
104
107
|
}
|
|
105
108
|
if (info.login)
|
|
106
109
|
return info;
|
|
@@ -109,8 +112,11 @@ async function resolveAuthorInfo(options, info) {
|
|
|
109
112
|
const data = await ohmyfetch.$fetch(`https://api.github.com/repos/${options.github}/commits/${info.commits[0]}`, {
|
|
110
113
|
headers: getHeaders(options)
|
|
111
114
|
});
|
|
115
|
+
console.log("data: ", data);
|
|
112
116
|
authorInfo.login = data.author.login;
|
|
113
117
|
} catch (e) {
|
|
118
|
+
console.log("e: ", e);
|
|
119
|
+
console.log("error fetch github commit");
|
|
114
120
|
}
|
|
115
121
|
}
|
|
116
122
|
return authorInfo;
|
|
@@ -292,8 +298,9 @@ function generateMarkdown(commits, options) {
|
|
|
292
298
|
const items = group[type] || [];
|
|
293
299
|
lines.push(...formatSection(items, options.types[type].title, options));
|
|
294
300
|
}
|
|
295
|
-
if (!lines.length)
|
|
301
|
+
if (!lines.length) {
|
|
296
302
|
lines.push("*No significant changes*");
|
|
303
|
+
}
|
|
297
304
|
const url = `https://github.com/${options.github}/compare/${options.from}...${options.to}`;
|
|
298
305
|
lines.push("", `##### [View changes on GitHub](${url})`);
|
|
299
306
|
return convertGitmoji.convert(lines.join("\n").trim(), true);
|
|
@@ -336,8 +343,10 @@ async function resolveConfig(options) {
|
|
|
336
343
|
config.to = config.to || await getCurrentGitBranch();
|
|
337
344
|
config.github = config.github || await getGitHubRepo();
|
|
338
345
|
config.prerelease = config.prerelease ?? isPrerelease(config.to);
|
|
339
|
-
if (config.to === config.from)
|
|
346
|
+
if (config.to === config.from) {
|
|
340
347
|
config.from = await getLastGitTag(-1) || await getFirstGitCommit();
|
|
348
|
+
}
|
|
349
|
+
console.log("resolveConfig => config.token: ", config.token);
|
|
341
350
|
return config;
|
|
342
351
|
}
|
|
343
352
|
|
|
@@ -394,8 +403,9 @@ async function generate(options) {
|
|
|
394
403
|
const resolved = await resolveConfig(options);
|
|
395
404
|
const rawCommits = await getGitDiff(resolved.from, resolved.to);
|
|
396
405
|
const commits = parseCommits(rawCommits, resolved);
|
|
397
|
-
if (resolved.contributors)
|
|
406
|
+
if (resolved.contributors) {
|
|
398
407
|
await resolveAuthors(commits, resolved);
|
|
408
|
+
}
|
|
399
409
|
const md = generateMarkdown(commits, resolved);
|
|
400
410
|
return { config: resolved, md, commits };
|
|
401
411
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -97,8 +97,11 @@ async function resolveAuthorInfo(options, info) {
|
|
|
97
97
|
const data = await $fetch(`https://api.github.com/search/users?q=${encodeURIComponent(info.email)}`, {
|
|
98
98
|
headers: getHeaders(options)
|
|
99
99
|
});
|
|
100
|
+
console.log("fetch github user: ", data);
|
|
100
101
|
authorInfo.login = data.items[0].login;
|
|
101
|
-
} catch {
|
|
102
|
+
} catch (error) {
|
|
103
|
+
console.log("error: ", error);
|
|
104
|
+
console.log("error fetch github user");
|
|
102
105
|
}
|
|
103
106
|
if (info.login)
|
|
104
107
|
return info;
|
|
@@ -107,8 +110,11 @@ async function resolveAuthorInfo(options, info) {
|
|
|
107
110
|
const data = await $fetch(`https://api.github.com/repos/${options.github}/commits/${info.commits[0]}`, {
|
|
108
111
|
headers: getHeaders(options)
|
|
109
112
|
});
|
|
113
|
+
console.log("data: ", data);
|
|
110
114
|
authorInfo.login = data.author.login;
|
|
111
115
|
} catch (e) {
|
|
116
|
+
console.log("e: ", e);
|
|
117
|
+
console.log("error fetch github commit");
|
|
112
118
|
}
|
|
113
119
|
}
|
|
114
120
|
return authorInfo;
|
|
@@ -290,8 +296,9 @@ function generateMarkdown(commits, options) {
|
|
|
290
296
|
const items = group[type] || [];
|
|
291
297
|
lines.push(...formatSection(items, options.types[type].title, options));
|
|
292
298
|
}
|
|
293
|
-
if (!lines.length)
|
|
299
|
+
if (!lines.length) {
|
|
294
300
|
lines.push("*No significant changes*");
|
|
301
|
+
}
|
|
295
302
|
const url = `https://github.com/${options.github}/compare/${options.from}...${options.to}`;
|
|
296
303
|
lines.push("", `##### [View changes on GitHub](${url})`);
|
|
297
304
|
return convert(lines.join("\n").trim(), true);
|
|
@@ -334,8 +341,10 @@ async function resolveConfig(options) {
|
|
|
334
341
|
config.to = config.to || await getCurrentGitBranch();
|
|
335
342
|
config.github = config.github || await getGitHubRepo();
|
|
336
343
|
config.prerelease = config.prerelease ?? isPrerelease(config.to);
|
|
337
|
-
if (config.to === config.from)
|
|
344
|
+
if (config.to === config.from) {
|
|
338
345
|
config.from = await getLastGitTag(-1) || await getFirstGitCommit();
|
|
346
|
+
}
|
|
347
|
+
console.log("resolveConfig => config.token: ", config.token);
|
|
339
348
|
return config;
|
|
340
349
|
}
|
|
341
350
|
|
|
@@ -392,8 +401,9 @@ async function generate(options) {
|
|
|
392
401
|
const resolved = await resolveConfig(options);
|
|
393
402
|
const rawCommits = await getGitDiff(resolved.from, resolved.to);
|
|
394
403
|
const commits = parseCommits(rawCommits, resolved);
|
|
395
|
-
if (resolved.contributors)
|
|
404
|
+
if (resolved.contributors) {
|
|
396
405
|
await resolveAuthors(commits, resolved);
|
|
406
|
+
}
|
|
397
407
|
const md = generateMarkdown(commits, resolved);
|
|
398
408
|
return { config: resolved, md, commits };
|
|
399
409
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "githublogen",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.3",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "SoybeanJS",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"eslint-config-soybeanjs": "0.4.6",
|
|
62
62
|
"lint-staged": "13.2.2",
|
|
63
63
|
"simple-git-hooks": "2.8.1",
|
|
64
|
+
"tsx": "^3.12.7",
|
|
64
65
|
"typescript": "5.0.4",
|
|
65
66
|
"unbuild": "1.2.1"
|
|
66
67
|
},
|