packages/scripts/promoteRelease.js
/**
 * Assign properties to the npm package of the given name
 *
 * @param {string} packageName
 * @param {object} props
 */
Assign properties to the npm package of the given name
@param {string} packageName
@param {object} props
Assign properties to the npm package of the given name @param { string } packageName @param { object } props
async function updatePackage(packageName, props) {
  const repoRoot = await findRepoRoot();
  const packages = await glob('**/package.json', {
    cwd: repoRoot,
    ignore: '**/node_modules/**',
  });
  for (const packageFile of packages) {
    const fullPath = path.join(repoRoot, packageFile);
    const packageJson = JSON.parse(await fs.promises.readFile(fullPath));
    if (packageJson.name !== packageName) {
      continue;
    }
    _.merge(packageJson, props);
    await fs.promises.writeFile(
      fullPath,
      JSON.stringify(packageJson, null , 2 ) + '\n',
    );
    return;
  }
  console.error(chalk.red(`Unable to find package ${packageName}`));
  process.exit(1);
}
async function updatePackage ( packageName , props ) { const repoRoot = await findRepoRoot ( ) ; const packages = await glob ( '**/package.json' , { cwd : repoRoot , ignore : '**/node_modules/**' , } ) ; for ( const packageFile of packages ) { const fullPath = path . join ( repoRoot , packageFile ) ; const packageJson = JSON . parse ( await fs . promises . readFile ( fullPath ) ) ; if ( packageJson . name !== packageName ) { continue ; } _ . merge ( packageJson , props ) ; await fs . promises . writeFile ( fullPath , JSON . stringify ( packageJson , null , 2 ) + '\n' , ) ; return ; } console . error ( chalk . red ( ` ${ packageName } ` ) ) ; process . exit ( 1 ) ; }
Assign properties to the npm package of the given name
 @param {string} packageName
 @param {object} props
Assign properties to the npm package of the given name @param { string } packageName @param { object } props
/*replacer*/ /*space*/