• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript update-notifier.default函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中update-notifier.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了default函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: readPkgUp

(async () => {
  const { pkg } = await readPkgUp();
  if (pkg.name !== '@jokeyrhyme/node-init') {
    // package.json is too far up, doesn't belong to this package
    throw new Error('unable to find package.json within node-init');
  }

  updateNotifier({ pkg }).notify();

  updateNodejsNotifier();

  const cli = meow(
    `
  Usage:
      $ node-init [project]

  Options:
      --scope [scope]        set npm @scope prefix
      --check-git-status     stop work if un-versioned changes
      --no-check-git-status  do work even if un-versioned changes

  Examples
      $ node-init
      $ node-init my-project
      $ node-init my-project --scope my-org
  `,
    {
      flags: {
        checkGitStatus: {
          default: true,
          type: 'boolean',
        },
        scope: {
          type: 'string',
        },
      },
    },
  );

  if (!enginesNotify({ pkg })) {
    // no engine trouble, proceed :)
    const { init } = await import('../lib/index.js');

    init(cli.input, cli.flags);
  } else {
    process.exitCode = 1;
  }
})().catch(err => {
开发者ID:jokeyrhyme,项目名称:node-init.js,代码行数:48,代码来源:index.ts


示例2: require

import { copyFiles, defaultConfig } from './lib';
import Config from './types/Config';
import { askChooseFiles, isFilledArray, loadConfig } from './utils';

const { cyan, green } = chalk;

const pkg = require('../package.json');
const confcName = green('confc');
const description = cyan(
	'Clone your default configuration files to current working directory.'
);
const aww = '(。◕‿◕。)';

const config: Config = loadConfig();

updateNotifier({ pkg }); // Update notification

const argv = yargs
	.config(config)
	.help()
	.alias('help', 'h')
	.version()
	.alias('version', 'V')
	.usage(
		`Usage: ${confcName} [options] [filenames...]${EOL + EOL + description}`
	)
	.option('path', {
		alias: 'p',
		type: 'string',
		desc: 'Path to configuration files',
		default: defaultConfig.path,
开发者ID:gluons,项目名称:ConfC,代码行数:31,代码来源:cli.ts


示例3: updateNotifier

			return Q.resolve().then(() => {
				var defer = Q.defer();
				if (notifier || !opts.getBoolean('enabled', true)) {
					return Q.resolve(notifier);
				}
				// switch if we want to wait for this
				var callback = (promise ? (err, update) => {
					if (err) {
						notifier = null;
						defer.reject(err);
					}
					else {
						notifier.update = update;
						defer.resolve(notifier);
					}
				} : undefined);

				var settings:any = {
					packageName: context.packageInfo.name,
					packageVersion: context.packageInfo.version,
					updateCheckInterval: opts.getDurationSecs('updateCheckInterval', 24 * 3600) * 1000,
					updateCheckTimeout: opts.getDurationSecs('updateCheckTimeout', 10) * 1000,
					registryUrl: opts.getString('registryUrl'),
					callback: callback
				};

				notifier = updateNotifier(settings);
				if (!callback) {
					defer.resolve(notifier);
				}
				return defer.promise;
			});
开发者ID:AbraaoAlves,项目名称:tsd,代码行数:32,代码来源:update.ts


示例4: updateNotifier

    .then(it => {
      if (it.version === "0.0.0-semantic-release") {
        return
      }

      const notifier = updateNotifier({pkg: it})
      if (notifier.update != null) {
        notifier.notify({
          message: `Update available ${chalk.dim(notifier.update.current)}${chalk.reset(" → ")}${chalk.green(notifier.update.latest)} \nRun ${chalk.cyan("yarn upgrade electron-builder")} to update`
        })
      }
    })
开发者ID:ledinhphuong,项目名称:electron-builder,代码行数:12,代码来源:cli.ts


示例5: require

import * as Commands from './commands/commands';
const lighthouse = require('../lighthouse-core');
const log = require('../lighthouse-core/lib/log');
const Driver = require('../lighthouse-core/gather/driver.js');
import * as path from 'path';
const perfOnlyConfig = require('../lighthouse-core/config/perf.json');
const performanceXServer = require('./performance-experiment/server');
import * as Printer from './printer';
import * as randomPort from './random-port';
import {Results} from './types/types';
const yargs = require('yargs');
const opn = require('opn');
const updateNotifier = require('update-notifier');
const pkg = require('../package.json');

updateNotifier({pkg}).notify(); // Tell user if there's a newer version of LH.

interface LighthouseError extends Error {
  code?: string
};

const cliFlags = yargs
  .help('help')
  .version(() => pkg.version)
  .showHelpOnFail(false, 'Specify --help for available options')

  .usage('$0 url')

  // List of options
  .group([
    'verbose',
开发者ID:CondeNast,项目名称:lighthouse,代码行数:31,代码来源:bin.ts


示例6: require

#!/usr/bin/env node

var fableMain = require("./build");

if (require.main === module) {
    // Check for updates
    var updateNotifier = require('update-notifier');
    var notifier = updateNotifier({
        pkg: {
            name: "fable-compiler",
            version: require("./constants").PKG_VERSION
        },
        callback: function(err, update) {
            if (err == null && update.latest !== update.current) {
                notifier.update = update;
                notifier.notify({defer: false});
            }
        }
    });

    fableMain.compile();
} else {
    var fableLib = require("./lib");
    fableLib.compile = function(opts) {
        opts = typeof opts === "string" ? {projFile: opts} : opts;
        return fableMain.compile(opts || {});
    }
    module.exports = fableLib;
}
开发者ID:7sharp9,项目名称:Fable,代码行数:29,代码来源:index.ts


示例7: require

const updateNotifier = require('update-notifier');
const chalk = require('chalk');
const logUpdate = require('log-update');
const Conf = require('conf');
import * as debug from 'debug';

import { Pully, DownloadConfig, ProgressData, DownloadResults, Presets } from '../';
import { toHumanTime, toHumanSize, fromHumanSize } from '../utils/human';
import { ProgressBar } from '../utils/progress'; 
import { FormatInfo } from '../lib/models';

const EMPTY_STRING = '';
const log = debug('pully:cli');

const pkg = require(join(__dirname, '../../package.json'));
updateNotifier({ pkg }).notify();

const config = new Conf();
let progressBar: ProgressBar<ProgressData>;

interface BinDownloadConfig extends DownloadConfig {
  silent?: boolean;
  limit?: string;
}

// Log any unhandled exceptions...
process.on('uncaughtException', err => log(`uncaughtException: ${err}`, err));
process.on('unhandledRejection', (err, promise) => log(`unhandledRejection: ${err}`, err, promise));

swapArgs('-v', '-V'); // Convert -v to -V so version works correctly...
swapArgs('/?', '-h'); // Convert /? to also show help info...
开发者ID:JimmyBoh,项目名称:pully,代码行数:31,代码来源:pully.ts



注:本文中的update-notifier.default函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript urijs.default函数代码示例发布时间:2022-05-25
下一篇:
TypeScript unzipper.Open类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap