本文整理汇总了TypeScript中@angular-devkit/core.terminal.green方法的典型用法代码示例。如果您正苦于以下问题:TypeScript terminal.green方法的具体用法?TypeScript terminal.green怎么用?TypeScript terminal.green使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular-devkit/core.terminal
的用法示例。
在下文中一共展示了terminal.green方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: switch
workflow.reporter.subscribe((event: DryRunEvent) => {
nothingDone = false;
switch (event.kind) {
case 'error':
error = true;
const desc = event.description == 'alreadyExist' ? 'already exists' : 'does not exist';
logger.warn(`ERROR! ${event.path} ${desc}.`);
break;
case 'update':
loggingQueue.push(tags.oneLine`
${terminal.white('UPDATE')} ${event.path} (${event.content.length} bytes)
`);
break;
case 'create':
loggingQueue.push(tags.oneLine`
${terminal.green('CREATE')} ${event.path} (${event.content.length} bytes)
`);
break;
case 'delete':
loggingQueue.push(`${terminal.yellow('DELETE')} ${event.path}`);
break;
case 'rename':
loggingQueue.push(`${terminal.blue('RENAME')} ${event.path} => ${event.to}`);
break;
}
});
示例2: resolve
.on('close', (code: number) => {
if (code === 0) {
logger.info(terminal.green(`Installed packages for tooling via ${packageManager}.`));
resolve();
} else {
const message = 'Package install failed, see above.';
logger.info(terminal.red(message));
reject(message);
}
});
示例3: tap
tap(result => {
if (result.success) {
parentLogger.info(terminal.green('SUCCESS'));
} else {
parentLogger.info(terminal.yellow('FAILURE'));
}
parentLogger.info('Result: ' + JSON.stringify({ ...result, info: undefined }, null, 4));
parentLogger.info('\nLogs:');
logs.forEach(l => parentLogger.next(l));
logs.splice(0);
}),
示例4: run
async run() {
const phrase = pickOne([
`You're on it, there's nothing for me to do!`,
`Let's take a look... nope, it's all good!`,
`You're doing fine.`,
`You're already doing great.`,
`Nothing to do; already awesome. Exiting.`,
`Error 418: As Awesome As Can Get.`,
`I spy with my little eye a great developer!`,
`Noop... already awesome.`,
]);
this.logger.info(terminal.green(phrase));
}
示例5: function
export default async function (packageName: string,
logger: logging.Logger,
packageManager: string,
projectRoot: string,
save = true) {
const installArgs: string[] = [];
switch (packageManager) {
case 'cnpm':
case 'pnpm':
case 'npm':
installArgs.push('install', '--silent');
break;
case 'yarn':
installArgs.push('add');
break;
default:
packageManager = 'npm';
installArgs.push('install', '--quiet');
break;
}
logger.info(terminal.green(`Installing packages for tooling via ${packageManager}.`));
if (packageName) {
installArgs.push(packageName);
}
if (!save) {
installArgs.push('--no-save');
}
await new Promise((resolve, reject) => {
spawn(packageManager, installArgs, { stdio: 'inherit', shell: true })
.on('close', (code: number) => {
if (code === 0) {
logger.info(terminal.green(`Installed packages for tooling via ${packageManager}.`));
resolve();
} else {
const message = 'Package install failed, see above.';
logger.info(terminal.red(message));
reject(message);
}
});
});
}
示例6: function
export default async function (packageName: string,
logger: logging.Logger,
packageManager: string,
projectRoot: string,
save = true) {
const installArgs: string[] = [];
switch (packageManager) {
case 'cnpm':
case 'npm':
installArgs.push('install', '--quiet');
break;
case 'yarn':
installArgs.push('add');
break;
default:
packageManager = 'npm';
installArgs.push('install', '--quiet');
break;
}
logger.info(terminal.green(`Installing packages for tooling via ${packageManager}.`));
if (packageName) {
try {
// Verify if we need to install the package (it might already be there).
// If it's available and we shouldn't save, simply return. Nothing to be done.
resolve(packageName, { checkLocal: true, basedir: projectRoot });
return;
} catch (e) {
if (!(e instanceof ModuleNotFoundException)) {
throw e;
}
}
installArgs.push(packageName);
}
if (!save) {
installArgs.push('--no-save');
}
const installOptions = {
stdio: 'inherit',
shell: true,
};
await new Promise((resolve, reject) => {
spawn(packageManager, installArgs, installOptions)
.on('close', (code: number) => {
if (code === 0) {
logger.info(terminal.green(`Installed packages for tooling via ${packageManager}.`));
resolve();
} else {
const message = 'Package install failed, see above.';
logger.info(terminal.red(message));
reject(message);
}
});
});
}