@soybeanjs/changelog 0.4.4 → 0.4.5

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,7 +3,6 @@ import process from "node:process";
3
3
  import { readFile, writeFile } from "node:fs/promises";
4
4
  import dayjs from "dayjs";
5
5
  import { ofetch } from "ofetch";
6
- import { consola } from "consola";
7
6
  import semver from "semver";
8
7
  import { existsSync } from "node:fs";
9
8
  import { convert } from "convert-gitmoji";
@@ -224,18 +223,18 @@ function getHeaders(githubToken) {
224
223
  async function getResolvedAuthorLogin(github, commitHashes, email) {
225
224
  const { repo, token } = github;
226
225
  let login = "";
227
- if (!token) return login;
228
226
  try {
229
227
  login = (await ofetch(`https://api.github.com/search/users?q=${encodeURIComponent(email)}`, { headers: getHeaders(token) })).items[0].login;
230
- } catch (e) {
231
- consola.log("e: ", e);
232
- }
228
+ } catch {}
233
229
  if (login) return login;
230
+ try {
231
+ login = (await ofetch(`https://ungh.cc/users/find/${email}`))?.user?.username || "";
232
+ } catch {}
233
+ if (login) return login;
234
+ if (!token) return login;
234
235
  if (commitHashes.length) try {
235
236
  login = (await ofetch(`https://api.github.com/repos/${repo}/commits/${commitHashes[0]}`, { headers: getHeaders(token) }))?.author?.login || "";
236
- } catch (e) {
237
- consola.log("e: ", e);
238
- }
237
+ } catch {}
239
238
  return login;
240
239
  }
241
240
  async function getGitCommitsAndResolvedAuthors(commits, github, resolvedLogins) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soybeanjs/changelog",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "generate changelog form git tags and commits for github",
5
5
  "homepage": "https://github.com/soybeanjs/changelog",
6
6
  "bugs": {