首页指南参考教程

构建配置流程

了解 EAS CLI 如何为 EAS Build 配置项目。


在本指南中,你将了解当 EAS CLI 使用 eas build:configure(或 eas build - 如果项目尚未配置,则运行相同的过程)配置你的项目时会发生什么。

¥In this guide, you will learn what happens when EAS CLI configures your project with eas build:configure (or eas build - which runs this same process if the project is not yet configured).

配置项目时,EAS CLI 执行以下步骤:

¥EAS CLI performs the following steps when configuring your project:

1

询问你要配置的平台

¥Ask you about the platform(s) to configure

如果你只想将 EAS Build 用于单个平台,那也可以。如果你改变主意,可以稍后再回来配置另一个。

¥If you only want to use EAS Build for a single platform, that's fine. If you change your mind, you can come back and configure the other later.

2

创建 eas.json

¥Create eas.json

该命令将使用默认配置在根目录中创建一个 eas.json 文件。它看起来像这样:

¥The command will create an eas.json file in the root directory with the default configuration. It looks something like this:

eas.json
{
  "build": {
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    },
    "preview": {
      "distribution": "internal"
    },
    "production": {}
  }
}

如果你有一个裸项目,它看起来会有点不同。

¥If you have a bare project, it will look a bit different.

这是你的 EAS 构建配置。它为每个平台定义了三个名为 "development""preview""production" 的构建配置文件(你可以有多个构建配置文件,如 "production""debug""testing" 等)。如果你想了解有关 eas.json 的更多信息,请参阅 使用 eas.json 进行配置 页面。

¥This is your EAS Build configuration. It defines three build profiles named "development", "preview", and "production" (you can have multiple build profiles like "production", "debug", "testing", and so on) for each platform. If you want to learn more about eas.json see the Configuration with eas.json page.

3

配置项目

¥Configure the project

此步骤根据你的项目类型而有所不同。

¥This step varies depending on the project type you have.

3.1

Expo 项目

¥Expo project

如果你尚未使用 android.package 和/或 ios.bundleIdentifier 配置 app.json,EAS CLI 将提示你指定它们。

¥If you haven't configured your app.json with android.package and/or ios.bundleIdentifier yet, EAS CLI will prompt you to specify them.

  • android.package 将用作 Android 应用 ID,用于在 Google Play 商店中识别你的应用

    ¥android.package will be used as the Android application id which is used to identify your app on the Google Play Store

  • ios.bundleIdentifier 将用于在 Apple App Store 上识别你的应用

    ¥ios.bundleIdentifier will be used to identify you app on the Apple App Store

在上面的示例中,我们定义了完全相同的 Android 应用 id 和 iOS 包标识符。但是,它们不需要匹配。

¥In the example above, we defined exactly the same Android application id and iOS bundle identifier. However, they don't need to match.

3.2

裸 React Native 项目

¥Bare React Native project

对于裸项目,没有其他步骤。

¥There are no additional steps for bare projects.

4

下一步

¥Next steps

这就是配置项目以与 EAS Build 兼容的全部内容。如果你在 eas.json 中将 cli.requireCommit 设置为 true,还有最后一步 — 系统将提示你提交我们为你所做的所有更改。你可以选择在提交之前查看它们,并且可以指定 git 提交消息或使用默认消息。

¥That's all there is to configuring a project to be compatible with EAS Build. There is one final step if you set cli.requireCommit to true in your eas.json — you'll be prompted to commit all the changes we made for you. You can choose to review them before committing, and you can either specify the git commit message or use a default message.

Expo 中文网 - 粤ICP备13048890号