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


TypeScript ora.promise函数代码示例

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


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

示例1: run

export const CleanCommand: Command = {
  name: 'clean',
  description:
    'Remove the node_modules and target directories from all projects.',

  async run(projects, projectGraph, { rootPath }) {
    const directoriesToDelete = [];
    for (const project of projects.values()) {
      if (await isDirectory(project.nodeModulesLocation)) {
        directoriesToDelete.push(project.nodeModulesLocation);
      }

      if (await isDirectory(project.targetLocation)) {
        directoriesToDelete.push(project.targetLocation);
      }
    }

    if (directoriesToDelete.length === 0) {
      console.log(chalk.bold.green('\n\nNo directories to delete'));
    } else {
      console.log(chalk.bold.red('\n\nDeleting directories:\n'));

      for (const dir of directoriesToDelete) {
        const deleting = del(dir, { force: true });
        ora.promise(deleting, relative(rootPath, dir));
        await deleting;
      }
    }
  },
};
开发者ID:cccnam5158,项目名称:kibana,代码行数:30,代码来源:clean.ts

示例2: del

    }

    if (toDelete.length === 0) {
      log.write(chalk.bold.green('\n\nNothing to delete'));
    } else {
      log.write(chalk.bold.red('\n\nDeleting:\n'));

      /**
       * In order to avoid patterns like `/build` in packages from accidentally
       * impacting files outside the package we use `process.chdir()` to change
       * the cwd to the package and execute `del()` without the `force` option
       * so it will check that each file being deleted is within the package.
       *
       * `del()` does support a `cwd` option, but it's only for resolving the
       * patterns and does not impact the cwd check.
       */
      const originalCwd = process.cwd();
      try {
        for (const { pattern, cwd } of toDelete) {
          process.chdir(cwd);
          const promise = del(pattern);
          ora.promise(promise, relative(originalCwd, join(cwd, String(pattern))));
          await promise;
        }
      } finally {
        process.chdir(originalCwd);
      }
    }
  },
};
开发者ID:austec-automation,项目名称:kibana,代码行数:30,代码来源:clean.ts


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