blob: 634ffd8c0fe871692aadad7d4b3091cc669eaf9f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import chalk from "chalk";
import checkForUpdate from "update-check";
import cliPkgJson from "../../package.json";
import getWorkspaceImplementation from "./getPackageManager";
const update = checkForUpdate(cliPkgJson).catch(() => null);
export default async function notifyUpdate(): Promise<void> {
try {
const res = await update;
if (res?.latest) {
const ws = getWorkspaceImplementation();
console.log();
console.log(
chalk.yellow.bold("A new version of `@turbo/codemod` is available!")
);
console.log(
"You can update by running: " +
chalk.cyan(
ws === "yarn"
? "yarn global add @turbo/codemod"
: ws === "pnpm"
? "pnpm i -g @turbo/codemod"
: "npm i -g @turbo/codemod"
)
);
console.log();
}
process.exit();
} catch (_e: any) {
// ignore error
}
}
|