Skip to content

Commit

Permalink
perf: Replace axios with fetch (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
lachlancollins authored Jan 4, 2024
1 parent 455dfdb commit 43925e8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
]
},
"dependencies": {
"axios": "^1.6.3",
"chalk": "^5.3.0",
"commander": "^11.1.0",
"current-git-branch": "^1.1.0",
Expand Down
12 changes: 9 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 5 additions & 8 deletions src/publish/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import currentGitBranch from 'current-git-branch'
import { parse as parseCommit } from '@commitlint/parse'
import log from 'git-log-parser'
import streamToArray from 'stream-to-array'
import axios from 'axios'
import { DateTime } from 'luxon'

/** @param {string} version */
Expand Down Expand Up @@ -322,19 +321,17 @@ export async function publish(options) {
commit.author.email || commit.committer.email
}`

const res = await axios.get(
'https://api.github.com/search/users',
const res = await fetch(
`https://api.github.com/search/users?q=${query}`,
{
params: {
q: query,
},
headers: {
Authorization: `token ${ghToken}`,
},
},
)

username = res.data.items[0]?.login
/** @type {any} */
const data = await res.json()
username = data.items[0]?.login
}

const scope = commit.parsed.scope
Expand Down

0 comments on commit 43925e8

Please sign in to comment.