We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 98464fc commit b1b458bCopy full SHA for b1b458b
src/utils.ts
@@ -34,7 +34,11 @@ export async function checkPkgVersion(pkg: PkgMeta) {
34
url.pathname = path.join(pkg.name, pkg.distTag || 'latest');
35
36
const resp = await fetch(url.toString());
37
- const { version } = (await resp.json()) as { version: string };
38
39
- return version;
+ if (!resp.ok) return '';
+ if (!resp.headers.get('content-type')?.includes('application/json')) return '';
40
+
41
+ const { version } = (await resp.json()) as { version?: string };
42
43
+ return version || '';
44
}
0 commit comments