当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ansi-colors.red函数代码示例

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


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

示例1: log

export = (done: any) => {
  log(colors.yellow(`
    Warning!
    Please use ${colors.green('npm run build.prod')}
    Instead of ${colors.red('npm run build.prod.aot')} or ${colors.red('npm run build.prod.aot')}
    They will be deleted soon!`));

  done();
};
开发者ID:albogdano,项目名称:angular2-para,代码行数:9,代码来源:deprecate.notification.ts

示例2: defaultFinishHandler

function defaultFinishHandler(results: CompilationResult) {
	let hasError = false;
	const showErrorCount = (count: number, type: string) => {
		if (count === 0) return;

		console.log('TypeScript:', colors.magenta(count.toString()), (type !== '' ? type + ' ' : '') + (count === 1 ? 'error' : 'errors'));
		hasError = true;
	};

	showErrorCount(results.transpileErrors, '');
	showErrorCount(results.optionsErrors, 'options');
	showErrorCount(results.syntaxErrors, 'syntax');
	showErrorCount(results.globalErrors, 'global');
	showErrorCount(results.semanticErrors, 'semantic');
	showErrorCount(results.declarationErrors, 'declaration');
	showErrorCount(results.emitErrors, 'emit');

	if (!results.noEmit) {
		if (results.emitSkipped) {
			console.log('TypeScript: emit', colors.red('failed'));
		} else if (hasError) {
			console.log('TypeScript: emit', colors.cyan('succeeded'), '(with errors)');
		}
	}
}
开发者ID:ivogabe,项目名称:gulp-typescript,代码行数:25,代码来源:reporter.ts

示例3:

		error: (error: TypeScriptError, typescript: typeof ts) => {
			console.log('[' + colors.gray('gulp-typescript') + '] '
				+ colors.bgRed(error.diagnostic.code + '')
				+ ' ' + colors.red(typescript.flattenDiagnosticMessageText(error.diagnostic.messageText, '\n'))
			);

			if (error.tsFile) {
				console.log('> ' + colors.gray('file: ') + (fullFilename ? error.fullFilename : error.relativeFilename) + colors.gray(':'));
				const lines = error.tsFile.text.split(/(?:\r\n|\r|\n)/);

				const logLine = (lineIndex: number, errorStart: number, errorEnd?: number) => {
					const line = lines[lineIndex];
					if (errorEnd === undefined) errorEnd = line.length;
					console.log('> ' + colors.gray('[' + lineIndex + '] ')
						+ line.substring(0, errorStart)
						+ colors.red(line.substring(errorStart, errorEnd))
						+ line.substring(errorEnd)
					);
				}

				for (let i = error.startPosition.line; i <= error.endPosition.line; i++) {
					logLine(i,
						i === error.startPosition.line ? error.startPosition.character - 1 : 0,
						i === error.endPosition.line ? error.endPosition.character - 1 : undefined
					);
				}
			}
		},
开发者ID:ivogabe,项目名称:gulp-typescript,代码行数:28,代码来源:reporter.ts

示例4: validateTasks

 .forEach(([tasks, file]: [string, string]) => {
   const invalid = validateTasks(tasks);
   if (invalid.length) {
     const errorMessage = getInvalidTaskErrorMessage(invalid, file);
     log(colors.red(errorMessage));
     process.exit(1);
   }
 });
开发者ID:albogdano,项目名称:angular2-para,代码行数:8,代码来源:tasks_tools.ts

示例5: function

	}, function () {
		if (log) {
			if (entry.totalCount === 1) {
				fancyLog(`Stats for '${ansiColors.grey(entry.name)}': ${Math.round(entry.totalSize / 1204)}KB`);

			} else {
				const count = entry.totalCount < 100
					? ansiColors.green(entry.totalCount.toString())
					: ansiColors.red(entry.totalCount.toString());

				fancyLog(`Stats for '${ansiColors.grey(entry.name)}': ${count} files, ${Math.round(entry.totalSize / 1204)}KB`);
			}
		}

		this.emit('end');
	});
开发者ID:PKRoma,项目名称:vscode,代码行数:16,代码来源:stats.ts

示例6: toString

	toString(pretty?: boolean): string {
		if (!pretty) {
			if (this.totalCount === 1) {
				return `${this.name}: ${this.totalSize} bytes`;
			} else {
				return `${this.name}: ${this.totalCount} files with ${this.totalSize} bytes`;
			}
		} else {
			if (this.totalCount === 1) {
				return `Stats for '${ansiColors.grey(this.name)}': ${Math.round(this.totalSize / 1204)}KB`;

			} else {
				const count = this.totalCount < 100
					? ansiColors.green(this.totalCount.toString())
					: ansiColors.red(this.totalCount.toString());

				return `Stats for '${ansiColors.grey(this.name)}': ${count} files, ${Math.round(this.totalSize / 1204)}KB`;
			}
		}
	}
开发者ID:PKRoma,项目名称:vscode,代码行数:20,代码来源:stats.ts

示例7:

import * as colors from 'ansi-colors';

let s: string;

s = colors.bgblack("hello");
s = colors.bgblue("hello");
s = colors.bgcyan("hello");
s = colors.bggreen("hello");
s = colors.bgmagenta("hello");
s = colors.bgred("hello");
s = colors.bgwhite("hello");
s = colors.bgyellow("hello");
s = colors.black("hello");
s = colors.blue("hello");
s = colors.bold("hello");
s = colors.cyan("hello");
s = colors.dim("hello");
s = colors.gray("hello");
s = colors.green("hello");
s = colors.grey("hello");
s = colors.hidden("hello");
s = colors.inverse("hello");
s = colors.italic("hello");
s = colors.magenta("hello");
s = colors.red("hello");
s = colors.reset("hello");
s = colors.strikethrough("hello");
s = colors.underline("hello");
s = colors.white("hello");
s = colors.yellow("hello");
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:30,代码来源:ansi-colors-tests.ts

示例8: fancyLog

	errors.map(err => {
		if (!seen.has(err)) {
			seen.add(err);
			fancyLog(`${ansiColors.red('Error')}: ${err}`);
		}
	});
开发者ID:PKRoma,项目名称:vscode,代码行数:6,代码来源:reporter.ts


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