mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
029376c47d
Summary: Changelog: [Internal] Remove unnecessary logic and new parseVersions function Changes: * Remove `tagsForVersions` which in the past got all the tags for the `currentCommit` to figure out which one we're releasing to. I believe this is redundant because the CircleCI envvar `CIRCLE_TAG` should already have the version that we're releasing -- this is set in `bump-oss-version`. Note: this will only be set for full-on releases, (re: not nightly or commitly) * Re-arrange some logic to group where we set `releaseVersion` and separate where we call `bump-oss-version` script for dryRun (commitly) && nightly builds Reviewed By: hramos Differential Revision: D32196237 fbshipit-source-id: 10f21f71bad1ea0496c5eb9094271cc4454a2544
30 lines
625 B
JavaScript
30 lines
625 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
function parseVersion(versionStr) {
|
|
const match = versionStr.match(/^v?((\d+)\.(\d+)\.(\d+)(?:-(.+))?)$/);
|
|
if (!match) {
|
|
throw new Error(
|
|
`You must pass a correctly formatted version; couldn't parse ${versionStr}`,
|
|
);
|
|
}
|
|
const [, version, major, minor, patch, prerelease] = match;
|
|
return {
|
|
version,
|
|
major,
|
|
minor,
|
|
patch,
|
|
prerelease,
|
|
};
|
|
}
|
|
|
|
module.exports = {
|
|
parseVersion,
|
|
};
|