MCPcopy Index your code
hub / github.com/react/react / buildBenchmarkBundlesFromGitRepo

Function buildBenchmarkBundlesFromGitRepo

scripts/bench/build.js:62–102  ·  view source on GitHub ↗
(
  commitId,
  skipBuild,
  url = reactUrl,
  clean
)

Source from the content-addressed store, hash-verified

60}
61
62async function buildBenchmarkBundlesFromGitRepo(
63 commitId,
64 skipBuild,
65 url = reactUrl,
66 clean
67) {
68 let repo;
69 const remoteRepoDir = getDefaultReactPath();
70
71 if (!skipBuild) {
72 if (clean) {
73 //clear remote-repo folder
74 await cleanDir(remoteRepoDir);
75 }
76 // check if remote-repo directory already exists
77 if (existsSync(remoteRepoDir)) {
78 repo = await Git.Repository.open(remoteRepoDir);
79 // fetch all the latest remote changes
80 await repo.fetchAll();
81 } else {
82 // if not, clone the repo to remote-repo folder
83 repo = await Git.Clone(url, remoteRepoDir);
84 }
85 let commit = await repo.getBranchCommit('main');
86 // reset hard to this remote head
87 await Git.Reset.reset(repo, commit, Git.Reset.TYPE.HARD);
88 // then we checkout the latest main head
89 await repo.checkoutBranch('main');
90 // make sure we pull in the latest changes
91 await repo.mergeBranches('main', 'origin/main');
92 // then we check if we need to move the HEAD to the merge base
93 if (commitId && commitId !== 'main') {
94 // as the commitId probably came from our local repo
95 // we use it to lookup the right commit in our remote repo
96 commit = await Git.Commit.lookup(repo, commitId);
97 // then we checkout the merge base
98 await Git.Checkout.tree(repo, commit);
99 }
100 await buildReactBundles();
101 }
102}
103
104async function buildReactBundles(reactPath = getDefaultReactPath(), skipBuild) {
105 if (!skipBuild) {

Callers 2

benchmarkRemoteMasterFunction · 0.85
build.jsFile · 0.85

Calls 5

getDefaultReactPathFunction · 0.85
cleanDirFunction · 0.85
buildReactBundlesFunction · 0.85
lookupMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected