Home / Function/ main() — react Function Reference

main() — react Function Reference

Architecture documentation for the main() function in build.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  f4cba043_abf3_95c1_fa89_6f55c2a706e8["main()"]
  6bf26a4c_9380_8ddd_2ce3_33d2a96b42f6["build.js"]
  f4cba043_abf3_95c1_fa89_6f55c2a706e8 -->|defined in| 6bf26a4c_9380_8ddd_2ce3_33d2a96b42f6
  style f4cba043_abf3_95c1_fa89_6f55c2a706e8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-extensions/chrome/build.js lines 12–54

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');
};

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the react codebase, defined in packages/react-devtools-extensions/chrome/build.js.
Where is main() defined?
main() is defined in packages/react-devtools-extensions/chrome/build.js at line 12.

Analyze Your Own Codebase

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

Try Supermodel Free