standard-version-expo icon indicating copy to clipboard operation
standard-version-expo copied to clipboard

feat: add native version bumpers

Open brettdh opened this issue 4 years ago • 13 comments

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 avatar Sep 11 '20 02:09 brettdh

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

brettdh avatar Sep 11 '20 02:09 brettdh

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

triptec avatar Mar 03 '21 23:03 triptec

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

summerkiflain avatar Mar 08 '21 07:03 summerkiflain

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

liemdo avatar Mar 18 '21 00:03 liemdo

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

brettdh avatar Mar 18 '21 00:03 brettdh

@byCedric can you please review this?

summerkiflain avatar Mar 18 '21 04:03 summerkiflain

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

thomas-coldwell avatar Apr 22 '21 12:04 thomas-coldwell

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

bretep avatar May 06 '21 23:05 bretep

@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 avatar May 07 '21 00:05 bretep

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

bretep avatar May 07 '21 02:05 bretep

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

FelipeACP avatar Mar 14 '22 12:03 FelipeACP

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

ghacosta avatar Mar 17 '22 18:03 ghacosta

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

gtokman avatar Jun 30 '22 23:06 gtokman