How to use the update-notifier 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 maticzav / emma-cli / packages / create-emma / src / bin.tsx View on Github external
/* Spec */

const cli = meow(
  mls`
  | Usage
  |  $ create-emma <dir>
  `,
)

/**
 * Make sure that user is on the latest version
 * avaiable in case they have connection to NPM.
 */

const notifier = updateNotifier(cli)

notifier.notify()

if (notifier.update) {
  process.exit(0)
}

/* Main */

// function breakStep() {
//   console.log(`-------------------------------------------------------`)
// }

export async function main(cwd: string) {
  console.log(
    drawBox({</dir>
github alfg / srv / bin / srv.js View on Github external
#!/usr/bin/env node

/* eslint no-console:0 import/no-unresolved:0 */

import dotenv from 'dotenv';
import program from 'commander';
import chalk from 'chalk';
import updateNotifier from 'update-notifier';
import pkg from '../package.json';
import config from './default.json';
import { resolve } from 'path';

import * as cmd from './cmd/index';

updateNotifier({ pkg }).notify();

// Banner.
const banner = `
▼ ${pkg.name} - v${pkg.version}
${pkg.homepage}
`;
console.log(chalk.cyan(banner));

// Load dotenv.
dotenv.config({ silent: true });

// Parse CLI args.
program
  .version(pkg.version)
  .usage('entrypoint.js [options]')
  .option('-p, --port [n]', 'Port to listen on', process.env.PORT)
github maticzav / emma-cli / src / index.js View on Github external
#!/usr/bin/env node

import meow from 'meow'
import { h, render } from 'ink'
import updateNotifier from 'update-notifier'

import emma from './emma'

// Notify updater
const pkg = require(`../package.json`)

updateNotifier({ pkg }).notify()

// CLI

const cli = meow(`
   Usage
     $ emma

   Example
     $ emma -D

   Options
     --dev -D      Add to dev dependencies.

   Run without package-name to enter live search.
   Use keyboard to search through package library.
   Use up/down to select packages.
github dsebastien / modernWebDevGenerator / app / index.es2015.js View on Github external
const checkForUpdates = () =>{
				const notifier = updateNotifier({
								pkg: packageJSON
								//,updateCheckInterval: 1 // useful for debugging
				});

				let message = [];

				let retVal;

				if(notifier.update){
								message.push("Update available: " + chalk.green.bold(notifier.update.latest) + chalk.gray(" (current: " + notifier.update.current + ")"));
								message.push("Run " + chalk.magenta("npm install -g " + packageJSON.name) + " to update.");
								retVal = yosay(message.join(" "), {maxLength: stringLength(message[ 0 ])});
				}
				return retVal;
};
github egoist / bili / src / index.js View on Github external
/* eslint-disable unicorn/no-process-exit */
import cac from 'cac'
import update from 'update-notifier'
import bili from './bili'
import { handleRollupError } from './utils'

const cli = cac()

update({ pkg: cli.pkg }).notify()

cli
  .option('config', {
    desc: 'Path to config file',
    alias: 'c'
  })
  .option('watch', {
    desc: 'Run in watch mode',
    alias: 'w'
  })
  .option('filename', {
    desc: 'The filename of output file, no extension',
    alias: 'n'
  })
  .option('out-dir', {
    desc: 'The output directory',
github viewstools / morph / cli.js View on Github external
input = path.normalize(path.join(process.cwd(), input))
  }

  try {
    if ((await fs.stat(path.join(input, 'src'))).isDirectory()) {
      input = path.join(input, 'src')
    }
  } catch (error) {}

  if (clean) {
    console.log(`Cleaning up ${input}...`)
    await cleanup(input, verbose)
    process.exit()
  }

  updateNotifier({ pkg }).notify()

  if (verbose) {
    console.log(chalk.underline(`Views Tools morpher v${pkg.version}`))

    console.log(
      `\nWill morph files at "${chalk.green(input)}" as "${chalk.green(as)}" ${
        tools ? 'with Views Tools' : 'without Views Tools'
      }`
    )

    if (shouldWatch && !tools) {
      console.log(
        chalk.bgRed('                                               ')
      )
      console.log()
      console.log(`🚨 You're missing out!!!`)
github callumlocke / esbox / src / lib / cli.js View on Github external
import cc from 'cli-color';
import execa from 'execa';
import minimist from 'minimist';
import path from 'path';
import pathExists from 'path-exists';
import pkg from '../../package.json';
import updateNotifier from 'update-notifier';
import { clearScreen } from 'ansi-escapes';
import { debounce } from 'lodash';
import { tick, cross } from 'figures';

const isMac = /^darwin/.test(process.platform);

process.title = 'esbox';

updateNotifier({ pkg }).notify();

const red = cc.red;
const black = cc.black;
const bgWhite = cc.xtermSupported ? cc.bgXterm(250) : cc.bgWhite;
const brown = cc.xtermSupported ? cc.xterm(137) : cc.yellow;
const grey = cc.xtermSupported ? cc.xterm(241) : cc.blackBright;

const help = `
  ${bgWhite('                       ')}
  ${bgWhite(`  ${isMac ? '📦' : ''}  ${black('ES2016 in a box')}   `)}
  ${bgWhite(`     ${grey('git.io/esbox')}      `)}
  ${bgWhite('                       ')}

  ${brown('Usage')}
    ${grey('>')} esbox ${grey('FILENAME')}
github MainframeHQ / erebos / packages / cli / src / index.ts View on Github external
import cmd from '@oclif/command'
import updateNotifier from 'update-notifier'

import pkg from '../package.json'

updateNotifier({ pkg }).notify()

module.exports = cmd
github muffin / cli / bin / index.js View on Github external
#!/usr/bin/env node

import args from 'args'
import updateNotifier from 'update-notifier'
import pkg from '../../package.json'

updateNotifier({ pkg }).notify()

args
  .command('build', 'Build your site')
  .command('new', 'Generate the boilerplate for a new site')
  .command('serve', 'Serve your site locally')
  .command('import', 'Import data into your site\'s database')

args.parse(process.argv)

update-notifier

Update notifications for your CLI app

BSD-2-Clause
Latest version published 7 months ago

Package Health Score

82 / 100
Full package analysis