本文整理汇总了TypeScript中chalk.white函数的典型用法代码示例。如果您正苦于以下问题:TypeScript white函数的具体用法?TypeScript white怎么用?TypeScript white使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了white函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
const renderTime = (runTime: number, estimatedTime: number, width: number) => {
// If we are more than one second over the estimated time, highlight it.
const renderedTime =
estimatedTime && runTime >= estimatedTime + 1
? chalk.bold.yellow(runTime + 's')
: runTime + 's';
let time = chalk.bold(`Time:`) + ` ${renderedTime}`;
if (runTime < estimatedTime) {
time += `, estimated ${estimatedTime}s`;
}
// Only show a progress bar if the test run is actually going to take
// some time.
if (estimatedTime > 2 && runTime < estimatedTime && width) {
const availableWidth = Math.min(PROGRESS_BAR_WIDTH, width);
const length = Math.min(
Math.floor((runTime / estimatedTime) * availableWidth),
availableWidth,
);
if (availableWidth >= 2) {
time +=
'\n' +
chalk.green('█').repeat(length) +
chalk.white('█').repeat(availableWidth - length);
}
}
return time;
};
示例2: reportDiagnostic
public static reportDiagnostic( diagnostic: ts.Diagnostic ) {
if ( !diagnostic ) {
return;
}
var output = "";
if ( diagnostic.file ) {
var loc = ts.getLineAndCharacterOfPosition( diagnostic.file, diagnostic.start );
output += chalk.gray( `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): ` );
}
var category;
switch ( diagnostic.category ) {
case ts.DiagnosticCategory.Error:
category = chalk.red( ts.DiagnosticCategory[diagnostic.category].toLowerCase() );
break;
case ts.DiagnosticCategory.Warning:
category = chalk.yellow( ts.DiagnosticCategory[diagnostic.category].toLowerCase() );
break;
default:
category = chalk.green( ts.DiagnosticCategory[diagnostic.category].toLowerCase() );
}
output += `${category} TS${chalk.white( diagnostic.code + '' )}: ${chalk.grey( ts.flattenDiagnosticMessageText( diagnostic.messageText, "\n" ) )}`;
Logger.log( output );
}
示例3: logPeek
public logPeek(path: string, operations: PeekOperation) {
console.log(' ', chalk.white(path))
if (!Object.keys(operations.stats).length) {
console.log(' ', chalk.gray('~~ No changes for this file ~~'))
}
Object.entries(operations.stats).map((stat, index) => {
let actions = Object.entries(stat[1])
if (index > 0) {
actions = actions.filter(
([action]) => !MASTER_ONLY_ACTIONS.includes(action)
)
}
actions.map(([action, name]) => {
console.log(
' ',
chalk.bold(this.formatAction(action)),
':',
chalk.bold.white(name)
)
})
})
console.log('')
}
示例4: run
async function run(helper: Helper, args: {}) {
const cwd = process.cwd();
let rootDir = pkgDir.sync(cwd);
if (!rootDir) {
console.warn(noPackageWarning);
rootDir = cwd;
}
const dojoRcPath = join(rootDir, '.dojorc');
const file = existsSync(dojoRcPath) && readFileSync(dojoRcPath, 'utf8');
let json: { [name: string]: {} } = {};
let indent = '\t';
if (file) {
indent = detectIndent(file).indent || indent;
json = JSON.parse(file);
}
const groupMap = await loadExternalCommands();
const values = [];
for (let [, commandMap] of groupMap.entries()) {
for (let [, value] of commandMap.entries()) {
const name = `${value.group}-${value.name}`;
if (values.indexOf(name) === -1 && json[name] === undefined) {
json[name] = {};
values.push(name);
}
}
}
writeFileSync(dojoRcPath, JSON.stringify(json, null, indent));
console.log(chalk.white(`Successfully wrote .dojorc to ${dojoRcPath}`));
}
示例5: log
public log(path: string) {
console.log(' ', chalk.white(path))
console.log(
' ',
chalk.green('✓ Successfully write the locale files from Accent')
)
console.log('')
}
示例6: printHeader
function printHeader(testName) {
const text = `${++index} of ${testsToRun.length}`;
console.log(green(`Running "${bold(blue(testName))}" (${bold(white(text))})...`));
if (isTravis()) {
console.log(`travis_fold:start:${encode(testName)}`);
}
}
示例7: PartnerCenterAuth
.then((token: string) => {
// get the aad token
aadToken = token;
console.log(chalk.green('.. obtained AAD access token.'));
// use aad token to request parter center token
console.log(chalk.white('Obtaining Partner Center token..'));
let pcAuth: PartnerCenterAuth = new PartnerCenterAuth();
return pcAuth.login(aadToken);
})
示例8: PartnerCenterValidator
.then((token: string) => {
// get the partner center token
pcToken = token;
console.log(chalk.green('.. obtained Partner Center access token.'));
// validate a domain availability
let domainToCheck: string = 'wingtiptoys';
console.log(chalk.white('Checking if the domain \'' + domainToCheck + '\' is available...'));
let validator: PartnerCenterValidator = new PartnerCenterValidator(pcToken);
return validator.checkDomain(domainToCheck);
})
示例9: PartnerCenterCustomers
.then((domainAvailable: boolean) => {
if (domainAvailable) {
console.log(chalk.green('.. domain is available.'));
} else {
console.log(chalk.yellow('.. domain is NOT available.'));
}
// use partner center token to get customers
console.log(chalk.white('Getting list of customers...'));
let pcCustomers: PartnerCenterCustomers = new PartnerCenterCustomers(pcToken);
return pcCustomers.get();
})
示例10: printHeader
function printHeader(testName: string, testIndex: number) {
const text = `${testIndex + 1} of ${testsToRun.length}`;
const fullIndex = (testIndex < allSetups.length ? testIndex
: (testIndex - allSetups.length) * nbShards + shardId + allSetups.length) + 1;
const length = tests.length + allSetups.length;
const shard = shardId === null ? ''
: yellow(` [${shardId}:${nbShards}]` + bold(` (${fullIndex}/${length})`));
console.log(green(`Running "${bold(blue(testName))}" (${bold(white(text))}${shard})...`));
if (isTravis()) {
console.log(`travis_fold:start:${encode(testName)}`);
}
}