Home / Function/ checkNPMPermissions() — react Function Reference

checkNPMPermissions() — react Function Reference

Architecture documentation for the checkNPMPermissions() function in utils.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  8bf9d27c_61f6_d804_abc7_c90362799dd4["checkNPMPermissions()"]
  5f5d310a_a69e_7956_cd19_7f375a47ea35["utils.js"]
  8bf9d27c_61f6_d804_abc7_c90362799dd4 -->|defined in| 5f5d310a_a69e_7956_cd19_7f375a47ea35
  aa679512_5a04_8a89_fbeb_551737e6a392["execRead()"]
  8bf9d27c_61f6_d804_abc7_c90362799dd4 -->|calls| aa679512_5a04_8a89_fbeb_551737e6a392
  style 8bf9d27c_61f6_d804_abc7_c90362799dd4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/devtools/utils.js lines 19–59

async function checkNPMPermissions() {
  const currentUser = await execRead('npm whoami');
  const failedProjects = [];

  const checkProject = async project => {
    const owners = (await execRead(`npm owner ls ${project}`))
      .split('\n')
      .filter(owner => owner)
      .map(owner => owner.split(' ')[0]);

    if (!owners.includes(currentUser)) {
      failedProjects.push(project);
    }
  };

  await logger(
    Promise.all(NPM_PACKAGES.map(checkProject)),
    `Checking NPM permissions for ${chalk.bold(currentUser)}.`,
    {estimate: 2500}
  );

  console.log('');

  if (failedProjects.length) {
    console.error(chalk.red.bold('Insufficient NPM permissions'));
    console.error('');
    console.error(
      chalk.red(
        `NPM user {underline ${currentUser}} is not an owner for: ${chalk.bold(
          failedProjects.join(', ')
        )}`
      )
    );
    console.error(
      chalk.red(
        'Please contact a React team member to be added to the above project(s).'
      )
    );
    process.exit(1);
  }
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does checkNPMPermissions() do?
checkNPMPermissions() is a function in the react codebase, defined in scripts/devtools/utils.js.
Where is checkNPMPermissions() defined?
checkNPMPermissions() is defined in scripts/devtools/utils.js at line 19.
What does checkNPMPermissions() call?
checkNPMPermissions() calls 1 function(s): execRead.

Analyze Your Own Codebase

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

Try Supermodel Free