當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript format.columnar函數代碼示例

本文整理匯總了TypeScript中@ionic/cli-framework/utils/format.columnar函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript columnar函數的具體用法?TypeScript columnar怎麽用?TypeScript columnar使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了columnar函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: run

  async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
    const registry = await this.getRegistry();

    const rows = registry.ailments.map(ailment => {
      const tags: string[] = [];
      const ignored = this.env.config.get(`doctor.issues.${ailment.id}.ignored` as any);

      if (ignored) {
        tags.push('ignored');
      }

      if (isTreatableAilment(ailment)) {
        tags.push('treatable');
      }

      if (!ailment.implicit) {
        tags.push('explicit-detection');
      }

      return [
        input(ailment.id),
        ailment.projects ? ailment.projects.map(t => strong(t)).join(', ') : 'all',
        tags.map(t => strong(t)).join(', '),
      ];
    });

    rows.sort((row1, row2) => strcmp(row1[0], row2[0]));

    this.env.log.rawmsg(columnar(rows, { headers: ['id', 'affected projects', 'tags'] }));
  }
開發者ID:driftyco,項目名稱:ionic-cli,代碼行數:30,代碼來源:list.ts

示例2: run

  async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
    if (!this.project) {
      throw new FatalException(`Cannot run ${input('ionic deploy build')} outside a project directory.`);
    }

    const token = this.env.session.getUserToken();
    const appflowId = await this.project.requireAppflowId();

    if (!options.commit) {
      options.commit = (await this.env.shell.output('git', ['rev-parse', 'HEAD'], { cwd: this.project.directory })).trim();
      debug(`Commit hash: ${strong(options.commit)}`);
    }

    let build = await this.createDeployBuild(appflowId, token, options);
    const buildId = build.job_id;

    const details = columnar([
      ['App ID', strong(appflowId)],
      ['Build ID', strong(buildId.toString())],
      ['Commit', strong(`${build.commit.sha.substring(0, 6)} ${build.commit.note}`)],
      ['Environment', build.environment_name ? strong(build.environment_name) : weak('not set')],
      ['Channels', build.pending_channels.length ? build.pending_channels.map(v => strong(`"${v}"`)).join(', ') : weak('not set')],
    ], { vsep: ':' });

    this.env.log.ok(
      `Build created\n` +
      details + '\n\n'
    );

    build = await this.tailBuildLog(appflowId, buildId, token);
    if (build.state !== 'success') {
      throw new Error('Build failed');
    }

  }
開發者ID:driftyco,項目名稱:ionic-cli,代碼行數:35,代碼來源:build.ts

示例3: verifyOptions

export function verifyOptions(options: CommandLineOptions, { log }: { log: ILogger; }): void {
  // If the action is list then lets just end here.
  if (options['list']) {
    const headers = ['name', 'description'];
    const typeOption = options['type'] ? String(options['type']) : undefined;

    if (typeOption && !PROJECT_TYPES.includes(typeOption as ProjectType)) {
      throw new FatalException(
        `${input(typeOption)} is not a valid project type.\n` +
        `Valid project types are: ${getStarterProjectTypes().map(type => input(type)).join(', ')}`
      );
    }

    const starterTypes = typeOption ? [typeOption] : getStarterProjectTypes();

    for (const starterType of starterTypes) {
      const starters = STARTER_TEMPLATES.filter(template => template.projectType === starterType);

      log.rawmsg(`\n${strong(`Starters for ${prettyProjectName(starterType)}`)} (${input(`--type=${starterType}`)})\n\n`);
      log.rawmsg(columnar(starters.map(({ name, description }) => [input(name), description || '']), { headers }));
      log.rawmsg('\n');
    }

    throw new FatalException('', 0);
  }

  if (options['skip-deps']) {
    log.warn(`The ${input('--skip-deps')} option has been deprecated. Please use ${input('--no-deps')}.`);
    options['deps'] = false;
  }

  if (options['skip-link']) {
    log.warn(`The ${input('--skip-link')} option has been deprecated. Please use ${input('--no-link')}.`);
    options['link'] = false;
  }

  if (options['pro-id']) {
    log.warn(`The ${input('--pro-id')} option has been deprecated. Please use ${input('--id')}.`);
    options['id'] = options['pro-id'];
  }

  if (options['id']) {
    if (options['link'] === false) {
      log.warn(`The ${input('--no-link')} option has no effect with ${input('--id')}. App must be linked.`);
    }

    options['link'] = true;

    if (!options['git']) {
      log.warn(`The ${input('--no-git')} option has no effect with ${input('--id')}. Git must be used.`);
    }

    options['git'] = true;
  }
}
開發者ID:driftyco,項目名稱:ionic-cli,代碼行數:55,代碼來源:start.ts

示例4: run

  async run(): Promise<void> {
    const data = [
      [`${indent(4)}${input('ionic cordova platform save')}`, `save existing installed platforms to ${strong('config.xml')}`],
      [`${indent(4)}${input('ionic cordova plugin save')}`, `save existing installed plugins to ${strong('config.xml')}`],
      [`${indent(4)}${input('ionic cordova platform --help')}`, `view help page for managing Cordova platforms`],
      [`${indent(4)}${input('ionic cordova plugin --help')}`, `view help page for managing Cordova plugins`],
      [`${indent(4)}${input('ionic cordova prepare')}`, `install platforms and plugins listed in ${strong('config.xml')}`],
    ];

    throw new FatalException(
      `${input('ionic state')} has been removed.\n\n` +
      `We recommend using Cordova directly to manage Cordova plugins and platforms.\n` +
      `The following commands fulfill the old ${input('ionic state')} functionality:\n\n` +
      `${columnar(data, {})}\n\n` +
      `See ${strong('https://cordova.apache.org/docs/en/latest/platform_plugin_versioning_ref/')} for detailed information.\n`
    );
  }
開發者ID:driftyco,項目名稱:ionic-cli,代碼行數:17,代碼來源:state.ts

示例5: printConfig

  printConfig(ctx: ConfigContext, v: any): void {
    const { global, json } = ctx;

    if (json) {
      process.stdout.write(this.jsonStringify(v));
    } else {
      if (global && v && typeof v === 'object') {
        const columns = lodash.entries(v)
          .map(([k, v]) => [k, this.sanitizeEntry(k, v)])
          .map(([k, v]) => [strong(k), util.inspect(v, { colors: chalk.enabled })]);

        columns.sort((a, b) => strcmp(a[0], b[0]));

        this.env.log.rawmsg(columnar(columns, {}));
      } else {
        this.env.log.rawmsg(util.inspect(v, { depth: Infinity, colors: chalk.enabled }));
      }
    }
  }
開發者ID:driftyco,項目名稱:ionic-cli,代碼行數:19,代碼來源:get.ts

示例6: run

  async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
    const { loadConfigXml } = await import('../../lib/integrations/cordova/config');

    if (!this.project) {
      throw new FatalException(`Cannot run ${input('ionic monitoring syncmaps')} outside a project directory.`);
    }

    const token = this.env.session.getUserToken();
    const appflowId = await this.project.requireAppflowId();

    const [ snapshotId ] = inputs;
    const doBuild = options.build ? true : false;

    const cordova = this.project.requireIntegration('cordova');
    const conf = await loadConfigXml(cordova);
    const cordovaInfo = conf.getProjectInfo();

    const appVersion = cordovaInfo.version;
    const commitHash = (await this.env.shell.output('git', ['rev-parse', 'HEAD'], { cwd: this.project.directory })).trim();
    debug(`Commit hash: ${strong(commitHash)}`);

    const sourcemapsDir = path.resolve(this.project.directory, SOURCEMAP_DIRECTORY);
    let sourcemapsExist = await pathExists(sourcemapsDir);

    if (doBuild || !sourcemapsExist) {
      // TODO: use runner directly
      await build({ config: this.env.config, log: this.env.log, shell: this.env.shell, prompt: this.env.prompt, project: this.project }, [], { _: [], prod: true });
    }

    sourcemapsExist = await pathExists(sourcemapsDir);

    if (sourcemapsExist) {
      this.env.log.msg(`Using existing sourcemaps in ${strong(prettyPath(sourcemapsDir))}`);
    } else { // TODO: this is hard-coded for ionic-angular, make it work for all project types
      throw new FatalException(
        `Cannot find directory: ${strong(prettyPath(sourcemapsDir))}.\n` +
        `Make sure you have the latest ${strong('@ionic/app-scripts')}. Then, re-run this command.`
      );
    }

    let count = 0;
    const tasks = this.createTaskChain();
    const syncTask = tasks.next('Syncing sourcemaps');

    const sourcemapFiles = (await readdirSafe(sourcemapsDir)).filter(f => f.endsWith('.js.map'));
    debug(`Found ${sourcemapFiles.length} sourcemap files: ${sourcemapFiles.map(f => strong(f)).join(', ')}`);

    await Promise.all(sourcemapFiles.map(async f => {
      await this.syncSourcemap(path.resolve(sourcemapsDir, f), snapshotId, appVersion, commitHash, appflowId, token);
      count += 1;
      syncTask.msg = `Syncing sourcemaps: ${strong(`${count} / ${sourcemapFiles.length}`)}`;
    }));

    syncTask.msg = `Syncing sourcemaps: ${strong(`${sourcemapFiles.length} / ${sourcemapFiles.length}`)}`;
    tasks.end();

    const details = columnar([
      ['App ID', strong(appflowId)],
      ['Version', strong(appVersion)],
      ['Package ID', strong(cordovaInfo.id)],
      ['Snapshot ID', snapshotId ? strong(snapshotId) : weak('not set')],
    ], { vsep: ':' });

    this.env.log.ok(
      `Sourcemaps synced!\n` +
      details + '\n\n' +
      `See the Error Monitoring docs for usage information and next steps: ${strong('https://ionicframework.com/docs/appflow/monitoring')}`
    );
  }
開發者ID:driftyco,項目名稱:ionic-cli,代碼行數:69,代碼來源:syncmaps.ts

示例7: columnar

 const format = (details: [string, string][]) => columnar(details, { vsep: ':' });
開發者ID:driftyco,項目名稱:ionic-cli,代碼行數:1,代碼來源:info.ts


注:本文中的@ionic/cli-framework/utils/format.columnar函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。