mirror of https://github.com/aminya/setup-cpp
fix: fix the updateNotifier export
This commit is contained in:
parent
3797303356
commit
e9ac0095ac
|
@ -6,11 +6,18 @@ import { join } from "path"
|
|||
// auto self update notifier
|
||||
export async function checkUpdates() {
|
||||
try {
|
||||
const { UpdateNotifier } = await import("update-notifier")
|
||||
const packageJsonString = await readFile(join(__dirname, "..", "package.json"), "utf8")
|
||||
const [un, packageJsonString] = await Promise.all([
|
||||
import("update-notifier"),
|
||||
readFile(join(__dirname, "..", "package.json"), "utf8"),
|
||||
])
|
||||
|
||||
const packageJson = JSON.parse(packageJsonString)
|
||||
new UpdateNotifier({ pkg: packageJson }).notify()
|
||||
|
||||
// the types do not match the actual export
|
||||
const updateNotifier = un as unknown as (typeof un)["default"]
|
||||
|
||||
updateNotifier({ pkg: packageJson }).notify()
|
||||
} catch (err) {
|
||||
warning(`Failed to check for updates: ${err}`)
|
||||
warning(`Failed to check for updates: ${err instanceof Error ? err.message + err.stack : err}`)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue