本文整理汇总了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 => {
示例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,
示例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;
});
示例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`
})
}
})
示例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',
示例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;
}
示例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...