本文整理汇总了TypeScript中update-notifier类的典型用法代码示例。如果您正苦于以下问题:TypeScript update-notifier类的具体用法?TypeScript update-notifier怎么用?TypeScript update-notifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了update-notifier类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: listPluggings
import {
getGraphQLProjectConfig,
GraphQLProjectConfig,
GraphQLConfig,
getGraphQLConfig,
ConfigNotFoundError,
resolveEnvsInValues,
} from 'graphql-config'
import * as updateNotifier from 'update-notifier'
const pkg = require('../package.json')
import 'source-map-support/register'
export * from './types'
export * from './utils'
updateNotifier({ pkg }).notify()
function listPluggings(dir: string): string[] {
return readdirSync(dir)
.filter(moduleName => moduleName.startsWith('graphql-cli-'))
.map(moduleName => joinPaths(dir, moduleName))
}
export function installCommands() {
const plugins = _(npmPaths())
.filter(existsSync)
.map(listPluggings)
.flatten()
.uniq()
.value() as string[]
示例2: require
import * as fs from "fs";
import * as path from "path";
import * as jsyaml from "js-yaml";
import * as updateNotifier from "update-notifier";
import { start } from "./index";
import { ConfigRaw } from "./controller/configRaw";
import { ReportLevel } from "./model/compilerModel";
import { Exec, target2builder } from "./utils/utils";
/* tslint:disable:no-require-imports */
let pkg = require("../package.json");
/* tslint:enable:no-require-imports */
let notifier = updateNotifier({
packageName: pkg.name,
packageVersion: pkg.version
});
if (notifier.update) {
notifier.notify();
}
let packageJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, "../package.json"), "utf8"));
import * as commandpost from "commandpost";
interface RootOpts {
reviewfile: string[];
base: string[];
}
let root = commandpost
示例3: require
*/
// Be mindful of adding imports here, as this is on the hot path of all
// commands.
import * as logging from 'plylog';
import * as updateNotifier from 'update-notifier';
import {PolymerCli} from './polymer-cli';
const packageJson = require('../package.json');
const logger = logging.getLogger('cli.main');
// Update Notifier: Asynchronously check for package updates and, if needed,
// notify on the next time the CLI is run.
// See https://github.com/yeoman/update-notifier#how for info on how this works.
updateNotifier({pkg: packageJson}).notify();
(async () => {
const args = process.argv.slice(2);
const cli = new PolymerCli(args);
try {
const result = await cli.run();
if (result && result.constructor &&
result.constructor.name === 'CommandResult') {
process.exit(result.exitCode);
}
} catch (err) {
logger.error('cli runtime exception: ' + err);
if (err.stack) {
logger.error(err.stack);
}
示例4: notifyVersion
export function notifyVersion(pkg) {
var notifier = updateNotifier({ pkg })
if (notifier.update) {
notifier.notify()
}
}
示例5: constructor
constructor({ config }: { config?: RunOptions } = {}) {
if (!config) {
config = {
mock: false,
}
}
const parentFilename = module.parent!.parent!
? module.parent!.parent!.filename
: module.parent!.filename
if (!config.initPath) {
config.initPath = parentFilename
}
if (!config.root) {
const findUp = require('find-up')
config.root = path.dirname(
findUp.sync('package.json', {
cwd: parentFilename,
}),
)
}
this.config = new Config(config)
this.notifier = updateNotifier({
pkg: this.config.pjson,
updateCheckInterval: 1,
})
this.initRaven()
}
示例6: setupUpdateNotifier
export default function setupUpdateNotifier(pkg: any, updateCheckInterval: number = 0) {
const notifier = updateNotifier({ pkg, updateCheckInterval });
notifier.notify();
}
示例7: require
// Commands
import deployCommand from './commands/deploy';
import loginCommand from './commands/login';
import logoutCommand from './commands/logout';
import { extraHelp, logCodeSandbox } from './utils/log';
import packageInfo = require('../package.json');
console.log();
logCodeSandbox();
console.log();
program.version(packageInfo.version);
program.on('--help', extraHelp);
// Register commands
deployCommand(program);
loginCommand(program);
logoutCommand(program);
program.parse(process.argv);
if (!process.argv.slice(2).length) {
program.outputHelp();
}
updateNotifier({ pkg: packageInfo }).notify();
示例8: parseInt
}
if (messages.tip && messages.tip.message) {
console.log(chalk.green(messages.tip.message));
}
console.log("");
}
};
console.log("");
console.log(chalk.green("BST: v" + Global.version() + " Node: " + process.version));
updateNotifier({
pkg: {
name: "bespoken-tools",
version: Global.version(),
},
updateCheckInterval: 0
}).notify({
defer: false,
isGlobal: true,
});
let Logger = "BST";
let nodeMajorVersion = parseInt(process.version.substr(1, 2));
if (nodeMajorVersion < 4) {
LoggingHelper.error(Logger, "!!!!Node version must be >= 4!!!!");
LoggingHelper.error(Logger, "Please install to use bst");
LoggingHelper.prepareForFileLoggingAndDisableConsole("bst-debug.log");