Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add native version bumpers #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

brettdh
Copy link

@brettdh brettdh commented Sep 11, 2020

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.

@brettdh
Copy link
Author

brettdh commented Sep 11, 2020

@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?

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.

Closes expo-community#9.
README.md Show resolved Hide resolved
A string like 1.0.2-beta.4 in Info.plist will be rejected
as an invalid version; it really just wants an x.y.z version.
@triptec
Copy link

triptec commented Mar 3, 2021

This would be nice to have, why is this not merged?

@summerkiflain
Copy link

This is a super important PR, can we get this merged please?

@liemdo
Copy link

liemdo commented Mar 18, 2021

It's been a few months since @brettdh opened the PR. Can we review and merge this one?

@brettdh
Copy link
Author

brettdh commented Mar 18, 2021

In the meantime, I've published a version with this PR: https://www.npmjs.com/package/@brettdh/standard-version-expo

@summerkiflain
Copy link

@byCedric can you please review this?

@thomas-coldwell
Copy link

Would love to see this merged - pretty important for the bare workflow IMO :)

@bretep
Copy link

bretep commented May 6, 2021

I would like to see this merged as well. Going to use https://www.npmjs.com/package/@brettdh/standard-version-expo for now

@bretep
Copy link

bretep commented May 7, 2021

@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),
        },
]}

@bretep
Copy link

bretep commented May 7, 2021

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'),
        },
    ],
};

@FelipeACP
Copy link

@byCedric , it would be nice if we had this merged

@ghacosta
Copy link

Hey @byCedric could you merge this one? This thing is really a must have on bare-workflows!

@gtokman
Copy link

gtokman commented Jun 30, 2022

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'),
        }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add version bumpers for bare projects
9 participants