build.js — react Source File
Architecture documentation for build.js, a javascript file in the react codebase.
Entity Profile
Relationship Graph
Source Code
#!/usr/bin/env node
'use strict';
const archiver = require('archiver');
const {execSync} = require('child_process');
const {readFileSync, writeFileSync, createWriteStream} = require('fs');
const {copy, ensureDir, move, remove, pathExistsSync} = require('fs-extra');
const {join, resolve, basename} = require('path');
const {getGitCommit} = require('./utils');
// These files are copied along with Webpack-bundled files
// to produce the final web extension
const STATIC_FILES = ['icons', 'popups', 'main.html', 'panel.html'];
/**
* Ensures that a local build of the dependencies exist either by downloading
* or running a local build via one of the `react-build-fordevtools*` scripts.
*/
const ensureLocalBuild = async () => {
const buildDir = resolve(__dirname, '..', '..', 'build');
const nodeModulesDir = join(buildDir, 'node_modules');
// TODO: remove this check whenever the CI pipeline is complete.
// See build-all-release-channels.js
const currentBuildDir = resolve(
__dirname,
'..',
'..',
'build',
'oss-experimental',
);
if (pathExistsSync(buildDir)) {
return; // all good.
}
if (pathExistsSync(currentBuildDir)) {
await ensureDir(buildDir);
await copy(currentBuildDir, nodeModulesDir);
return; // all good.
}
throw Error(
'Could not find build artifacts in repo root. See README for prerequisites.',
);
};
const preProcess = async (destinationPath, tempPath) => {
await remove(destinationPath); // Clean up from previously completed builds
await remove(tempPath); // Clean up from any previously failed builds
await ensureDir(tempPath); // Create temp dir for this new build
};
const build = async (tempPath, manifestPath, envExtension = {}) => {
const binPath = join(tempPath, 'bin');
const zipPath = join(tempPath, 'zip');
const mergedEnv = {...process.env, ...envExtension};
const webpackPath = join(__dirname, 'node_modules', '.bin', 'webpack');
// ... (139 more lines)
Domain
Subdomains
Source
Frequently Asked Questions
What does build.js do?
build.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in build.js?
build.js defines 5 function(s): build, ensureLocalBuild, main, postProcess, preProcess.
Where is build.js in the architecture?
build.js is located at packages/react-devtools-extensions/build.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-extensions).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free