mirror of https://github.com/aminya/setup-cpp
fix: use simple-update-notifier instead of update-notifier
This commit is contained in:
parent
f5342df15b
commit
5c3b317006
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -31,7 +31,7 @@
|
||||||
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup-cpp:arch .",
|
"build.docker.arch": "pnpm build && docker build -f ./dev/docker/arch_node.dockerfile -t setup-cpp:arch .",
|
||||||
"build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup-cpp:fedora .",
|
"build.docker.fedora": "pnpm build && docker build -f ./dev/docker/fedora_node.dockerfile -t setup-cpp:fedora .",
|
||||||
"build.docker.ubuntu": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup-cpp:ubuntu .",
|
"build.docker.ubuntu": "pnpm build && docker build -f ./dev/docker/ubuntu_node.dockerfile -t setup-cpp:ubuntu .",
|
||||||
"build.parcel": "cross-env NODE_ENV=production parcel build && babel ./dist --out-dir dist --plugins @upleveled/babel-plugin-remove-node-prefix --compact --no-babelrc --source-maps true",
|
"build.parcel": "cross-env NODE_ENV=production parcel build --detailed-report 10 && babel ./dist --out-dir dist --plugins @upleveled/babel-plugin-remove-node-prefix --compact --no-babelrc --source-maps true",
|
||||||
"bump": "ncu -u -x numerous && pnpm update",
|
"bump": "ncu -u -x numerous && pnpm update",
|
||||||
"clean": "shx rm -rf .parcel-cache dist exe",
|
"clean": "shx rm -rf .parcel-cache dist exe",
|
||||||
"copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/node12/ && shx cp ./src/msvc/msvc_matcher.json ./dist/node12/ && shx cp ./src/python/python_matcher.json ./dist/node12/ && shx cp ./src/llvm/llvm_matcher.json ./dist/node12/ && shx cp ./dist/node12/*.json ./dist/node16/",
|
"copy.matchers": "shx cp ./src/gcc/gcc_matcher.json ./dist/node12/ && shx cp ./src/msvc/msvc_matcher.json ./dist/node12/ && shx cp ./src/python/python_matcher.json ./dist/node12/ && shx cp ./src/llvm/llvm_matcher.json ./dist/node12/ && shx cp ./dist/node12/*.json ./dist/node16/",
|
||||||
|
@ -63,8 +63,6 @@
|
||||||
"update-notifier": "^5.1.0"
|
"update-notifier": "^5.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/resolve": "^1.20.2",
|
|
||||||
"resolve": "^1.22.2",
|
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/io": "^1.1.3",
|
"@actions/io": "^1.1.3",
|
||||||
|
@ -95,6 +93,7 @@
|
||||||
"exec-powershell": "workspace:*",
|
"exec-powershell": "workspace:*",
|
||||||
"execa": "^7.1.1",
|
"execa": "^7.1.1",
|
||||||
"fast-glob": "^3.2.12",
|
"fast-glob": "^3.2.12",
|
||||||
|
"find-up": "^6.3.0",
|
||||||
"gen-readme": "^1.6.0",
|
"gen-readme": "^1.6.0",
|
||||||
"is-url-online": "^1.5.0",
|
"is-url-online": "^1.5.0",
|
||||||
"jest": "^29.5.0",
|
"jest": "^29.5.0",
|
||||||
|
@ -114,6 +113,7 @@
|
||||||
"semver": "7.5.1",
|
"semver": "7.5.1",
|
||||||
"setup-python": "github:actions/setup-python#v4.6.1",
|
"setup-python": "github:actions/setup-python#v4.6.1",
|
||||||
"shx": "0.3.4",
|
"shx": "0.3.4",
|
||||||
|
"simple-update-notifier": "^1.1.0",
|
||||||
"terser-config-atomic": "^0.1.1",
|
"terser-config-atomic": "^0.1.1",
|
||||||
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
"time-delta": "github:aminya/time-delta#69d91a41cef28e569be9a2991129f5f7d1f0d00e",
|
||||||
"ts-jest": "^29.1.0",
|
"ts-jest": "^29.1.0",
|
||||||
|
|
803
pnpm-lock.yaml
803
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
|
@ -1,27 +1,11 @@
|
||||||
import { warning } from "ci-log"
|
import { warning } from "ci-log"
|
||||||
import { promises } from "fs"
|
import updateNotifier from "simple-update-notifier"
|
||||||
const { readFile } = promises
|
import packageJson from "../package.json" assert { type: "json" }
|
||||||
import { join } from "path"
|
|
||||||
import { isInstalled } from "./utils/std/resolve"
|
|
||||||
|
|
||||||
// auto self update notifier
|
// auto self update notifier
|
||||||
export async function checkUpdates() {
|
export async function checkUpdates() {
|
||||||
try {
|
try {
|
||||||
if (await isInstalled("update-notifier")) {
|
await updateNotifier({ pkg: packageJson })
|
||||||
const [un, packageJsonString] = await Promise.all([
|
|
||||||
import("update-notifier"),
|
|
||||||
readFile(join(__dirname, "..", "package.json"), "utf8"),
|
|
||||||
])
|
|
||||||
|
|
||||||
const packageJson = JSON.parse(packageJsonString)
|
|
||||||
|
|
||||||
// the types do not match the actual export
|
|
||||||
const updateNotifier = un as unknown as (typeof un)["default"]
|
|
||||||
|
|
||||||
updateNotifier({ pkg: packageJson }).notify()
|
|
||||||
} else {
|
|
||||||
warning("setup-cpp could not find its dependency update-notifier, skipping check for updates")
|
|
||||||
}
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
warning(`Failed to check for updates: ${err instanceof Error ? err.message + err.stack : err}`)
|
warning(`Failed to check for updates: ${err instanceof Error ? err.message + err.stack : err}`)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
import resolveCb from "resolve"
|
|
||||||
|
|
||||||
interface PackageMeta {
|
|
||||||
name: string
|
|
||||||
version: string
|
|
||||||
[key: string]: any
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Promise wrapper for resolve */
|
|
||||||
export async function resolve(id: string): Promise<{ resolved: string; pkg?: PackageMeta }> {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
resolveCb(id, (err, resolved, pkg) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
} else if (resolved === undefined) {
|
|
||||||
reject(new Error(`Could not resolve ${id}`))
|
|
||||||
} else {
|
|
||||||
resolve({ resolved, pkg })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function isInstalled(id: string) {
|
|
||||||
try {
|
|
||||||
await resolve(id)
|
|
||||||
return true
|
|
||||||
} catch {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue