standard-version-expo
standard-version-expo copied to clipboard
feat: add native version bumpers
Adds app version and build number bumpers for the native iOS/Android project configuration files (e.g. Info.plist, build.gradle). These are usable by expo bare workflow projects, but also react-native projects that don't use Expo, and even plain old iOS/Android projects.
Linked issue
Closes #9.
Additional context
Not yet tested with a real project, but I'm going to do that tomorrow. It might also be real nice to get integration tests set up that take a real project and bump its version, and then verify that all the right files have all the right versions.
@byCedric something that came up while I was writing the docs: I noticed that the recommended bumper for the ios build number is the calculated semver. This makes sense to me for releases, where the build number is mostly irrelevant (since you don't typically publish more than one build of a release). For TestFlight, though, it's common to publish multiple builds of a single pre-release version, all of which must have a different build number. This makes me think that increment
ought to be the recommended bumper for the iOS build number. If not, how would you handle this case?
This would be nice to have, why is this not merged?
This is a super important PR, can we get this merged please?
It's been a few months since @brettdh opened the PR. Can we review and merge this one?
In the meantime, I've published a version with this PR: https://www.npmjs.com/package/@brettdh/standard-version-expo
@byCedric can you please review this?
Would love to see this merged - pretty important for the bare workflow IMO :)
I would like to see this merged as well. Going to use https://www.npmjs.com/package/@brettdh/standard-version-expo
for now
@brettdh I get the following error when trying to run with the below configuration:
/Volumes/Development/Work/bretep/gate-code/.versionrc.js:34
updater: require.resolve('@brettdh/standard-version-expo/android/native/buildnum/code')(sdkVersion),
^
TypeError: require.resolve(...) is not a function
at Object.<anonymous> (/Volumes/Development/Work/bretep/gate-code/.versionrc.js:34:100)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1138:10)
at Module.load (node:internal/modules/cjs/loader:989:32)
at Function.Module._load (node:internal/modules/cjs/loader:829:14)
at Module.require (node:internal/modules/cjs/loader:1013:19)
at require (node:internal/modules/cjs/helpers:93:18)
at module.exports.getConfiguration (/Volumes/Development/Work/bretep/gate-code/node_modules/standard-version/lib/configuration.js:18:29)
at Object.<anonymous> (/Volumes/Development/Work/bretep/gate-code/node_modules/standard-version/command.js:116:11)
at Module._compile (node:internal/modules/cjs/loader:1109:14)
Environment
Tried with node 14 and 16
Configuration
const sdkVersion = "41.0.1"
module.exports = {
bumpFiles: [
{
filename: 'ios/GateCode/Info.plist',
updater: require.resolve('@brettdh/standard-version-expo/ios/native/app-version'),
},
{
filename: 'ios/GateCode/Info.plist',
updater: require.resolve('@brettdh/standard-version-expo/ios/native/buildnum/increment'),
},
{
filename: 'android/app/build.gradle',
updater: require.resolve('@brettdh/standard-version-expo/android/native/app-version'),
},
{
filename: 'android/app/build.gradle',
updater: require.resolve('@brettdh/standard-version-expo/android/native/buildnum/code')(sdkVersion),
},
]}
I ended up just incrementing vs. using code:
module.exports = {
bumpFiles: [
{
filename: 'package.json',
},
{
filename: 'app.json',
updater: require.resolve('@brettdh/standard-version-expo'),
},
{
filename: 'app.json',
updater: require.resolve('@brettdh/standard-version-expo/android'),
},
{
filename: 'app.json',
updater: require.resolve('@brettdh/standard-version-expo/ios'),
},
{
filename: 'ios/GateCode/Info.plist',
updater: require.resolve('@brettdh/standard-version-expo/ios/native/app-version'),
},
{
filename: 'ios/GateCode/Info.plist',
updater: require.resolve('@brettdh/standard-version-expo/ios/native/buildnum/increment'),
},
{
filename: 'android/app/build.gradle',
updater: require.resolve('@brettdh/standard-version-expo/android/native/app-version'),
},
{
filename: 'android/app/build.gradle',
updater: require.resolve('@brettdh/standard-version-expo/android/native/buildnum/increment'),
},
],
};
@byCedric , it would be nice if we had this merged
Hey @byCedric could you merge this one? This thing is really a must have on bare-workflows!
Would be great to merge this @expo-community.
I was able to fix it by installing yarn add@brettdh/standard-version-expo --dev
then updating my .versionrc.js
{
filename: 'ios/<your app>/Info.plist',
updater: require.resolve('@brettdh/standard-version-expo/ios/native/app-version'),
},
{
filename: 'ios/<your app>/Info.plist',
updater: require.resolve('@brettdh/standard-version-expo/ios/native/buildnum/increment'),
},
{
filename: 'android/app/build.gradle',
updater: require.resolve('@brettdh/standard-version-expo/android/native/app-version'),
},
{
filename: 'android/app/build.gradle',
updater: require.resolve('@brettdh/standard-version-expo/android/native/buildnum/increment'),
}
}