Skip to content

Commit e9ac009

Browse files
committed
fix: fix the updateNotifier export
1 parent 3797303 commit e9ac009

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/check-updates.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,18 @@ import { join } from "path"
66
// auto self update notifier
77
export async function checkUpdates() {
88
try {
9-
const { UpdateNotifier } = await import("update-notifier")
10-
const packageJsonString = await readFile(join(__dirname, "..", "package.json"), "utf8")
9+
const [un, packageJsonString] = await Promise.all([
10+
import("update-notifier"),
11+
readFile(join(__dirname, "..", "package.json"), "utf8"),
12+
])
13+
1114
const packageJson = JSON.parse(packageJsonString)
12-
new UpdateNotifier({ pkg: packageJson }).notify()
15+
16+
// the types do not match the actual export
17+
const updateNotifier = un as unknown as (typeof un)["default"]
18+
19+
updateNotifier({ pkg: packageJson }).notify()
1320
} catch (err) {
14-
warning(`Failed to check for updates: ${err}`)
21+
warning(`Failed to check for updates: ${err instanceof Error ? err.message + err.stack : err}`)
1522
}
1623
}

0 commit comments

Comments
 (0)