Multiple configuration files.

Hi,

I know I can use expo start --config my-app.json to start the expo server with different config files.
But I wonder if it’s possible to have 2 different app.json files to share some configurations from a common file.

Eg. I have a app-prod.json and app-staging.json file, but a lot of the options in these two files are the same.
So I wonder if I can put all the common options in a file like app-common.json , and make both prod and staging files inherit/extend the common options from this file.

Thanks

Hi 3quarterstack!

I’m not with Expo, but this is something we do in our project. Currently, I don’t think there is something as “extend manifest from …”. How we handle it on CI/CD is described in this article. Basically, we have multiple app.<env>.json files and copy it to app.json depending on the context of the CI run (e.g. which branch, is it a PR, etc). For us, this kind of works without too many issues, even on local dev machines (copy app.dev.json to app.json before starting).

Not sure if this is an answer you were hoping for, but I hope it helps!

Cheers,
Cedric

Hi Cedric,

Thanks for your reply.
Just that when you change for example the SDK version, you have to change it in all the env files. It’s a bit tedious and error prone. Imagine if you forgot to change it in one file, which might lead to problems.
But I guess that will do for now.

Thanks

1 Like

I know, it’s not ideal. But it’s an approach :wink:

Perhaps one could use deepmerge in a script to merge the environment-specific options into the common options instead of just copying an environment-specific jile into place.

Hello,
we are using this approach to have multiple applications sharing the same codebase,
made a folder Bundle/app1, Bundle/app2, Bundle/app3 and in every folder I have the relative app.json, splash screen, icon and custom graphic.

In my JS I then read the manifest and do further customizations based on app name.

Finally we made a nodejs script that prompts for app name before launching appropriate command like publish, build, run, etc…

It works perfectly

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.