( commitId, skipBuild, url = reactUrl, clean )
| 60 | } |
| 61 | |
| 62 | async 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 | |
| 104 | async function buildReactBundles(reactPath = getDefaultReactPath(), skipBuild) { |
| 105 | if (!skipBuild) { |
no test coverage detected