Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Libraries/Core/ReactNativeVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ exports.version = {
major: 0,
minor: 71,
patch: 2,
prerelease: null,
prerelease: 'alpha.0',
};
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
# Expensify Release

To publish a new version run the following script, where `<base-version>` is the react-native version that the fork is based on, and `<fork-version>` is the version you want to publish. This will generate a tarball (`react-native-<fork-version>.tgz`) which can then be uploaded to a github release and consumed via npm.
## Versioning

Before publishing an Expensify Release of this fork, you must first set the correct package version. The version should mirror the upstream tag that it's based off.

For example:

- While writing this, the upstream tag I've based this version of the fork off is `0.71.2`. Since this is our first time publishing the fork under this upstream version, the correct version for the fork is `0.71.2-alpha.0` (and the corresponding git branch should be called `Expensify-0.71.2-alpha.0`)
- If we publish the fork again without upgrading the fork to be based off a new upstream tag (such as `0.71.3`), then the next version would be `0.71.2-alpha.1`
- If we publish the fork again with a new upstream tag (such as `0.71.4`), then the alpha should reset, and the correct version would then be `0.71.4-alpha.0`

To update the version on the fork, run the following script:

```bash
node ./scripts/set-rn-version.js --to-version <fork-version> --build-type expensify
```

Then commit your changes.

## Publishing

To _publish_ a new version run the following script, where `<base-version>` is the react-native version that the fork is based on, and `<fork-version>` is the version you want to publish. This will generate a tarball (`react-native-<fork-version>.tgz`) which can then be uploaded to a github release and consumed via npm.

```bash
node ./scripts/publish-npm-expensify.js --base-version <base-version> --fork-version <fork-version>
Expand Down
2 changes: 1 addition & 1 deletion React/Base/RCTVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
RCTVersionMajor: @(0),
RCTVersionMinor: @(71),
RCTVersionPatch: @(2),
RCTVersionPrerelease: [NSNull null],
RCTVersionPrerelease: @"alpha.0",
};
});
return __rnVersion;
Expand Down
2 changes: 1 addition & 1 deletion ReactAndroid/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=0.71.2
VERSION_NAME=0.71.2-alpha.0
GROUP=com.facebook.react

# JVM Versions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ public class ReactNativeVersion {
"major", 0,
"minor", 71,
"patch", 2,
"prerelease", null);
"prerelease", "alpha.0");
}
2 changes: 1 addition & 1 deletion ReactCommon/cxxreact/ReactNativeVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ constexpr struct {
int32_t Major = 0;
int32_t Minor = 71;
int32_t Patch = 2;
std::string_view Prerelease = "";
std::string_view Prerelease = "alpha.0";
} ReactNativeVersion;

} // namespace facebook::react
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@expensify/react-native",
"version": "0.71.2",
"version": "0.71.2-alpha.0",
"bin": "./cli.js",
"description": "A framework for building native apps using React",
"license": "MIT",
Expand Down Expand Up @@ -208,4 +208,4 @@
}
]
}
}
}
15 changes: 14 additions & 1 deletion scripts/version-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ function parseVersion(versionStr, buildType) {
}

function validateBuildType(buildType) {
const validBuildTypes = new Set(['release', 'dry-run', 'nightly']);
const validBuildTypes = new Set([
'release',
'dry-run',
'nightly',
'expensify',
]);
if (!validBuildTypes.has(buildType)) {
throw new Error(`Unsupported build type: ${buildType}`);
}
Expand All @@ -87,6 +92,7 @@ function validateVersion(versionObject, buildType) {
release: validateRelease,
'dry-run': validateDryRun,
nightly: validateNightly,
expensify: validateExpensify,
};

const validationFunction = map[buildType];
Expand Down Expand Up @@ -125,6 +131,13 @@ function validateNightly(version) {
}
}

function validateExpensify(version) {
const isValidExpensify = version.prerelease && version.prerelease.match(/alpha\.\d/);
if (!isValidExpensify) {
throw new Error(`Version ${version.version} is not valid for Expensify`);
}
}

function isStableRelease(version) {
return (
version.major === '0' && version.minor !== '0' && version.prerelease == null
Expand Down
2 changes: 1 addition & 1 deletion template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"react": "18.2.0",
"react-native": "0.71.2"
"react-native": "0.71.2-alpha.0"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down