Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
making sure error get thrown upward
  • Loading branch information
kelset committed Jan 16, 2023
commit 622c9bde4fcf58a7d1a3a801a1aed8c4c166ee02
10 changes: 7 additions & 3 deletions scripts/set-rn-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ let argv = yargs

const buildType = argv.buildType;
const version = argv.toVersion;
validateBuildType(buildType);

try {
validateBuildType(buildType);
} catch (e) {
throw e;
}

let major,
minor,
Expand All @@ -47,8 +52,7 @@ let major,
try {
({major, minor, patch, prerelease} = parseVersion(version, buildType));
} catch (e) {
echo(e.message);
exit(1);
throw e;
}

const tmpVersioningFolder = fs.mkdtempSync(
Expand Down
7 changes: 6 additions & 1 deletion scripts/test-e2e-local.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,15 @@ if (argv.target === 'RNTester') {
const releaseVersion = `${baseVersion}-${dateIdentifier}`;

// this is needed to generate the Android artifacts correctly
exec(
const exitCode = exec(
`node scripts/set-rn-version.js --to-version ${releaseVersion} --build-type ${buildType}`,
).code;

if (exitCode !== 0) {
console.error('Failed to set the RN version');
process.exit(exitCode);
}

// Generate native files for Android
generateAndroidArtifacts(releaseVersion, tmpPublishingFolder);

Expand Down
12 changes: 10 additions & 2 deletions scripts/version-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ const VERSION_REGEX = /^v?((\d+)\.(\d+)\.(\d+)(?:-(.+))?)$/;
*
*/
function parseVersion(versionStr, buildType) {
validateBuildType(buildType);
try {
validateBuildType(buildType);
} catch (e) {
throw e;
}

const match = extractMatchIfValid(versionStr);
const [, version, major, minor, patch, prerelease] = match;
Expand All @@ -51,7 +55,11 @@ function parseVersion(versionStr, buildType) {
prerelease,
};

validateVersion(versionObject, buildType);
try {
validateVersion(versionObject, buildType);
} catch (e) {
throw e;
}

return versionObject;
}
Expand Down