Skip to content

Releases: bidah/native-sim

v0.2.2 — preview no longer rejects the tunnel

Choose a tag to compare

@bidah bidah released this 03 Oct 20:35

Fixes the live preview rejecting the tunnel.

Preview rejected the tunnel's Host header (#6)

The workflow started serve-sim with --detach. serve-sim's detached child process
doesn't inherit --allow-any-host-when-insecure, so the preview checked the Host
header and turned away requests arriving through the tunnel hostname.

The workflow now starts serve-sim in the background itself, with nohup, rather than
--detach. It passes --allow-any-host-when-insecure, and if serve-sim never becomes
ready, its log is printed in the job output — thanks @NikhilRW.

Upgrading

npm install -g native-sim@0.2.2
native-sim init     # refreshes the workflow to template v24

The fix is in the workflow template, so existing repos need native-sim init.

Full changelog: v0.2.1...v0.2.2

v0.2.1 — React Native CLI apps, monorepos, Fast Refresh, telemetry

Choose a tag to compare

@bidah bidah released this 03 Oct 11:38

React Native CLI apps, monorepos and Fast Refresh, a sturdier tunnel download, and anonymous usage telemetry.

React Native CLI apps (#5)

native-sim was Expo-only. It now builds plain React Native CLI apps too — thanks @NikhilRW.

native-sim up --framework react-native --public

Expo stays the default. A React Native CLI project builds from its checked-in ios/
(Podfile and Xcode project) instead of expo prebuild, and up, init and doctor
validate the project for the framework you pick. On a Release cache hit, the bundle is
refreshed with react-native bundle rather than expo export:embed.

Monorepos — --project-dir

Run from the repository root and point at the app:

native-sim up --project-dir apps/mobile
native-sim up --framework react-native --project-dir apps/native

The workflow and auth gate live at the root, dependencies install from the root
lockfile (Bun, pnpm, Yarn or npm) so workspace packages resolve, and the framework
build, native cache and exported archive use the app directory.

Fast Refresh from your computer — --dev and --dev-url

--dev builds a Debug app that loads JavaScript from your local Metro instead of a
bundle. --dev-url points it at Metro directly:

  • Expo: pass the development-client link from npx expo start --dev-client --tunnel.
  • React Native CLI: pass a public HTTPS tunnel to Metro. The runner puts a Caddy
    proxy on the simulator's localhost:8081 that forwards to it.

The tunnel must be reachable from GitHub's runner; localhost and LAN URLs won't work.

Caching

Framework, app directory and Debug/Release are now part of the native build cache key,
so switching any of them can't restore the wrong build.

Tunnel download retries (#4)

The cloudflared download in the workflow had no retry, and GitHub Releases downloads
on macOS runners occasionally die mid-transfer (curl exit 56). That step runs after the
build, so one flaky download threw away a whole run. It now retries, including on
transport errors — thanks @hhwjsw711.

Telemetry

native-sim now sends anonymous usage stats, so we can see which commands and options
people actually use:

  • the command, and whether it failed and after how long
  • the flags passed. --framework, --mode, --transport, --codec, --device and the
    numeric options are sent by value; on/off flags as true/false; everything else
    (--repo, --app, --app-file, --project-dir, --dev-url, --message, …) only
    as "set", never by value
  • the native-sim version, OS, CPU architecture, Node version and whether it ran in CI
  • a random ID created on first run in ~/.config/native-sim/telemetry.json

Nothing from your project, repository, GitHub account, credentials or stream is sent.
The first run prints a one-line notice. Opt out with DO_NOT_TRACK=1 or
NATIVE_SIM_TELEMETRY_DISABLED=1. Requests are capped at 1.5 seconds and never change a
command's output or exit code. Details in the README.

Upgrading

npm install -g native-sim@0.2.1
native-sim init     # refreshes the workflow to template v21

0.2.1 supersedes 0.2.0, which shipped the telemetry without the changes above.

Full changelog: v0.1.1...v0.2.1

v0.1.1 — Windows support and --app-file fix

Choose a tag to compare

@bidah bidah released this 21 Sep 13:44

Two reported bugs, both of which made a correctly installed setup look broken.

GitHub CLI reported as missing on Windows (#2)

native-sim doctor showed ✗ git and ✗ gh CLI, and native-sim up failed with
GitHub CLI not found. Install it: brew install gh — on machines where gh was
installed and logged in.

Every tool probe went through which, which does not exist on Windows. The tell in
the report was that the same run's gh repo view succeeded: gh ran fine, only the
probe for it failed.

native-sim now resolves commands against PATH in Node, honouring PATHEXT, so gh
finds gh.exe and agent-device finds its .cmd shim. Along the way:

  • .cmd / .bat shims (how npm installs CLIs on Windows) are run through cmd.exe,
    since spawn cannot execute a script directly. Arguments are quoted here rather
    than left for cmd.exe to re-split, so paths with spaces survive.
  • Lookup searches PATH only, never the working directory — a checked-out repo
    cannot shadow gh or git with its own binary.
  • Opening the browser at the end of a session used the macOS-only open. On Windows
    and Linux its ENOENT surfaced as an uncaught exception after the stream was
    already live. It now uses start / xdg-open and never throws.
  • gh secret list output is CRLF on Windows, which left a trailing \r on every
    secret name.
  • The "not found" message now suggests the right installer per platform.

--app-file failed on the runner after a full boot (#1)

--app-file uploaded the build to a draft release, and the workflow job runs with
contents: read by design. GitHub only returns draft releases to callers with push
access, so gh release download 404'd with release not found — after a runner had
spun up and billed for the whole boot. Everything upstream (tunnel, serve-sim, auth
gate, agent-device proxy) was healthy, which made it hard to read.

Raising the job to contents: write would fix the symptom by handing repo write
access to a job that also opens a public tunnel. That is the worse trade, so
native-sim publishes the release instead:

  • Private repo — no change in exposure. Release assets inherit repo visibility, so
    the build stays readable only by people who can already read the repo.
  • Public repo — the asset is genuinely downloadable by anyone. up and upload
    now say so at upload time and point at --r2 to keep the build private.

A draft native-sim-build release left by an earlier version is published on next use,
so no manual step is needed. If the workflow ever does meet a draft, it now explains the
cause instead of failing with a bare release not found.

Upgrading

npm install -g native-sim@0.1.1
native-sim init     # refreshes the workflow to template v19

The workflow template is versioned; native-sim init updates an out-of-date one in
place and leaves a deliberately customised one alone.

Full changelog: v0.1.0...v0.1.1