本文整理汇总了TypeScript中colors.yellow函数的典型用法代码示例。如果您正苦于以下问题:TypeScript yellow函数的具体用法?TypeScript yellow怎么用?TypeScript yellow使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yellow函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
export const execCmd = async (cmd: string, options?: IExecCmdOptions) => new Promise<string>((res, rej) => {
console.info(colors.yellow(`executing ${cmd}`));
const stream = exec(cmd, options);
let outBuffer = '';
let errBuffer = '';
stream.stdout.on('data', (chunk) => {
const str = chunk.toString();
outBuffer = outBuffer.concat(str);
console.info(colors.green(str));
});
stream.stderr.on('data', (chunk) => {
const str = chunk.toString();
errBuffer = errBuffer.concat(str);
console.error(colors.red(str));
});
stream.on('error', (err) => {
return err
? rej(err)
: res(err);
});
stream.on('exit', (code) => {
return code === 0
? res(outBuffer)
: rej(errBuffer);
});
});
示例2: runTestFile
function runTestFile(file) {
console.log(colors.yellow('[gulp watch - testFile]') + ' ' + colors.cyan(file));
gulp.src(file)
.pipe($.jasmine({ verbose: true }))
.on('error', swallowError)
.on('end', addSpaces);
}
示例3: logTest
/**
* Logs NN test output
* @since 0.0.2
*/
public static logTest(output: string | string[] = '') {
let colors = require('colors');
let prefix = colors.yellow('[TEST] ');
if (typeof output === 'string') {
console.log(prefix + output);
} else {
output.forEach(function (outputString) {
console.log(prefix + outputString);
});
}
}
示例4: modifyContents
/**
* Updates the contents of the template files with the library name or user details
*
* @param libraryName
* @param username
* @param usermail
*/
function modifyContents(libraryName: string, username: string, usermail: string) {
console.log(colors.underline.white("Modified"))
let files = modifyFiles.map(f => path.resolve(__dirname, "..", f))
try {
const changes = replace.sync({
files,
from: [/--libraryname--/g, /--username--/g, /--usermail--/g],
to: [libraryName, username, usermail]
})
console.log(colors.yellow(modifyFiles.join("\n")))
} catch (error) {
console.error("An error occurred modifying the file: ", error)
}
console.log("\n")
}
示例5: applyColor
function applyColor(message: string, color: Color): string {
if (!message) return;
if (!color) return message;
switch (color) {
case Color.black: return colors.black(message);
case Color.red: return colors.red(message);
case Color.green: return colors.green(message);
case Color.yellow: return colors.yellow(message);
case Color.blue: return colors.blue(message);
case Color.magenta: return colors.magenta(message);
case Color.cyan: return colors.cyan(message);
case Color.white: return colors.white(message);
case Color.grey: return colors.grey(message);
default: throw new Error('Invalid Color');
}
}
示例6: compileFile
function compileFile(file: string) {
console.log(colors.yellow('[gulp watch - compileFile]' + ' ' + colors.cyan(file)));
const tsProject = $.typescript.createProject('./tsconfig.json', {
noResolve: false,
removeComments: true,
rootDir: path.join(__dirname)
});
const tsResult = gulp.src([file, typesPath])
.pipe(tsProject());
const sections = file.split('\\');
sections.pop();
const dest = sections.join('\\');
return tsResult.js
.pipe(gulp.dest(path.join(__dirname, 'dist', dest)));
}
示例7: writeNpmrcFile
packages.forEach(async (pckg) => {
if (!await checkModulePublished(pckg)) {
console.info(colors.yellow(`Package never published ${pckg.name}`));
if (currentBranch === releaseBranch) {
try {
const packageDistPath = path.join(pckg.path, packageDistDir);
await writeNpmrcFile(packageDistPath);
await execCmd(`cd ${packageDistPath} && npm publish`, {
env: {
NPM_TOKEN: process.env.NPM_TOKEN,
},
});
} catch (e) {
console.error(colors.red(`Error : ${e}`));
}
} else {
console.info(colors.green(`Skipping publish as on; ${currentBranch}`));
}
} else {
console.info(colors.green(`${pckg.name} already published`));
}
});
示例8: consoleTestResultHandler
export function consoleTestResultHandler(testResult: TestResult): boolean {
// needed to get colors to show up when passing through Grunt
(colors as any).enabled = true;
let didAllTestsPass = true;
for (const fileName of Object.keys(testResult.results)) {
const results = testResult.results[fileName];
process.stdout.write(`${fileName}:`);
/* tslint:disable:no-console */
if (results.skipped) {
console.log(colors.yellow(` Skipped, requires typescript ${results.requirement}`));
} else {
const markupDiffResults = diff.diffLines(results.markupFromMarkup, results.markupFromLinter);
const fixesDiffResults = diff.diffLines(results.fixesFromLinter, results.fixesFromMarkup);
const didMarkupTestPass = !markupDiffResults.some((hunk) => hunk.added === true || hunk.removed === true);
const didFixesTestPass = !fixesDiffResults.some((hunk) => hunk.added === true || hunk.removed === true);
if (didMarkupTestPass && didFixesTestPass) {
console.log(colors.green(" Passed"));
} else {
console.log(colors.red(" Failed!"));
didAllTestsPass = false;
if (!didMarkupTestPass) {
displayDiffResults(markupDiffResults, MARKUP_FILE_EXTENSION);
}
if (!didFixesTestPass) {
displayDiffResults(fixesDiffResults, FIXES_FILE_EXTENSION);
}
}
}
/* tslint:enable:no-console */
}
return didAllTestsPass;
}
示例9: format
public format(failures: RuleFailure[]): string {
if (typeof failures[0] === "undefined") {
return "\n";
}
const fileName = failures[0].getFileName();
const positionMaxSize = this.getPositionMaxSize(failures);
const ruleMaxSize = this.getRuleMaxSize(failures);
const outputLines = [
fileName,
];
for (const failure of failures) {
const failureString = failure.getFailure();
// Rule
let ruleName = failure.getRuleName();
ruleName = this.pad(ruleName, ruleMaxSize);
ruleName = colors.yellow(ruleName);
// Lines
const lineAndCharacter = failure.getStartPosition().getLineAndCharacter();
let positionTuple = `${lineAndCharacter.line + 1}:${lineAndCharacter.character + 1}`;
positionTuple = this.pad(positionTuple, positionMaxSize);
positionTuple = colors.red(positionTuple);
// Ouput
const output = `${positionTuple} ${ruleName} ${failureString}`;
outputLines.push(output);
}
return outputLines.join("\n") + "\n\n";
}
示例10:
networks[device].forEach((details: os.NetworkInterfaceInfo) => {
if (details.family === 'IPv4') {
console.log(colors.yellow(' https://' + details.address + ':' + httpServerPort));
}
});