Home / Function/ main() — react Function Reference

main() — react Function Reference

Architecture documentation for the main() function in build-all-release-channels.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  c4f900f2_b639_f662_05d1_7ae05c59be96["main()"]
  39121ebe_f6d4_878e_0797_7a6b417f5f9a["build-all-release-channels.js"]
  c4f900f2_b639_f662_05d1_7ae05c59be96 -->|defined in| 39121ebe_f6d4_878e_0797_7a6b417f5f9a
  4ed01f41_672c_8a65_1fb5_8247f07c8ea2["buildForChannel()"]
  c4f900f2_b639_f662_05d1_7ae05c59be96 -->|calls| 4ed01f41_672c_8a65_1fb5_8247f07c8ea2
  01896c6c_c39f_713c_b9f5_5c924e738cdc["processStable()"]
  c4f900f2_b639_f662_05d1_7ae05c59be96 -->|calls| 01896c6c_c39f_713c_b9f5_5c924e738cdc
  07ae733a_8302_4852_ff9b_8b779bea6dc2["processExperimental()"]
  c4f900f2_b639_f662_05d1_7ae05c59be96 -->|calls| 07ae733a_8302_4852_ff9b_8b779bea6dc2
  70494cf8_258a_5622_2e05_dcbc5359dcd2["crossDeviceRenameSync()"]
  c4f900f2_b639_f662_05d1_7ae05c59be96 -->|calls| 70494cf8_258a_5622_2e05_dcbc5359dcd2
  7ad0c2c9_c1ee_5560_ac57_a18e3b4d8ac9["mergeDirsSync()"]
  c4f900f2_b639_f662_05d1_7ae05c59be96 -->|calls| 7ad0c2c9_c1ee_5560_ac57_a18e3b4d8ac9
  style c4f900f2_b639_f662_05d1_7ae05c59be96 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/rollup/build-all-release-channels.js lines 111–156

async function main() {
  if (argv.ci === true) {
    buildForChannel(argv.releaseChannel, argv.total, argv.index);
    switch (argv.releaseChannel) {
      case 'stable': {
        processStable('./build');
        break;
      }
      case 'experimental': {
        processExperimental('./build');
        break;
      }
      default:
        throw new Error(`Unknown release channel ${argv.releaseChannel}`);
    }
  } else {
    const releaseChannel = argv.releaseChannel;
    if (releaseChannel === 'stable') {
      buildForChannel('stable', '', '');
      processStable('./build');
    } else if (releaseChannel === 'experimental') {
      buildForChannel('experimental', '', '');
      processExperimental('./build');
    } else {
      // Running locally, no concurrency. Move each channel's build artifacts into
      // a temporary directory so that they don't conflict.
      buildForChannel('stable', '', '');
      const stableDir = tmp.dirSync().name;
      crossDeviceRenameSync('./build', stableDir);
      processStable(stableDir);
      buildForChannel('experimental', '', '');
      const experimentalDir = tmp.dirSync().name;
      crossDeviceRenameSync('./build', experimentalDir);
      processExperimental(experimentalDir);

      // Then merge the experimental folder into the stable one. processExperimental
      // will have already removed conflicting files.
      //
      // In CI, merging is handled by the GitHub Download Artifacts plugin.
      mergeDirsSync(experimentalDir + '/', stableDir + '/');

      // Now restore the combined directory back to its original name
      crossDeviceRenameSync(stableDir, './build');
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

What does main() do?
main() is a function in the react codebase, defined in scripts/rollup/build-all-release-channels.js.
Where is main() defined?
main() is defined in scripts/rollup/build-all-release-channels.js at line 111.
What does main() call?
main() calls 5 function(s): buildForChannel, crossDeviceRenameSync, mergeDirsSync, processExperimental, processStable.

Analyze Your Own Codebase

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

Try Supermodel Free