@expo/serve-sim 0.1.52 → 0.1.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -3
- package/dist/middleware.js +56 -55
- package/dist/native/serve-sim-native.node +0 -0
- package/dist/serve-sim.js +74 -73
- package/dist/state.js +1 -1
- package/package.json +5 -2
- package/src/ax.ts +12 -0
- package/src/native.ts +10 -0
- package/src/state.ts +13 -1
package/README.md
CHANGED
|
@@ -295,11 +295,82 @@ The npm package ships the native capture addon and LiveKit WebRTC framework alon
|
|
|
295
295
|
|
|
296
296
|
```sh
|
|
297
297
|
bun install
|
|
298
|
-
bun run packages/serve-sim/build.ts
|
|
299
|
-
packages/serve-sim/Sources/SimNative/build.sh
|
|
300
|
-
bun run --filter serve-sim dev
|
|
298
|
+
bun run packages/serve-sim/build.ts # full production build
|
|
299
|
+
packages/serve-sim/Sources/SimNative/build.sh # native addon only
|
|
300
|
+
bun run --filter @expo/serve-sim dev # watch mode
|
|
301
|
+
bun run --filter @expo/serve-sim tart-dev # guest preview at localhost:3200
|
|
302
|
+
bun run --filter @expo/serve-sim tart-test -- <files> # bun test on the guest
|
|
301
303
|
```
|
|
302
304
|
|
|
305
|
+
### Tart guest
|
|
306
|
+
|
|
307
|
+
Run serve-sim **on a [tart](https://github.com/cirruslabs/tart) macOS VM** instead of the host. SSH as Unix user `expo` (not `tart exec` as admin), which matches how EAS-shaped VMs actually run.
|
|
308
|
+
|
|
309
|
+
Needs the `tart` CLI, a VM with Xcode (default name `tahoe-xcode`), and a built native addon.
|
|
310
|
+
|
|
311
|
+
```sh
|
|
312
|
+
bun run packages/serve-sim/build.ts
|
|
313
|
+
bun run --filter @expo/serve-sim tart-dev
|
|
314
|
+
# → Preview at http://localhost:3200
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
`tart-dev` starts the VM if needed, boots an iPhone 17, runs `bun run dev.ts` on the guest, and tunnels guest `:3200` to the host. Host port `3200` must be free. Ctrl-C stops the tunnel and the guest server.
|
|
318
|
+
|
|
319
|
+
`tart-test` uses the same guest, but runs `bun test` there. It stages package src onto the VM, boots an iPhone, and executes the files you pass over SSH as `expo`. Pass the files; with none it exits instead of running the whole guest suite.
|
|
320
|
+
|
|
321
|
+
```sh
|
|
322
|
+
bun run --filter @expo/serve-sim tart-test -- src/__tests__/foo.test.ts
|
|
323
|
+
bun run --filter @expo/serve-sim tart -- test src/__tests__/foo.test.ts
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
First run creates the `expo` user and copies bun onto the guest (`bun run --filter @expo/serve-sim tart -- setup` if you want that step alone).
|
|
327
|
+
|
|
328
|
+
The VM mounts this checkout at `/Volumes/My Shared Files/serve-sim`. If the VM was started from a different worktree, stop it and rerun from this one.
|
|
329
|
+
|
|
330
|
+
```sh
|
|
331
|
+
bun run --filter @expo/serve-sim tart -- ssh # shell as expo
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
`tart` also has `up`, `boot`, and `stage` if you need the pieces separately.
|
|
335
|
+
|
|
336
|
+
Env (all optional): `TART_VM=tahoe-xcode`, `TART_USER=expo`, `TART_SHARE_NAME=serve-sim`, `PORT=3200`.
|
|
337
|
+
|
|
338
|
+
### EAS preview of a CI package
|
|
339
|
+
|
|
340
|
+
`--package-version` pins serve-sim only on `--type web-preview-only`. The other session types use the flag for their own package (`agent-device`, `appium`, `argent`) and always run serve-sim at `latest`, so a serve-sim tarball URL breaks them.
|
|
341
|
+
|
|
342
|
+
The `serve-sim tests` workflow packs `serve-sim.tgz` on every pull request and uploads it as `serve-sim-npm-package`. It packs before the tests run, so the tarball exists even when they fail. `Build @expo/serve-sim release` uploads the same artifact on demand. Copy the download URL from the run, then pass it as `--package-version`. Run these commands from an Expo project directory.
|
|
343
|
+
|
|
344
|
+
```sh
|
|
345
|
+
npx --yes eas-cli@latest workflow:runs --workflow sim-test.yml --limit 5
|
|
346
|
+
|
|
347
|
+
npx --yes eas-cli@latest workflow:view <workflow-run-id> --non-interactive --json \
|
|
348
|
+
| jq -er '.jobs[].artifacts[]? | select(.name == "serve-sim-npm-package") | .downloadUrl'
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
`--non-interactive` requires the run ID as an argument. Without it, `workflow:view` prompts for a run. Without `--json`, it prints a Log URL for the run on the Expo dashboard, and each job lists its artifacts with a Download URL.
|
|
352
|
+
|
|
353
|
+
The download URL is signed and expires one hour after `workflow:view` returns it. The worker installs the package minutes after the session starts, so copy a fresh URL for each session. An expired URL fails in the job log, not in your terminal. The URL also appears in that log, so anyone who can read the run can download the artifact until the URL expires.
|
|
354
|
+
|
|
355
|
+
```sh
|
|
356
|
+
npx --yes eas-cli@latest simulator:start --platform ios --type web-preview-only --non-interactive \
|
|
357
|
+
--name "serve-sim preview" \
|
|
358
|
+
--package-version '<download-url>'
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
EAS runs `npx @expo/serve-sim@<value>`, so the flag takes any npm spec: a version, a tag, or a tarball URL. Quote the URL.
|
|
362
|
+
|
|
363
|
+
Install and launch an app at start with one of `--build-id`, `--application-archive-url`, or `--expo-go`. `--launch-arg` and `--open-url` need one of those. `--sdk-version` needs `--expo-go`.
|
|
364
|
+
|
|
365
|
+
```sh
|
|
366
|
+
npx --yes eas-cli@latest simulator:start --platform ios --type web-preview-only --non-interactive \
|
|
367
|
+
--name "serve-sim preview" \
|
|
368
|
+
--package-version '<download-url>' \
|
|
369
|
+
--expo-go
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
EAS installs and launches the app before serve-sim starts. After the preview is up, drop an `.ipa` on the page to install another app. The page takes an `.ipa` or media, not an `.app` bundle or a build archive, so pass `--build-id` or `--application-archive-url` for those. Stop with `npx --yes eas-cli@latest simulator:stop`.
|
|
373
|
+
|
|
303
374
|
## Origin and attribution
|
|
304
375
|
|
|
305
376
|
`serve-sim` was created and open-sourced by [Evan Bacon](https://github.com/EvanBacon) in the [original serve-sim project](https://github.com/EvanBacon/serve-sim). This repository is an Expo-maintained fork. We are grateful to Evan for creating the project and making it available to the community.
|