• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript chalk.white类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: async

  async ({
    flags: {
      path,
      'output-dir': outputDir,
      'output-format': outputFormat,
      'include-config': includeConfig,
    },
  }) => {
    if (!outputDir || typeof outputDir !== 'string') {
      throw createFailError(
        `${chalk.white.bgRed(' I18N ERROR ')} --output-dir option should be specified.`
      );
    }

    if (typeof path === 'boolean' || typeof includeConfig === 'boolean') {
      throw createFailError(
        `${chalk.white.bgRed(' I18N ERROR ')} --path and --include-config require a value`
      );
    }

    const config = await mergeConfigs(includeConfig);
    const defaultMessages = await extractDefaultMessages({ path, config });

    // Messages shouldn't be written to a file if output is not supplied.
    if (!outputDir || !defaultMessages.size) {
      return;
    }

    const sortedMessages = [...defaultMessages].sort(([key1], [key2]) => key1.localeCompare(key2));
    await writeFileAsync(
      resolve(outputDir, 'en.json'),
      outputFormat === 'json5' ? serializeToJson5(sortedMessages) : serializeToJson(sortedMessages)
    );
  },
开发者ID:elastic,项目名称:kibana,代码行数:34,代码来源:run_i18n_extract.ts


示例2:

 this.project.documents.entries.forEach((document: Document) => {
   console.log(
     '  ',
     chalk.gray('Format:'),
     chalk.white.bold(document.format)
   )
   console.log('  ', chalk.gray('Path:'), chalk.white.bold(document.path))
   console.log('')
 })
开发者ID:mirego,项目名称:accent-cli,代码行数:9,代码来源:project-stats.ts


示例3: log

export function log( type: 'title' | 'success' | 'error' | 'step' | 'substep' | 'default' = 'default', message: string = '' ): void {

	switch( type ) {

		case 'title':
			console.log( chalk.white.bold.underline( message ) );
			break;

		case 'success':
			console.log( chalk.green.bold( message ) );
			break;

		case 'error':
			console.log( chalk.red.bold( message ) );
			break;

		case 'step':
			console.log( chalk.white.bold( `  ${  message }` ) );
			break;

		case 'substep':
			console.log( chalk.gray( `    ${ arrowSymbol } ${  message }` ) );
			break;

		default:
			console.log( message );

	}

}
开发者ID:dominique-mueller,项目名称:automatic-release,代码行数:30,代码来源:log.ts


示例4: onRootShutdown

function onRootShutdown(reason?: any) {
  if (reason !== undefined) {
    // There is a chance that logger wasn't configured properly and error that
    // that forced root to shut down could go unnoticed. To prevent this we always
    // mirror such fatal errors in standard output with `console.error`.
    // tslint:disable no-console
    console.error(`\n${chalk.white.bgRed(' FATAL ')} ${reason}\n`);
  }

  process.exit(reason === undefined ? 0 : (reason as any).processExitCode || 1);
}
开发者ID:njd5475,项目名称:kibana,代码行数:11,代码来源:bootstrap.ts


示例5: getCallbackId

  const sendRequest = <DataT extends object | undefined>(
    method: string, path: string, data?: DataT, authenticating: boolean = false
  ) => {
    // Pre-checks
    if (!authenticating && !socket().isConnected()) {
      logger.warn(`Attempting to send request on a non-authenticated socket: ${path}`);
      return Promise.reject('Not authorized');
    }

    if (!socket().nativeSocket) {
      logger.warn(`Attempting to send request without a socket: ${path}`);
      return Promise.reject('No socket');
    }

    const callbackId = getCallbackId();

    // Reporting
    invariant(path, 'Attempting socket request without a path');

    const ignored = eventIgnored(path, ignoredRequestPaths);
    if (!ignored) {
      logger.verbose(
        chalk.white.bold(callbackId.toString()), 
        method, 
        path, 
        data ? filterPassword(data) : '(no data)'
      );
    }

    // Callback
    const resolver = Promise.pending();

    callbacks[callbackId] = {
      time: new Date().getTime(),
      resolver,
      ignored,
    };

    // Actual request
    const request = {
      path,
      method,
      data,
      callback_id: callbackId,
    } as APIInternal.OutgoingRequest;

    socket().nativeSocket!.send(JSON.stringify(request));
    return resolver.promise;
  };
开发者ID:airdcpp-web,项目名称:airdcpp-apisocket-js,代码行数:49,代码来源:SocketRequestHandler.ts


示例6: extractDefaultMessages

export async function extractDefaultMessages({
  path,
  config,
}: {
  path?: string | string[];
  config: I18nConfig;
}) {
  const filteredPaths = filterConfigPaths(Array.isArray(path) ? path : [path || './'], config);
  if (filteredPaths.length === 0) {
    throw createFailError(
      `${chalk.white.bgRed(
        ' I18N ERROR '
      )} None of input paths is covered by the mappings in .i18nrc.json.`
    );
  }

  const reporter = new ErrorReporter();

  const list = new Listr(
    filteredPaths.map(filteredPath => ({
      task: async (messages: Map<string, unknown>) => {
        const initialErrorsNumber = reporter.errors.length;

        // Return result if no new errors were reported for this path.
        const result = await extractMessagesFromPathToMap(filteredPath, messages, config, reporter);
        if (reporter.errors.length === initialErrorsNumber) {
          return result;
        }

        // Throw an empty error to make Listr mark the task as failed without any message.
        throw new Error('');
      },
      title: filteredPath,
    })),
    {
      exitOnError: false,
    }
  );

  try {
    return await list.run(new Map());
  } catch (error) {
    if (error.name === 'ListrError' && reporter.errors.length) {
      throw createFailError(reporter.errors.join('\n\n'));
    }

    throw error;
  }
}
开发者ID:elastic,项目名称:kibana,代码行数:49,代码来源:extract_default_translations.ts


示例7: banner

/**
 * Standard output block to help call out these interstitial messages amidst
 * large test suite outputs.
 */
function banner(text: string): string {
  return chalk.white.bgRed(
      `*************************\n\n${text}\n\n*************************`);
}
开发者ID:,项目名称:,代码行数:8,代码来源:


示例8: echoStatus

	public echoStatus(prefix: string, statusText: string) {
		console.log(chalk.white.bold(prefix), chalk.green(statusText));
	}
开发者ID:duffman,项目名称:superbob,代码行数:3,代码来源:terminal.ts


示例9: async

  async ({
    flags: {
      'dry-run': dryRun = false,
      'ignore-incompatible': ignoreIncompatible = false,
      'ignore-missing': ignoreMissing = false,
      'ignore-unused': ignoreUnused = false,
      'include-config': includeConfig,
      path,
      source,
      target,
    },
    log,
  }) => {
    if (!source || typeof source === 'boolean') {
      throw createFailError(`${chalk.white.bgRed(' I18N ERROR ')} --source option isn't provided.`);
    }

    if (Array.isArray(source)) {
      throw createFailError(
        `${chalk.white.bgRed(' I18N ERROR ')} --source should be specified only once.`
      );
    }

    if (typeof target === 'boolean' || Array.isArray(target)) {
      throw createFailError(
        `${chalk.white.bgRed(
          ' I18N ERROR '
        )} --target should be specified only once and must have a value.`
      );
    }

    if (typeof path === 'boolean' || typeof includeConfig === 'boolean') {
      throw createFailError(
        `${chalk.white.bgRed(' I18N ERROR ')} --path and --include-config require a value`
      );
    }

    if (
      typeof ignoreIncompatible !== 'boolean' ||
      typeof ignoreUnused !== 'boolean' ||
      typeof ignoreMissing !== 'boolean' ||
      typeof dryRun !== 'boolean'
    ) {
      throw createFailError(
        `${chalk.white.bgRed(
          ' I18N ERROR '
        )} --ignore-incompatible, --ignore-unused, --ignore-missing, and --dry-run can't have values`
      );
    }

    const config = await mergeConfigs(includeConfig);
    const defaultMessages = await extractDefaultMessages({ path, config });

    await integrateLocaleFiles(defaultMessages, {
      sourceFileName: source,
      targetFileName: target,
      dryRun,
      ignoreIncompatible,
      ignoreUnused,
      ignoreMissing,
      config,
      log,
    });
  },
开发者ID:elastic,项目名称:kibana,代码行数:64,代码来源:run_i18n_integrate.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript chalk.yellow类代码示例发布时间:2022-05-24
下一篇:
TypeScript chalk.underline类代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap