Home / Function/ buildBenchmarkBundlesFromGitRepo() — react Function Reference

buildBenchmarkBundlesFromGitRepo() — react Function Reference

Architecture documentation for the buildBenchmarkBundlesFromGitRepo() function in build.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  a9800322_5064_0683_f71d_e6b13a41726a["buildBenchmarkBundlesFromGitRepo()"]
  5e153800_aec7_3467_f7c7_9d8fa2ae38f0["build.js"]
  a9800322_5064_0683_f71d_e6b13a41726a -->|defined in| 5e153800_aec7_3467_f7c7_9d8fa2ae38f0
  f1905353_2906_d015_f5e7_4d55d64c0d47["getDefaultReactPath()"]
  a9800322_5064_0683_f71d_e6b13a41726a -->|calls| f1905353_2906_d015_f5e7_4d55d64c0d47
  2b7a37cb_7935_a41f_d739_bef137a8e6cb["cleanDir()"]
  a9800322_5064_0683_f71d_e6b13a41726a -->|calls| 2b7a37cb_7935_a41f_d739_bef137a8e6cb
  d6217845_7bd8_7f14_d2dd_5a7360050c6d["buildReactBundles()"]
  a9800322_5064_0683_f71d_e6b13a41726a -->|calls| d6217845_7bd8_7f14_d2dd_5a7360050c6d
  style a9800322_5064_0683_f71d_e6b13a41726a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/bench/build.js lines 62–102

async function buildBenchmarkBundlesFromGitRepo(
  commitId,
  skipBuild,
  url = reactUrl,
  clean
) {
  let repo;
  const remoteRepoDir = getDefaultReactPath();

  if (!skipBuild) {
    if (clean) {
      //clear remote-repo folder
      await cleanDir(remoteRepoDir);
    }
    // check if remote-repo directory already exists
    if (existsSync(remoteRepoDir)) {
      repo = await Git.Repository.open(remoteRepoDir);
      // fetch all the latest remote changes
      await repo.fetchAll();
    } else {
      // if not, clone the repo to remote-repo folder
      repo = await Git.Clone(url, remoteRepoDir);
    }
    let commit = await repo.getBranchCommit('main');
    // reset hard to this remote head
    await Git.Reset.reset(repo, commit, Git.Reset.TYPE.HARD);
    // then we checkout the latest main head
    await repo.checkoutBranch('main');
    // make sure we pull in the latest changes
    await repo.mergeBranches('main', 'origin/main');
    // then we check if we need to move the HEAD to the merge base
    if (commitId && commitId !== 'main') {
      // as the commitId probably came from our local repo
      // we use it to lookup the right commit in our remote repo
      commit = await Git.Commit.lookup(repo, commitId);
      // then we checkout the merge base
      await Git.Checkout.tree(repo, commit);
    }
    await buildReactBundles();
  }
}

Domain

Subdomains

Frequently Asked Questions

What does buildBenchmarkBundlesFromGitRepo() do?
buildBenchmarkBundlesFromGitRepo() is a function in the react codebase, defined in scripts/bench/build.js.
Where is buildBenchmarkBundlesFromGitRepo() defined?
buildBenchmarkBundlesFromGitRepo() is defined in scripts/bench/build.js at line 62.
What does buildBenchmarkBundlesFromGitRepo() call?
buildBenchmarkBundlesFromGitRepo() calls 3 function(s): buildReactBundles, cleanDir, getDefaultReactPath.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free