Skip to content

Commit

Permalink
refactor(bump-all-updated-packages): support force-bump to next minor…
Browse files Browse the repository at this point in the history
… version of the package (#35810)

Summary:
Pull Request resolved: #35810

Changelog: [Internal]

`bump-all-updated-packages` script now supports `release-branch-cutoff` argument

If this argument is provided, the script will bump each public package to next minor version

Updated [wiki](https://github.com/facebook/react-native/wiki/Release-and-its-automated-processes) with relevant information about how to use it

Reviewed By: cortinico

Differential Revision: D42455329

fbshipit-source-id: a40d2f5dc356f22d3182da3a118c6383b634817d
  • Loading branch information
hoxyq authored and Ruslan Lesiutin committed Jan 24, 2023
1 parent 6a3752e commit 1ca223f
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scripts/monorepo/bump-all-updated-packages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const chalk = require('chalk');
const inquirer = require('inquirer');
const path = require('path');
const {echo, exec, exit} = require('shelljs');
const yargs = require('yargs');

const {BUMP_COMMIT_MESSAGE} = require('../constants');
const forEachPackage = require('../for-each-package');
Expand All @@ -19,6 +20,15 @@ const bumpPackageVersion = require('./bump-package-version');

const ROOT_LOCATION = path.join(__dirname, '..', '..', '..');

const {
argv: {releaseBranchCutoff},
} = yargs
.option('release-branch-cutoff', {
type: 'boolean',
describe: 'Should force bump minor version for each public package',
})
.strict();

const buildExecutor =
(packageAbsolutePath, packageRelativePathFromRoot, packageManifest) =>
async () => {
Expand All @@ -29,6 +39,21 @@ const buildExecutor =
return;
}

if (releaseBranchCutoff) {
const updatedVersion = bumpPackageVersion(
packageAbsolutePath,
packageManifest,
'minor',
);
echo(
`\u2705 Successfully bumped ${chalk.green(
packageName,
)} to ${chalk.green(updatedVersion)}`,
);

return;
}

const hashOfLastCommitInsidePackage = exec(
`git log -n 1 --format=format:%H -- ${packageRelativePathFromRoot}`,
{cwd: ROOT_LOCATION, silent: true},
Expand Down

0 comments on commit 1ca223f

Please sign in to comment.