How to use the umi-utils.getFastGithub function in umi-utils

To help you get started, we’ve selected a few umi-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github umijs / umi / packages / umi-build-dev / src / plugins / commands / block / download.js View on Github external
export async function parseGitUrl(url, closeFastGithub) {
  const args = GitUrlParse(url);
  const { ref, filepath, resource, full_name: fullName } = args;
  const fastGithub = await getFastGithub();

  // 如果是 github 并且 autoFastGithub =true 使用
  // 因为自动转化只支持 github 也可以需要关掉
  const repo =
    resource === 'github.com' && !closeFastGithub
      ? args.toString().replace(`${resource}`, fastGithub)
      : args.toString();

  return {
    repo: urlAddGit(repo),
    branch: ref || 'master',
    path: `/${filepath}`,
    id: `${resource}/${fullName}`, // 唯一标识一个 git 仓库
  };
}