Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(pack => {
if (!pack) {
throw new Error('package.json not found')
}
const pkg = pack.package
// 1 week
const updateCheckInterval = 1000 * 60 * 60 * 24 * 7
const notifier = new UpdateNotifier({
pkg,
updateCheckInterval,
})
notifier.notify()
return null
})
.catch(console.error)
} = require('fs');
const chokidar = require('chokidar');
const run = require('../dist/index.cjs');
const cfg = require('../package.json');
const options = {
root: process.cwd(),
};
const thisDir = process.cwd();
const {
defaultConfigName,
} = run;
// 更新检查方法
const notifier = new UpdateNotifier({
pkg: cfg,
callback(err, result) {
if (err) return;
if (semCmp(result.latest, result.current) > 0) {
const message =
'Update available ' +
color.dim(result.current) +
color.reset(' → ') +
color.green(result.latest) +
' \nRun ' +
color.cyan('npm i -g ' + json.name) +
' to update';
const msg =
'\n' +
boxen(message, {
padding: 1,
const updateInfo = await new Promise((resolve, reject) => {
const notifier = new UpdateNotifier({
callback: (error, update) => {
error ? reject(error) : resolve(update);
},
pkg: cli.pkg as Package
});
notifier.check();
});
if (updateInfo.type !== 'latest') {