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

TypeScript dedent.default函数代码示例

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

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



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

示例1: run

async function run(folder: string): Promise<boolean> {
  const log = new ToolingLog({
    level: 'info',
    writeTo: process.stdout,
  });

  const extraFlags: string[] = [];
  const opts = getopts(process.argv.slice(2), {
    boolean: ['accept', 'docs', 'help'],
    default: {
      project: undefined,
    },
    unknown(name) {
      extraFlags.push(name);
      return false;
    },
  });

  if (extraFlags.length > 0) {
    for (const flag of extraFlags) {
      log.error(`Unknown flag: ${flag}`);
    }

    opts.help = true;
  }

  if (opts.help) {
    process.stdout.write(
      dedent(chalk`
        {dim usage:} node scripts/check_core_api_changes [...options]

        Checks for any changes to the Kibana Core API

        Examples:

          {dim # Checks for any changes to the Kibana Core API}
          {dim $} node scripts/check_core_api_changes

          {dim # Checks for any changes to the Kibana Core API and updates the documentation}
          {dim $} node scripts/check_core_api_changes --docs

          {dim # Checks for and automatically accepts and updates documentation for any changes to the Kibana Core API}
          {dim $} node scripts/check_core_api_changes --accept

        Options:
          --accept    {dim Accepts all changes by updating the API Review files and documentation}
          --docs      {dim Updates the Core API documentation}
          --help      {dim Show this message}
      `)
    );
    process.stdout.write('\n');
    return !(extraFlags.length > 0);
  }

  log.info(`Core ${folder} API: checking for changes in API signature...`);

  try {
    await runBuildTypes();
  } catch (e) {
    log.error(e);
    return false;
  }

  const { apiReportChanged, succeeded } = runApiExtractor(log, folder, opts.accept);

  // If we're not accepting changes and there's a failure, exit.
  if (!opts.accept && !succeeded) {
    return false;
  }

  // Attempt to generate docs even if api-extractor didn't succeed
  if ((opts.accept && apiReportChanged) || opts.docs) {
    try {
      await renameExtractedApiPackageName(folder);
      await runApiDocumenter(folder);
    } catch (e) {
      log.error(e);
      return false;
    }
    log.info(`Core ${folder} API: updated documentation ✔`);
  }

  // If any errors or warnings occured, exit with an error
  return succeeded;
}
开发者ID:horacimacias,项目名称:kibana,代码行数:85,代码来源:run_check_core_api_changes.ts


示例2: runTypeCheckCli

export function runTypeCheckCli() {
  const extraFlags: string[] = [];
  const opts = getopts(process.argv.slice(2), {
    boolean: ['skip-lib-check', 'help'],
    default: {
      project: undefined,
    },
    unknown(name) {
      extraFlags.push(name);
      return false;
    },
  });

  const log = new ToolingLog({
    level: 'info',
    writeTo: process.stdout,
  });

  if (extraFlags.length) {
    for (const flag of extraFlags) {
      log.error(`Unknown flag: ${flag}`);
    }

    process.exitCode = 1;
    opts.help = true;
  }

  if (opts.help) {
    process.stdout.write(
      dedent(chalk`
        {dim usage:} node scripts/type_check [...options]

        Run the TypeScript compiler without emitting files so that it can check
        types during development.

        Examples:

          {dim # check types in all projects}
          {dim $} node scripts/type_check

          {dim # check types in a single project}
          {dim $} node scripts/type_check --project packages/kbn-pm/tsconfig.json

        Options:

          --project [path]    {dim Path to a tsconfig.json file determines the project to check}
          --skip-lib-check    {dim Skip type checking of all declaration files (*.d.ts)}
          --help              {dim Show this message}
      `)
    );
    process.stdout.write('\n');
    process.exit();
  }

  const tscArgs = ['--noEmit', '--pretty', ...(opts['skip-lib-check'] ? ['--skipLibCheck'] : [])];
  const projects = filterProjectsByFlag(opts.project);

  if (!projects.length) {
    log.error(`Unable to find project at ${opts.project}`);
    process.exit(1);
  }

  execInProjects(log, projects, 'tsc', project => ['--project', project.tsConfigPath, ...tscArgs]);
}
开发者ID:austec-automation,项目名称:kibana,代码行数:64,代码来源:run_type_check_cli.ts


示例3: getHelp

export function getHelp(options: Options) {
  const usage = options.usage || `node ${relative(process.cwd(), process.argv[1])}`;

  const optionHelp = (
    dedent((options.flags && options.flags.help) || '') +
    '\n' +
    dedent`
      --verbose, -v      Log verbosely
      --debug            Log debug messages (less than verbose)
      --quiet            Only log errors
      --silent           Don't log anything
      --help             Show this message
    `
  )
    .split('\n')
    .filter(Boolean)
    .join('\n    ');

  return `
  ${usage}

  ${dedent(options.description || 'Runs a dev task')
    .split('\n')
    .join('\n  ')}

  Options:
    ${optionHelp}
`;
}
开发者ID:njd5475,项目名称:kibana,代码行数:29,代码来源:flags.ts


示例4: dedent

import dedent from 'dedent';

export const enableXdebug = dedent(`
  if test ! -z "\${F1_XDEBUG:-}"; then
    docker-php-ext-enable xdebug
    echo 'xdebug.remote_enable=1' > /usr/local/etc/php/conf.d/xdebug.ini
  fi
`);

// The following are interpolations for Docker Compose files, not mistaken backtick
// interpolations.
// tslint:disable:no-invalid-template-strings
export const xdebugEnvironment: Readonly<Record<string, string>> = {
  XDEBUG_CONFIG: 'remote_host=${F1_XDEBUG_REMOTE:-127.0.0.1}',
};
开发者ID:forumone,项目名称:generator-web-starter,代码行数:15,代码来源:xdebug.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript deep-equal.default函数代码示例发布时间:2022-05-25
下一篇:
TypeScript decompress-zip.on函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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