Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump react-native version in template in release script #24262

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 11 additions & 6 deletions scripts/bump-oss-version.js
Expand Up @@ -24,7 +24,7 @@ let argv = yargs.option('r', {
default: 'origin',
}).argv;

// - check we are in release branch, e.g. 0.33-stable
// Check we are in release branch, e.g. 0.33-stable
let branch = exec('git symbolic-ref --short HEAD', {
silent: true,
}).stdout.trim();
Expand Down Expand Up @@ -100,7 +100,7 @@ let packageJson = JSON.parse(cat('package.json'));
packageJson.version = version;
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2), 'utf-8');

// - change ReactAndroid/gradle.properties
// Change ReactAndroid/gradle.properties
if (
sed(
'-i',
Expand All @@ -113,12 +113,17 @@ if (
exit(1);
}

// verify that files changed, we just do a git diff and check how many times version is added across files
// Change react-native version in the template's package.json
let templatePackageJson = JSON.parse(cat('template/package.json'));
templatePackageJson.dependencies['react-native'] = version;
fs.writeFileSync('./template/package.json', JSON.stringify(templatePackageJson, null, 2) + '\n', 'utf-8');

// Verify that files changed, we just do a git diff and check how many times version is added across files
let numberOfChangedLinesWithNewVersion = exec(
`git diff -U0 | grep '^[+]' | grep -c ${version} `,
{silent: true},
).stdout.trim();
if (+numberOfChangedLinesWithNewVersion !== 2) {
if (+numberOfChangedLinesWithNewVersion !== 3) {
echo(
'Failed to update all the files. package.json and gradle.properties must have versions in them',
);
Expand All @@ -127,13 +132,13 @@ if (+numberOfChangedLinesWithNewVersion !== 2) {
exit(1);
}

// - make commit [0.21.0-rc] Bump version numbers
// Make commit [0.21.0-rc] Bump version numbers
if (exec(`git commit -a -m "[${version}] Bump version numbers"`).code) {
echo('failed to commit');
exit(1);
}

// - add tag v0.21.0-rc
// Add tag v0.21.0-rc
if (exec(`git tag v${version}`).code) {
echo(
`failed to tag the commit with v${version}, are you sure this release wasn't made earlier?`,
Expand Down
2 changes: 1 addition & 1 deletion template/package.json
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"react": "16.8.1",
"react-native": "0.59.3"
"react-native": "1000.0.0"
},
"devDependencies": {
"@babel/core": "^7.3.3",
Expand Down