DEV Community


Posted on • Updated on


Generate staging app.json for Expo like flavor

This article is depreacted
In Latest Expo version can dynamic config app.config.js


In some case, we need change app.json variable for staging channel (like bundleIdentifer, icon , etc...)

But expo hasn't flavor function.
I try to generate app.json per publish.

build app.json

First, we write JSON override config.


  "expo": {
      "ios": {
    "bundleIdentifier": ""

Next we write app.json generator script.


const merge = require("deepmerge")
const baseAppJson = require("../app.json")
const override = require("../app-staging-override.json")
const merged = merge.all([baseAppJson, override])
console.log(JSON.stringify(merged, null, 2))

This script is so simple. this merge app.json and ../app-staging-override.json and output stdout.

Finally, append prebuild script on package.json.

  "prebuild:ios:staging": "node bin/generate-staging-app-json.js > app.staging.generated.json",
  "build:ios:staging": "expo build:ios --config app.staging.generated.json --type archive --release-channel=YOUR_STAGING_CHANNEL "

Top comments (0)

Need a better mental model for async/await?

Check out this classic DEV post on the subject.

⭐️🎀 JavaScript Visualized: Promises & Async/Await

async await