Home / File/ build.js — react Source File

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 chalk = require('chalk');
const {execSync} = require('child_process');
const {existsSync} = require('fs');
const {isAbsolute, join, relative} = require('path');
const {argv} = require('yargs');
const build = require('../build');

const main = async () => {
  const {crx, keyPath} = argv;

  if (crx) {
    if (!keyPath || !existsSync(keyPath)) {
      console.error('Must specify a key file (.pem) to build CRX');
      process.exit(1);
    }
  }

  await build('chrome');

  if (crx) {
    const cwd = join(__dirname, 'build');

    let safeKeyPath = keyPath;
    if (!isAbsolute(keyPath)) {
      safeKeyPath = join(relative(cwd, process.cwd()), keyPath);
    }

    const crxPath = join(
      __dirname,
      '..',
      '..',
      '..',
      'node_modules',
      '.bin',
      'crx'
    );

    execSync(
      `${crxPath} pack ./unpacked -o ReactDevTools.crx -p ${safeKeyPath}`,
      {
        cwd,
      }
    );
  }

  console.log(chalk.green('\nThe Chrome extension has been built!'));
  console.log(chalk.green('You can test this build by running:'));
  console.log(chalk.gray('\n# From the react-devtools root directory:'));
  console.log('yarn run test:chrome');
};

main();

Domain

Subdomains

Functions

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 1 function(s): main.
Where is build.js in the architecture?
build.js is located at packages/react-devtools-extensions/chrome/build.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-devtools-extensions/chrome).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free