了解如何使用 monorepo 设置 EAS Build。
要使用 monorepo 设置 EAS Build,你需要按照如下所述的标准流程进行操作:
¥To set up EAS Build with a monorepo, you need to follow the standard process as described below:
从应用目录的根运行所有 EAS CLI 命令。例如,如果你的项目存在于 apps/my-app 的 git 存储库中,则从那里运行 eas build
。
¥Run all EAS CLI commands from the root of the app directory. For example, if your project exists inside your git repository at apps/my-app, then run eas build
from there.
与 EAS Build 相关的所有文件(例如 eas.json 和 credentials.json)应位于应用目录的根目录中。如果你的 monorepo 中有多个使用 EAS Build 的应用,则每个应用目录都将拥有自己的这些文件副本。
¥All files related to EAS Build, such as eas.json and credentials.json, should be in the root of the app directory. If you have multiple apps that use EAS Build in your monorepo, each app directory will have its own copy of these files.
如果你正在 monorepo 中构建托管项目,请参阅 与 Monorepos 合作 指南。
¥If you are building a managed project in a monorepo, see Working with Monorepos guide.
如果你的项目需要超出所提供的设置之外的其他设置,请向项目中的 package.json 添加 postinstall
步骤,以在其他工作区中构建所有必要的依赖。例如:
¥If your project needs additional setup beyond what is provided, add a postinstall
step to package.json in your project that builds all necessary dependencies in other workspaces. For example:
{
"scripts": {
"postinstall": "cd ../.. && yarn build"
}
}