Home / Function/ processStable() — react Function Reference

processStable() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  01896c6c_c39f_713c_b9f5_5c924e738cdc["processStable()"]
  39121ebe_f6d4_878e_0797_7a6b417f5f9a["build-all-release-channels.js"]
  01896c6c_c39f_713c_b9f5_5c924e738cdc -->|defined in| 39121ebe_f6d4_878e_0797_7a6b417f5f9a
  c4f900f2_b639_f662_05d1_7ae05c59be96["main()"]
  c4f900f2_b639_f662_05d1_7ae05c59be96 -->|calls| 01896c6c_c39f_713c_b9f5_5c924e738cdc
  8939a711_3ab0_2de0_0d1c_f6d01f0ba44d["updatePackageVersions()"]
  01896c6c_c39f_713c_b9f5_5c924e738cdc -->|calls| 8939a711_3ab0_2de0_0d1c_f6d01f0ba44d
  96e8a694_22e2_8063_6b09_c6e72c4e5009["updatePlaceholderReactVersionInCompiledArtifacts()"]
  01896c6c_c39f_713c_b9f5_5c924e738cdc -->|calls| 96e8a694_22e2_8063_6b09_c6e72c4e5009
  style 01896c6c_c39f_713c_b9f5_5c924e738cdc fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/rollup/build-all-release-channels.js lines 179–296

function processStable(buildDir) {
  if (fs.existsSync(buildDir + '/node_modules')) {
    // Identical to `oss-stable` but with real, semver versions. This is what
    // will get published to @latest.
    shell.cp('-r', buildDir + '/node_modules', buildDir + '/oss-stable-semver');
    if (canaryChannelLabel === 'rc') {
      // During the RC phase, we also generate an RC build that pins to exact
      // versions but does not include a SHA, e.g. `19.0.0-rc.0`. This is purely
      // for signaling purposes — aside from the version, it's no different from
      // the corresponding canary.
      shell.cp('-r', buildDir + '/node_modules', buildDir + '/oss-stable-rc');
    }

    const defaultVersionIfNotFound = '0.0.0' + '-' + sha + '-' + dateString;
    const versionsMap = new Map();
    for (const moduleName in stablePackages) {
      const version = stablePackages[moduleName];
      versionsMap.set(
        moduleName,
        version + '-' + canaryChannelLabel + '-' + sha + '-' + dateString,
        defaultVersionIfNotFound
      );
    }
    updatePackageVersions(
      buildDir + '/node_modules',
      versionsMap,
      defaultVersionIfNotFound,
      true
    );
    fs.renameSync(buildDir + '/node_modules', buildDir + '/oss-stable');
    updatePlaceholderReactVersionInCompiledArtifacts(
      buildDir + '/oss-stable',
      ReactVersion + '-' + canaryChannelLabel + '-' + sha + '-' + dateString
    );

    if (canaryChannelLabel === 'rc') {
      const rcVersionsMap = new Map();
      for (const moduleName in stablePackages) {
        const version = stablePackages[moduleName];
        rcVersionsMap.set(moduleName, version + `-rc.${rcNumber}`);
      }
      updatePackageVersions(
        buildDir + '/oss-stable-rc',
        rcVersionsMap,
        defaultVersionIfNotFound,
        // For RCs, we pin to exact versions, like we do for canaries.
        true
      );
      updatePlaceholderReactVersionInCompiledArtifacts(
        buildDir + '/oss-stable-rc',
        ReactVersion
      );
    }

    const rnVersionString =
      ReactVersion + '-native-fb-' + sha + '-' + dateString;
    if (fs.existsSync(buildDir + '/facebook-react-native')) {
      updatePlaceholderReactVersionInCompiledArtifacts(
        buildDir + '/facebook-react-native',
        rnVersionString
      );
    }

    if (fs.existsSync(buildDir + '/react-native')) {
      updatePlaceholderReactVersionInCompiledArtifacts(
        buildDir + '/react-native',
        rnVersionString,
        filename => filename.endsWith('.fb.js')
      );

      updatePlaceholderReactVersionInCompiledArtifacts(
        buildDir + '/react-native',
        ReactVersion,
        filename => !filename.endsWith('.fb.js') && filename.endsWith('.js')
      );
    }

    // Now do the semver ones
    const semverVersionsMap = new Map();
    for (const moduleName in stablePackages) {
      const version = stablePackages[moduleName];

Domain

Subdomains

Called By

Frequently Asked Questions

What does processStable() do?
processStable() is a function in the react codebase, defined in scripts/rollup/build-all-release-channels.js.
Where is processStable() defined?
processStable() is defined in scripts/rollup/build-all-release-channels.js at line 179.
What does processStable() call?
processStable() calls 2 function(s): updatePackageVersions, updatePlaceholderReactVersionInCompiledArtifacts.
What calls processStable()?
processStable() is called by 1 function(s): main.

Analyze Your Own Codebase

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

Try Supermodel Free