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


TypeScript chalk.white类代码示例

本文整理汇总了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;未经允许,请勿转载。