nx/packages/expo/docs/run-examples.md
Isaac Mann afa5eb59fa
docs(core): document the @nrwl => @nx rescope (#16403)
Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
2023-04-27 18:14:59 -04:00

1.7 KiB

The run command allows you to compile your app locally.

project.json:

{
  "name": "mobile",
  //...
  "targets": {
    //...
    "run-ios": {
      "executor": "@nx/expo:run",
      "options": {
        "platform": "ios"
      }
    },
    "run-android": {
      "executor": "@nx/expo:run",
      "options": {
        "platform": "android"
      }
    }
    //...
  }
}
nx run mobile:run-ios
nx run mobile:run-android

Examples

{% tabs %} {% tab label="Compile Android with Different Variants" %} The variant option allows you to specify the compile Android app with variants defined in build.gradle file (e.g. debug, release).

    "run-android": {
      "executor": "@nx/expo:run",
      "options": {
        "platform": "android",
        "variant": "release"
      }
    }

{% /tab %} {% tab label="Compile iOS with Different Configurations" %}

The xcodeConfiguration option allows you to specify Xcode configuration to use (e.g. Debug or Release).

    "run-ios": {
      "executor": "@nx/expo:run",
      "options": {
        "platform": "ios",
        "xcodeConfiguration": "Release"
      }
    }

{% /tab %} {% tab label="Run on a device" %}

The device option allows you to launch your app in a specific device name or UDID. To see all your iOS simulators: run xcrun simctl list devices available. To see all your Android emulators, run: emulator -list-avds.

    "run-ios": {
      "executor": "@nx/expo:run",
      "options": {
        "platform": "ios",
        "device": "iPhone 14"
      }
    },
    "run-android": {
      "executor": "@nx/expo:run",
      "options": {
        "platform": "android",
        "device": "Pixel_XL_API_Tiramisu"
      }
    }

{% /tab %} {% /tabs %}