How to use the update-notifier.UpdateNotifier function in update-notifier

To help you get started, we’ve selected a few update-notifier examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github huan / matrix-appservice-wechaty / src / cli / check-update.ts View on Github external
.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)
github arnoldczhang / fe-guide / src / node / skeleton / bin / index.js View on Github external
} = 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,
github bitjson / typescript-starter / src / cli / args.ts View on Github external
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') {

update-notifier

Update notifications for your CLI app

BSD-2-Clause
Latest version published 2 months ago

Package Health Score

89 / 100
Full package analysis