本文整理汇总了TypeScript中gulp-util.colors.red方法的典型用法代码示例。如果您正苦于以下问题:TypeScript colors.red方法的具体用法?TypeScript colors.red怎么用?TypeScript colors.red使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gulp-util.colors
的用法示例。
在下文中一共展示了colors.red方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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 '${util.colors.grey(this.name)}': ${Math.round(this.totalSize / 1204)}KB`;
} else {
let count = this.totalCount < 100
? util.colors.green(this.totalCount.toString())
: util.colors.red(this.totalCount.toString());
return `Stats for '${util.colors.grey(this.name)}': ${count} files, ${Math.round(this.totalSize / 1204)}KB`;
}
}
}
示例2: defaultFinishHandler
function defaultFinishHandler(results: CompilationResult) {
let hasError = false;
const showErrorCount = (count: number, type: string) => {
if (count === 0) return;
gutil.log('TypeScript:', gutil.colors.magenta(count.toString()), type + ' ' + (count === 1 ? 'error' : 'errors'));
hasError = true;
};
showErrorCount(results.syntaxErrors, 'syntax');
showErrorCount(results.globalErrors, 'global');
showErrorCount(results.semanticErrors, 'semantic');
showErrorCount(results.emitErrors, 'emit');
if (results.emitSkipped) {
gutil.log('TypeScript: emit', gutil.colors.red('failed'));
} else if (hasError) {
gutil.log('TypeScript: emit', gutil.colors.cyan('succeeded'), '(with errors)');
}
}
示例3: callback
fs.ensureDir(path.dirname(toFile), (err) => {
if (err) {
gutil.log(gutil.colors.red('[gif] Error making dir') + err)
callback(err)
return
}
execFile(gifsicle,
['--output', toFile, '--resize-width', '640', '--colors', '256', '--optimize=3', file.path],
(err, stdout, stderr) => {
if (err) {
gutil.log(gutil.colors.red('[gif] gifsicle error:\n') + stderr)
callback(err)
return
}
gutil.log(gutil.colors.dim(stdout))
callback(null, file)
}
)
})
示例4: error
function error(err: {message: string}) {
const raw = stripAnsi(err.message)
const result = raw.match(/(.*)(\(\d+,\d+\): error TS(\d+):.*)/)
if (result != null) {
const [, file, rest, code] = result
const real = path.join('src', 'coffee', ...file.split(path.sep).slice(3))
if (fs.existsSync(real)) {
gutil.log(`${gutil.colors.red(real)}${rest}`)
return
}
// XXX: can't enable "6133", because CS generates faulty code for closures
if (["2307", "2688", "6053"].indexOf(code) != -1) {
gutil.log(err.message)
return
}
}
if (!argv.ts)
return
if (typeof argv.ts === "string") {
const keywords = argv.ts.split(",")
for (let keyword of keywords) {
let must = true
if (keyword[0] == "^") {
keyword = keyword.slice(1)
must = false
}
const found = err.message.indexOf(keyword) != -1
if (!((found && must) || (!found && !must)))
return
}
}
gutil.log(err.message)
}
示例5:
let findPackageNames = () => {
let match = packageNameRegExp.exec(error.message);
return match ? util.colors.red(`'${util.colors.cyan(match[1])}' -> ${findPackageNames()}`)
: util.colors.red("...");
};
示例6: handleError
function handleError(error: any, packageName: string, continueOnError: boolean, rejectFunc: (error?: any) => void) {
rejectFunc(new PluginError("Error uninstalling a workspace package",
`Error uninstalling workspace package '${util.colors.cyan(packageName)}':\n${util.colors.red(error.message)}`,
{ continue: continueOnError }));
}
示例7:
errors.map(err => {
if (!seen.has(err)) {
seen.add(err);
util.log(`${util.colors.red('Error')}: ${err}`);
}
});
示例8: logError
export function logError(...messages: string[]) {
gutil.log('Error: ' + gutil.colors.red(messages.join(' ')));
}
示例9:
}).catch(err => {
gutil.log(gutil.colors.red("Unable to publish file"));
deferred.reject(err);
});