| 18 | * or running a local build via one of the `react-build-fordevtools*` scripts. |
| 19 | */ |
| 20 | const ensureLocalBuild = async () => { |
| 21 | const buildDir = resolve(__dirname, '..', '..', 'build'); |
| 22 | const nodeModulesDir = join(buildDir, 'node_modules'); |
| 23 | |
| 24 | // TODO: remove this check whenever the CI pipeline is complete. |
| 25 | // See build-all-release-channels.js |
| 26 | const currentBuildDir = resolve( |
| 27 | __dirname, |
| 28 | '..', |
| 29 | '..', |
| 30 | 'build', |
| 31 | 'oss-experimental', |
| 32 | ); |
| 33 | |
| 34 | if (pathExistsSync(buildDir)) { |
| 35 | return; // all good. |
| 36 | } |
| 37 | |
| 38 | if (pathExistsSync(currentBuildDir)) { |
| 39 | await ensureDir(buildDir); |
| 40 | await copy(currentBuildDir, nodeModulesDir); |
| 41 | return; // all good. |
| 42 | } |
| 43 | |
| 44 | throw Error( |
| 45 | 'Could not find build artifacts in repo root. See README for prerequisites.', |
| 46 | ); |
| 47 | }; |
| 48 | |
| 49 | const preProcess = async (destinationPath, tempPath) => { |
| 50 | await remove(destinationPath); // Clean up from previously completed builds |