Multiple project in Expo folder

My config:

  • managed workflow
  • eas-cli/0.36.1 win32-x64 node-v14.18.1

Problem:
I have a folder called quiz_base and subfolders called core, history quiz, math quiz, general quiz.

Here is my app.config.js in core folder:

module.exports = () => {
    if (process.env.APP_ENV === "math") {
        return require("../math quiz/app.json");
    } else if (process.env.APP_ENV === "general") {
        return require("../general quiz/app.json");
    } else if (process.env.APP_ENV === "history") {
        return require("../history quiz/app.json");
    }
};

Before EAS, I used these commands to create a build for math quiz:

cd core
npx cross-env APP_ENV=matematica expo build:ios --no-wait -t archive

This is my eas.json file:

{
  "cli": {
    "version": ">= 0.36.1"
  },
  "build": {
    "production": {
      "env": {
        "APP_ENV": "math"
      }
    }
  }
}

With this structure I’m able to start a build with:

npx cross-env APP_ENV=informatica-new eas build

This is working but I need to modify APP_ENV in eas.json for each different build. How can I improve the project in order to have 1 eas.json for each project?

Thank you for your time!

{
  "cli": {
    "version": ">= 0.36.1"
  },
  "build": {
    "productionGeneral": {
      "env": {
        "APP_ENV": "general"
      }
    },
    "productionMath": {
      "env": {
        "APP_ENV": "math"
      }
    }
  }
}

and run build with eas build --profile productionGeneral in core directory

or create eas.json in each directory and run eas build from specific ones e.g math_quiz

Also, you do not need to specify APP_ENV when running build, all envs from eas.json env field are already loaded by the eas-cli, but you still need to specify that for other commands in eas-cli and expo-cli

btw I’m assuming that all those directories are in single git repository

1 Like

Thank you very much!

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