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

Function ensureLocalBuild

packages/react-devtools-extensions/build.js:20–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18 * or running a local build via one of the `react-build-fordevtools*` scripts.
19 */
20const 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
49const preProcess = async (destinationPath, tempPath) => {
50 await remove(destinationPath); // Clean up from previously completed builds

Callers 1

mainFunction · 0.85

Calls 1

resolveFunction · 0.50

Tested by

no test coverage detected