* chore(runtime): clone runtime basis as separate package * chore: add continuous integration for `snack-runtime` * refactor(snack-runtime): fix linting issues * fix(snack-runtime): add missing dependencies * feature(runtime-shell): add new shell-like app that consumes `snack-runtime` * fix(snack-runtime): add S3 asset resolver for Snack assets * feature(snack-runtime): add direct-load capability to render Snacks without Snack website sessions * refactor(snack-runtime): drop outdated amplitude * feature(snack-runtime): add `snack-runtime` lifecycle event callbacks * refactor(snack-runtime): drop `expo-updates` dependency in favor of `onSnackReload` * feature(snack-runtime): add a vendored Reaniamted plugin to transpile user-provided code * fix(snack-runtime): resolve linting issue * chore(runtime-shell): clean up index file * feature(snack-runtime): add context-based config API for runtime modules * chore(snack-runtime): fix linting issue * fix(snack-runtime): move constants to production-first defaults * chore(snack-runtime): prepare for initial official release `0.3.0-rc.1` * fix(snack-runtime): consolidate `UrlUtils` and `utils/SnackUrls` * fix(snack-runtime): replace environment validation with if statement * docs(snack-runtime): add basic readme documentation * chore(runtime-shell): clean up shell app * chore(snack-runtime): fix linting issue * chore(runtime-shell): backport asset workaround for the runtime web app * chore(snack-runtime): drop `prepublishOnly` task as there is no build or clean step * fix(snack-runtime): pull `ExpoRouterEntry` out of `snack-runtime` * chore(snack-runtime): release `[email protected]` with `expo-router` fix * chore(snack-runtime): add missing `path` dependency * fix(snack-runtime): pull `ExpoRouterEntry` out of commonly aliased modules * fix(snack-runtime): use proper module source when initializing systemjs aliases * chore(snack-runtime): prepare version `[email protected]` * chore(snack-runtime): fix linting issue
2.9 KiB
Snack Runtime
The Snack runtime is an Expo App that loads and runs the Snack code from https://snack.expo.dev or from any other app using the snack-sdk. The Snack runtime exists in two flavours:
- A native runtime for Expo Go
- A web-player for running Snacks in the browser
Development
To start the runtime in development mode, install the dependencies and start it as a regular Expo app.
cd runtimeyarn installexpo start
Web player development
Start the runtime as a web-player by using expo start --web or choosing Run in web browser after running expo start.
In the Snack website, select the localhost option from the Expo version picker at the bottom. This will cause the development web-player to load within the "Web" iframe of http://snack.expo.test.
Native runtime development
Use expo start to start the runtime and scan the QR-code with your device.
This loads the runtime into Expo Go and displays another QR-code scanner. Now, use this QR-code scanner to load any Snack by scanning the QR-code from the My Device tab. This will cause the Snack to load using the development runtime. By shaking your device and choosing "Reload" you can return to the runtime QR-code scanner.
Deployment
The runtime is auto-deployed to Staging upon mergin to main.
To deploy to production, run the deploy dispatch trigger of the RuntimeProduction Github Action workflow.
To manually deploy or learn more about deploying, see the Deployment guide.
Loading states
| Visible state | Process state |
|---|---|
| Blank screen (web-only) | The web-player has not loaded index.html or the logo image (this may indicate a slow network connection or a hosting error) |
| Snack logo (non blinking) | The runtime is being loaded |
| Snack logo (blinking) | Runtime has loaded |
Update indicator Connecting... |
Runtime is waiting for the snack code |
Update indicator Loading... |
Code has been received and is being loaded for the first time |
Update indicator Updating... |
New code has been received, runtime is applying updates |
Update indicators are only shown when the operation takes too long (after 3 seconds)