Home / Function/ run() — react Function Reference

run() — react Function Reference

Architecture documentation for the run() function in guess-stable-version-numbers.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  a9f47767_8452_ab40_42aa_04f146e30b5e["run()"]
  da18f106_23d4_7ef4_cd6c_0dbe3de14958["guess-stable-version-numbers.js"]
  a9f47767_8452_ab40_42aa_04f146e30b5e -->|defined in| da18f106_23d4_7ef4_cd6c_0dbe3de14958
  7ad77d1a_2bba_b16d_d5fe_0a2ffef2b0bc["module()"]
  7ad77d1a_2bba_b16d_d5fe_0a2ffef2b0bc -->|calls| a9f47767_8452_ab40_42aa_04f146e30b5e
  style a9f47767_8452_ab40_42aa_04f146e30b5e fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/release/prepare-release-from-npm-commands/guess-stable-version-numbers.js lines 8–56

const run = async (
  {cwd, packages, skipPackages, ci, publishVersion},
  versionsMap
) => {
  const branch = await execRead('git branch | grep \\* | cut -d " " -f2', {
    cwd,
  });

  for (let i = 0; i < packages.length; i++) {
    const packageName = packages[i];

    if (ci === true) {
      if (publishVersion != null) {
        versionsMap.set(packageName, publishVersion);
      } else {
        console.error(
          'When running in CI mode, a publishVersion must be supplied'
        );
        process.exit(1);
      }
    } else {
      try {
        // In case local package JSONs are outdated,
        // guess the next version based on the latest NPM release.
        const version = await execRead(`npm show ${packageName} version`);

        if (skipPackages.includes(packageName)) {
          versionsMap.set(packageName, version);
        } else {
          const {major, minor, patch} = semver(version);

          // Guess the next version by incrementing patch.
          // The script will confirm this later.
          // By default, new releases from mains should increment the minor version number,
          // and patch releases should be done from branches.
          if (branch === 'main') {
            versionsMap.set(packageName, `${major}.${minor + 1}.0`);
          } else {
            versionsMap.set(packageName, `${major}.${minor}.${patch + 1}`);
          }
        }
      } catch (error) {
        // If the package has not yet been published,
        // we'll require a version number to be entered later.
        versionsMap.set(packageName, null);
      }
    }
  }
};

Domain

Subdomains

Called By

Frequently Asked Questions

What does run() do?
run() is a function in the react codebase, defined in scripts/release/prepare-release-from-npm-commands/guess-stable-version-numbers.js.
Where is run() defined?
run() is defined in scripts/release/prepare-release-from-npm-commands/guess-stable-version-numbers.js at line 8.
What calls run()?
run() is called by 1 function(s): module.

Analyze Your Own Codebase

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

Try Supermodel Free