How to better improve Version Management with Expo ?

Randall71
3 min readSep 17, 2023

Gone are the days when we used standard-version-expo to manage our application versions with just a single command:

npx standard-version --release-as minor

If you haven’t yet discovered this gem, I invite you to read the README of this repository to better understand what follows.

This package allowed us to update various properties of our application with a single command, including the version, buildNumber, and versionCode, all while using the well-known semver versioning system (major|minor|patch).

However, Expo has evolved significantly, and this repository is no longer as actively maintained. Expo now offers a method for managing application versions directly from its documentation: App version management. However, let’s be honest, the flexibility of managing dependencies with semver was simply better.

That’s why I decided to create a script that would allow me to recapture that feeling, and the results are quite interesting.

Result of using increment-version.sh for automating version

All you need to do is copy this script to the root of your project and add it to your package.json.

{
"scripts": {
"increment-version": "bash ./increment-version.sh"
}
}

And simply call it by doing:

npm run increment-version (major|minor|patch)

For Android, we use an advanced versioning system consisting of 9 digits.

Advanced versioning scheme for Android

It’s important to note that here we replace “min API level” and “Screen size or GL texture formats” with the Expo SDK version we are using. At the time of writing, we are at SDK 49. Therefore, in the script, the “expo_sdk_version” variable is set to “049”. You will simply need to increment this value as Expo updates its SDK and you transition to the new version. To understand this choice better, I refer you to this article.

It’s also important to note the presence of the “json_file” variable, which allows you to specify the path to your app.json file. Normally, this file should be at the root of your project, just like the script, so you don’t have to worry about it.

Using this script means that your different versions are stored in your app.json file, not your app.config.js file. Your eas.json appVersionSource must be on “local” which is the default and autoIncrement on build object must be at false or not exist because the script take care of this.

The link to the script is as follows increment-version on my github gist.

We’re in the age of “copy-paste” (yes, shadcn 🙃), so don’t hesitate to copy and paste this script into your project, and smile as you update your versions 🚀.

If you like it, don’t hesitate to give it a like ⭐.

Enjoy 🎇.

--

--