How to make Expo Eject non interactive


Expo eject creates the iOS/Android native templates. How can I execute this as a part of a bash script when I run it I get the following prompt:

It's recommended to commit all your changes before proceeding, so you can revert the changes made by this command if necessary.

? Would you like to proceed? › (Y/n)
✔ Would you like to proceed? … yes

📝  Android package Learn more:

? What would you like your Android package name to be? › com.expo.example

I presumed including app.json or app.config.js with the bundle ID and version info etc would be enough to suppress the prompt – which requests that exact info. Is there a way to stop expo eject being interactive?

  Usage: eject [path] [options]

  Create Xcode and Android Studio projects for your app. Use this if you
  need to add custom native functionality.
    --no-install               Skip installing npm packages and CocoaPods.
    --npm                      Use npm to install dependencies. (default when Yarn is not installed)
    -p, --platform [platform]  Platforms to sync: ios, android, all. Default: all
    --config [file]            Deprecated: Use app.config.js to switch config files instead.
    -h, --help                 output usage information

The following solution seemed to work for me. However it would have been nice if this flag was included in the expo eject --help listing.

echo "y" | expo eject --non-interactive

Instead of “echo y”, you could use the yes command that was invented for exactly this sort of usecase :joy:

I haven’t tried it myself, but making sure everything is committed and that the package/bundle ID are defined should in theory cause expo eject not to prompt for anything.