Skip to content

Commit 78ba6f7

Browse files
committed
..
1 parent b93bf44 commit 78ba6f7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

server/utils/changelog/detectChangelog.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type {
66
import type { FetchError } from 'ofetch'
77
import type { ExtendedPackageJson } from '~~/shared/utils/package-analysis'
88
import { type RepoRef, parseRepoUrl } from '~~/shared/utils/git-providers'
9-
import { type NuxtError, createError, isNuxtError } from 'nuxt/app'
109
import { ERROR_CHANGELOG_NOT_FOUND, ERROR_UNGH_API_KEY_EXHAUSTED } from '~~/shared/utils/constants'
1110
import { GithubReleaseSchama } from '~~/shared/schemas/changelog/release'
1211
import { resolveURL } from 'ufo'
@@ -28,7 +27,7 @@ export async function detectChangelog(pkg: ExtendedPackageJson) {
2827
}
2928

3029
const releases = await checkReleases(repoRef, pkg.repository.directory)
31-
if (releases && !isNuxtError(releases)) {
30+
if (releases && !isError(releases)) {
3231
return releases
3332
}
3433

@@ -37,7 +36,7 @@ export async function detectChangelog(pkg: ExtendedPackageJson) {
3736
return changelog
3837
}
3938

40-
if (isNuxtError(releases)) {
39+
if (isError(releases)) {
4140
throw releases
4241
}
4342

@@ -54,7 +53,7 @@ export async function detectChangelog(pkg: ExtendedPackageJson) {
5453
async function checkReleases(
5554
ref: RepoRef,
5655
directory?: string,
57-
): Promise<ChangelogInfo | false | NuxtError> {
56+
): Promise<ChangelogInfo | false | Error> {
5857
switch (ref.provider) {
5958
case 'github': {
6059
return checkLatestGithubRelease(ref, directory)
@@ -72,7 +71,7 @@ const ROOT_ONLY_REGEX = /^\/[^/]+$/
7271
function checkLatestGithubRelease(
7372
ref: RepoRef,
7473
directory?: string,
75-
): Promise<ChangelogInfo | false | NuxtError> {
74+
): Promise<ChangelogInfo | false | Error> {
7675
return $fetch(`https://ungh.cc/repos/${ref.owner}/${ref.repo}/releases/latest`)
7776
.then(r => {
7877
const { release } = v.parse(v.object({ release: GithubReleaseSchama }), r)

0 commit comments

Comments
 (0)