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

Add support for app.config.js #12

Open
byCedric opened this issue May 14, 2020 · 5 comments
Open

Add support for app.config.js #12

byCedric opened this issue May 14, 2020 · 5 comments

Comments

@byCedric
Copy link
Member

byCedric commented May 14, 2020

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 😅)

@oriharel
Copy link

oriharel commented Mar 27, 2021

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)

@josmithua
Copy link

@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

@sean-m-oleary
Copy link

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

@msynowski
Copy link

@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

@sainijagjit
Copy link

Has anyone found any better solution for this issue?

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

No branches or pull requests

6 participants