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


TypeScript terminal.red方法代码示例

本文整理汇总了TypeScript中@angular-devkit/core.terminal.red方法的典型用法代码示例。如果您正苦于以下问题:TypeScript terminal.red方法的具体用法?TypeScript terminal.red怎么用?TypeScript terminal.red使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular-devkit/core.terminal的用法示例。


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

示例1: resolve

 .on('close', (code: number) => {
   if (code === 0) {
     logger.info(terminal.green(`Installed packages for tooling via ${packageManager}.`));
     resolve();
   } else {
     const message = 'Package install failed, see above.';
     logger.info(terminal.red(message));
     reject(message);
   }
 });
开发者ID:DevIntent,项目名称:angular-cli,代码行数:10,代码来源:npm-install.ts

示例2:

 color = (x) => terminal.bold(terminal.red(x));
开发者ID:nickroberts,项目名称:angular-cli,代码行数:1,代码来源:index.ts

示例3:

 fatal: s => terminal.bold(terminal.red(s)),
开发者ID:angular,项目名称:angular-cli,代码行数:1,代码来源:index.ts

示例4:

 color = (x: string) => terminal.bold(terminal.red(x));
开发者ID:angular,项目名称:angular-cli,代码行数:1,代码来源:main.ts

示例5: _executeTarget

async function _executeTarget(
  parentLogger: logging.Logger,
  workspace: experimental.workspace.Workspace,
  root: string,
  argv: minimist.ParsedArgs,
  registry: json.schema.SchemaRegistry,
) {
  const architectHost = new WorkspaceNodeModulesArchitectHost(workspace, root);
  const architect = new Architect(architectHost, registry);

  // Split a target into its parts.
  const targetStr = argv._.shift() || '';
  const [project, target, configuration] = targetStr.split(':');
  const targetSpec = { project, target, configuration };

  delete argv['help'];
  delete argv['_'];

  const logger = new logging.Logger('jobs');
  const logs: logging.LogEntry[] = [];
  logger.subscribe(entry => logs.push({ ...entry, message: `${entry.name}: ` + entry.message }));

  const run = await architect.scheduleTarget(targetSpec, argv, { logger });
  const bars = new MultiProgressBar<number, BarInfo>(':name :bar (:current/:total) :status');

  run.progress.subscribe(
    update => {
      const data = bars.get(update.id) || {
        id: update.id,
        builder: update.builder,
        target: update.target,
        status: update.status || '',
        name: ((update.target ? _targetStringFromTarget(update.target) : update.builder.name)
                + ' '.repeat(80)
              ).substr(0, 40),
      };

      if (update.status !== undefined) {
        data.status = update.status;
      }

      switch (update.state) {
        case BuilderProgressState.Error:
          data.status = 'Error: ' + update.error;
          bars.update(update.id, data);
          break;

        case BuilderProgressState.Stopped:
          data.status = 'Done.';
          bars.complete(update.id);
          bars.update(update.id, data, update.total, update.total);
          break;

        case BuilderProgressState.Waiting:
          bars.update(update.id, data);
          break;

        case BuilderProgressState.Running:
          bars.update(update.id, data, update.current, update.total);
          break;
      }

      bars.render();
    },
  );

  // Wait for full completion of the builder.
  try {
    const { success } = await run.output.pipe(
      tap(result => {
        if (result.success) {
          parentLogger.info(terminal.green('SUCCESS'));
        } else {
          parentLogger.info(terminal.yellow('FAILURE'));
        }
        parentLogger.info('Result: ' + JSON.stringify({ ...result, info: undefined }, null, 4));

        parentLogger.info('\nLogs:');
        logs.forEach(l => parentLogger.next(l));
        logs.splice(0);
      }),
    ).toPromise();

    await run.stop();
    bars.terminate();

    return success ? 0 : 1;
  } catch (err) {
    parentLogger.info(terminal.red('ERROR'));
    parentLogger.info('\nLogs:');
    logs.forEach(l => parentLogger.next(l));

    parentLogger.fatal('Exception:');
    parentLogger.fatal(err.stack);

    return 2;
  }
}
开发者ID:angular,项目名称:angular-cli,代码行数:98,代码来源:architect.ts


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