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

Add support for `app.config.js`

Open byCedric opened this issue 5 years ago • 5 comments

Description of the feature

Next to app.json and app.config.json, this library should support having a dynamic config.

Motivation

It's new and paves the path to a new set of tools to use for managing expo manifests.

Additional context

An example could be something like:

import * as versions from 'standard-version-expo';
import pkg from './package.json';

export default {
  name: 'awesomeapp',
  version: pkg.version,
  ios: {
    bundleIdentifier: 'com.acme.awesomeapp',
    buildNumber: versions.ios(pkg.version),
  },
  android: {
    package: 'com.acme.awesomeapp',
    versionCode: versions.android(pkg.version),
  }
}

This only works with deterministic methods, for incremental updates this would not work (which is kind of the reason why increments are not that great 😅)

byCedric avatar May 14 '20 19:05 byCedric

A possible workaround is to use app.json and app.config.js. Example:

app.json:

{
 "expo": {
    "version": "0.2.5"
 }
}

app.config.js:

import appJson from "./app.json";

export default {
 ...
 version: appJson.expo.version,
 ...
}

There are actually other tools that don't play nice with app.config.js (e.g., detox)

oriharel avatar Mar 27 '21 10:03 oriharel

@oriharel I believe the proper way to do this is:

// app.config.(js|ts)
export default function (config) {
  return {
    ...config,
    // other values
  }
}

The config parameter is the contents of app.json

josmithua avatar Aug 11 '21 18:08 josmithua

@byCedric any update on this one? We use app.config.js and we can't automate our CI for EAS Submit because version must be bumped every time otherwise app store rejects the build.

sean-m-oleary avatar May 26 '22 20:05 sean-m-oleary

@josmithua's answer is correct, although you should destructurize the function parameters:

export default function ({ config })

Not only your app.json values are passed to the function. Passing all of them will lead to errors. image

msynowski avatar Jun 10 '22 15:06 msynowski

Has anyone found any better solution for this issue?

sainijagjit avatar Jul 15 '22 01:07 sainijagjit