Home / Function/ run() — react Function Reference

run() — react Function Reference

Architecture documentation for the run() function in npm-pack-and-unpack.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  ee558117_5a82_249e_aa21_cd9fb5041cf5["run()"]
  2627adab_6507_909d_4a42_e85f2e501a92["npm-pack-and-unpack.js"]
  ee558117_5a82_249e_aa21_cd9fb5041cf5 -->|defined in| 2627adab_6507_909d_4a42_e85f2e501a92
  a69fe05f_7c15_0269_f061_47c7a8b046bf["module()"]
  a69fe05f_7c15_0269_f061_47c7a8b046bf -->|calls| ee558117_5a82_249e_aa21_cd9fb5041cf5
  style ee558117_5a82_249e_aa21_cd9fb5041cf5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/release/build-release-locally-commands/npm-pack-and-unpack.js lines 11–49

const run = async ({cwd, dry, tempDirectory}) => {
  // Cleanup from previous build.
  await exec(`rm -rf ./build`, {cwd});

  // NPM pack all built packages.
  // We do this to ensure that the package.json files array is correct.
  const builtPackages = readdirSync(join(tempDirectory, 'build/node_modules/'));
  for (let i = 0; i < builtPackages.length; i++) {
    await exec(`npm pack ./${builtPackages[i]}`, {
      cwd: `${tempDirectory}/build/node_modules/`,
    });
  }

  await exec('mkdir build', {cwd});
  await exec('mkdir build/node_modules', {cwd});
  await exec(
    `cp -r ${tempDirectory}/build/node_modules/*.tgz ./build/node_modules/`,
    {cwd}
  );

  // Unpack packages and prepare to publish.
  const compressedPackages = readdirSync(join(cwd, 'build/node_modules/'));
  for (let i = 0; i < compressedPackages.length; i++) {
    await exec(
      `tar -zxvf ./build/node_modules/${compressedPackages[i]} -C ./build/node_modules/`,
      {cwd}
    );
    const packageJSON = readJsonSync(
      join(cwd, `./build/node_modules/package/package.json`)
    );
    await exec(
      `mv ./build/node_modules/package ./build/node_modules/${packageJSON.name}`,
      {cwd}
    );
  }

  // Cleanup.
  await exec(`rm ./build/node_modules/*.tgz`, {cwd});
};

Domain

Subdomains

Called By

Frequently Asked Questions

What does run() do?
run() is a function in the react codebase, defined in scripts/release/build-release-locally-commands/npm-pack-and-unpack.js.
Where is run() defined?
run() is defined in scripts/release/build-release-locally-commands/npm-pack-and-unpack.js at line 11.
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