Skip to content

Commit 7adf6b1

Browse files
kelsetfacebook-github-bot
authored andcommitted
fix(script): handle patch versions after the .0 for set version (#36020)
Summary: A small backport to main of a local fix done in 0.71 to account for the logic for releases 0.Y.1,2,3-prerelease (meaning, not just strictly 0). I could have done like the other logics and just remove the check for patch, but decided to at least make sure it's a digit 😅 ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [INTERNAL] [FIXED] - handle patch versions after the .0 for set version Pull Request resolved: #36020 Test Plan: Tested in 0.71-stable, without it we can't test RNTestProject. Reviewed By: jacdebug, cortinico Differential Revision: D42924375 Pulled By: cipolleschi fbshipit-source-id: b003d884cc45a2602adbc14fa8b66d3f1e0c94a6
1 parent ecf967a commit 7adf6b1

File tree

2 files changed

+1
-28
lines changed

2 files changed

+1
-28
lines changed

scripts/__tests__/version-utils-test.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,6 @@ describe('version-utils', () => {
141141
expect(prerelease).toBe('rc.4');
142142
});
143143

144-
it('should reject pre-release version with patch != 0', () => {
145-
function testInvalidVersion() {
146-
parseVersion('0.66.3-rc.4', 'release');
147-
}
148-
expect(testInvalidVersion).toThrowErrorMatchingInlineSnapshot(
149-
`"Version 0.66.3-rc.4 is not valid for Release"`,
150-
);
151-
});
152-
153144
it('should reject pre-release version from tag with random prerelease pattern', () => {
154145
function testInvalidVersion() {
155146
parseVersion('v0.66.0-something_invalid', 'release');
@@ -233,15 +224,6 @@ describe('version-utils', () => {
233224
expect(prerelease).toBe('rc.0');
234225
});
235226

236-
it('should reject dryrun with prerelease . version with patch different from 0', () => {
237-
function testInvalidFunction() {
238-
parseVersion('0.20.3-rc.0', 'dry-run');
239-
}
240-
expect(testInvalidFunction).toThrowErrorMatchingInlineSnapshot(
241-
`"Version 0.20.3-rc.0 is not valid for dry-runs"`,
242-
);
243-
});
244-
245227
it('should parse dryrun with prerelease - version', () => {
246228
const {version, major, minor, patch, prerelease} = parseVersion(
247229
'0.20.0-rc-0',
@@ -254,15 +236,6 @@ describe('version-utils', () => {
254236
expect(prerelease).toBe('rc-0');
255237
});
256238

257-
it('should reject dryrun with prerelease - version with patch different from 0', () => {
258-
function testInvalidFunction() {
259-
parseVersion('0.20.3-rc-0', 'dry-run');
260-
}
261-
expect(testInvalidFunction).toThrowErrorMatchingInlineSnapshot(
262-
`"Version 0.20.3-rc-0 is not valid for dry-runs"`,
263-
);
264-
});
265-
266239
it('should parse dryrun with main version', () => {
267240
const {version, major, minor, patch, prerelease} = parseVersion(
268241
'1000.0.0',

scripts/version-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function isStablePrerelease(version) {
131131
return (
132132
version.major === '0' &&
133133
version.minor !== '0' &&
134-
version.patch === '0' &&
134+
version.patch.match(/^\d+$/) &&
135135
version.prerelease != null &&
136136
(version.prerelease.startsWith('rc.') ||
137137
version.prerelease.startsWith('rc-') ||

0 commit comments

Comments
 (0)