EAS CLI

repository·main·Indexed 23 days ago

https://github.com/expo/eas-cli

The command-line interface for Expo Application Services (EAS), used to build, submit, update, and deploy Expo and React Native applications. It provides tools for cloud builds (eas build), app store submissions (eas submit), over-the-air updates (eas update), CI/CD automation via EAS Workflows, and web app deployment via EAS Hosting. The repository also includes utilities like RecordSim for iOS Simulator recording, the create-eas-build-function scaffolding tool, and the eas-build-cache-provider plugin.

Tokens
36.2K
Snippets
94
Records
236
Agent score
80%

What's inside eas-cli

  1. Overview of EAS CLI capabilities

    main

    EAS CLI provides a terminal-native path from source code to production through several key services:

    • EAS Build (eas build): Compile and sign Android and iOS apps with custom native code in the cloud, manage credentials, and share internal distribution builds.
    • EAS Submit (eas submit): Upload your app to Google Play and App Store Connect.
    • EAS Update (eas update): Push JavaScript and asset fixes directly to users using branches, channels, runtime versions, rollouts, and rollbacks.
    • EAS Workflows (eas workflow): Automate development and release with CI/CD jobs defined in .eas/workflows.
    • EAS Hosting (eas deploy): Deploy Expo Router and React Native web apps and API routes.
    • EAS Metadata (eas metadata:push): Maintain app store presence from the command line (in preview).
    • Project Operations: Manage environment variables (eas env), signing credentials (eas credentials), Apple devices (eas device), update channels (eas channel), webhooks, and project settings.
  2. Use @expo/eas-json to interact with eas.json

    main
    @expo/eas-json is a library designed for programmatic interaction with the eas.json configuration file used by EAS (Expo Application Services). It provides utilities to read, parse, and manipulate the configuration structure used for builds, profiles, and deployment settings.
  3. EAS CLI Core Services Overview

    main

    EAS CLI acts as the interface for several Expo Application Services:

    • EAS Build (eas build): Cloud-based compilation and signing of Android and iOS apps, credential management, and internal distribution.
    • EAS Submit (eas submit): One-command uploading of apps to Google Play and App Store Connect.
    • EAS Update (eas update): Managing OTA updates via branches, channels, runtime versions, rollouts, and rollbacks.
    • EAS Workflows (eas workflow): CI/CD automation using .eas/workflows to build, test, submit, and deploy.
    • EAS Hosting (eas deploy): Deployment of Expo Router/React Native web apps and API routes.
    • EAS Metadata (eas metadata:push): Managing app store presence (currently in preview).
    • Project Operations: Commands like eas env, eas credentials, eas device, and eas channel for managing environment variables, signing, devices, and settings.
  4. What is Turtle Worker

    main
    Turtle Worker is a service that runs on every worker VM or pod within the EAS infrastructure. It acts as a wrapper for the @expo/build-tools library, exposing a WebSocket server to communicate with the Turtle Launcher. Its primary responsibility is to receive build requests and execute the actual build process for React Native projects.
  5. What is eas-cli-local-build-plugin

    main

    eas-cli-local-build-plugin is a light wrapper around the @expo/build-tools library designed to execute builds on a local machine. It is an internal tool used by the eas build --local command within the eas-cli ecosystem.

    Note that this package is not intended for direct use by developers; instead, it should be accessed via the standard EAS CLI interface.

  6. How the next EAS CLI version is determined

    main

    The EAS CLI release algorithm automatically selects the next version number by inspecting the entries in the unreleased section of CHANGELOG.md. It follows standard semantic versioning (semver) rules based on the following priority:

    1. MAJOR bump: If there are any entries under the 🛠 Breaking changes section.
    2. MINOR bump: If there are no breaking changes, but there are entries under the 🎉 New features section.
    3. PATCH bump: If there are no breaking changes and no new features (e.g., only bug fixes or maintenance).
  7. How Turtle Worker and Launcher communicate via WebSockets

    main

    Communication between the launcher and the worker follows a specific lifecycle driven by WebSocket messages. The process begins when the launcher sends a state-query message, to which the worker responds with a state-response containing its current status. The subsequent actions depend on that status:

    • New Instance: If state-response contains "status": "new", the launcher sends a dispatch message to start a new build.
    • Recovery (Finished Build): If the worker was restarted after a build already completed (success or failure), the state-response contains the build result, and the launcher sends a close message.
    • Recovery (In-Progress Build): If the worker was restarted while a build was still running, state-response contains "status": "in-progress", and the launcher takes no further action.

    Completion Lifecycle: When a build finishes, the worker sends either a success or error message. The launcher then responds with a close message to initiate a graceful shutdown of the VM or pod.

  8. Understand the role of @expo/eas-build-job

    main

    The @expo/eas-build-job package provides the shared data contracts for EAS Build jobs. It contains the TypeScript types and Joi schemas that define the structure of a job object.

    This package ensures consistency across different parts of the EAS ecosystem:

    • eas-cli: Uses these schemas to create and validate job objects.
    • EAS Build workers: Use these schemas to process incoming jobs.
    • eas-cli-local-build-plugin: Uses these schemas to run local builds.

    If you are building tools that interact with EAS Build jobs, you should use this package to ensure your job objects conform to the expected schema.

  9. Template syntax for @expo/template-file

    main

    Variables in a template file are substituted using double curly braces: {{ VARIABLE_NAME }}. The values provided in the envs object are injected into these positions during the substitution process.

    // abc.json.template contents:
    {
      "someKey": {{ ABC }},
      "anotherKey": {{ XYZ }}
    }
  10. Understand RecordSim output format

    main

    RecordSim produces an Apple HLS/CMAF-style fragmented MP4 output. This format is designed so that segments can be uploaded while the recording is still in progress.

    Segmented Mode (Default)

    When --segment-duration is greater than 0, the output directory contains:

    • init.mp4: The fMP4 initialization segment.
    • session.json: Metadata required to build a playlist (HLS version, target duration, media sequence, initSegment, and an ordered array of segments with file paths and durations).
    • segments/: A directory containing individual .m4s media segments (e.g., segment-000000.m4s).

    Note: Individual .m4s files are not standalone MP4 files and must be used with the init.mp4 segment.

    Single-File Mode

    When --segment-duration 0 is used, the output is a single continuous recording.mp4 file.

    session/
      init.mp4
      session.json
      segments/
        segment-000000.m4s
        segment-000001.m4s
  11. Create an EAS Build function module

    main

    Use the create-eas-build-function scaffolding tool to quickly generate the function module required for creating custom EAS Build builds. This tool sets up the necessary structure to implement custom build logic within the EAS ecosystem.

    # With NPM
    npx create-eas-build-function
    
    # With Yarn
    yarn create eas-build-function
    
    # With pnpm
    pnpm create eas-build-function
  12. Run config examples from the @expo/steps directory

    main

    To run configuration examples located in the examples/ directory of the monorepo (e.g., examples/simple), you must first build the monorepo and then alias the CLI script in your shell configuration.

    1. Build the monorepo: Run yarn and yarn build in the root directory.
    2. Alias the script: Add the following line to your .zshrc or .bashrc (replacing the path with your actual local path): alias eas-steps="/REPLACE/WITH/PATH/TO/eas-cli/packages/steps/cli.sh"
    3. Execute the example: Navigate to the example directory and run the command with the required arguments.