UNPKG

zksync-cli

Version:

CLI tool that simplifies the process of developing applications and interacting with the ZKsync network

28 lines 1.14 kB
import chalk from "chalk"; import { readFileSync } from "fs"; import path from "path"; import updateNotifier from "update-notifier"; import { getDirPath } from "./files.js"; export const Package = JSON.parse(readFileSync(path.join(getDirPath(import.meta.url), "../../package.json"), "utf-8")); export const checkForUpdates = async () => { if (Package.version === "0.0.0-development") return; const notifier = updateNotifier({ pkg: Package, shouldNotifyInNpmScript: true, // Make notification work when using with NPX updateCheckInterval: 1000 * 60 * 60 * 12, // 12 hours }); let message = ""; message += "zksync-cli has an update available"; message += ` ${chalk.dim(notifier.update?.current)}${chalk.green(notifier.update?.latest)}`; message += `\nRun ${chalk.blueBright("{updateCommand}")} to update`; const boxenOptions = { padding: 1, margin: 1, textAlignment: "center", borderColor: "yellow", borderStyle: "round", }; notifier.notify({ message, boxenOptions, isGlobal: true }); }; //# sourceMappingURL=package.js.map