Skip to content

Commit f3376f3

Browse files
abueideclaude
andauthored
docs: fix stale release/build docs and rename guide to RELEASING.md (#1285)
Rename wiki/release.md -> root RELEASING.md to match the convention used across the other Segment SDK repos (analytics-swift, -kotlin, -next), and update its references in CONTRIBUTING.md and wiki/devbox.md. CONTRIBUTING.md: - Replace nonexistent `yarn bootstrap` with `devbox shell` / `yarn install` - `yarn typescript` -> `yarn typecheck` (script was renamed) - Replace removed `yarn e2e ...` commands with the Devbox/Detox flow in the example workspaces; fix `/example/` paths to examples/AnalyticsReactNativeExample - Release section: name the actual `Release` workflow (was `Publish`) and its dry-run/beta/production types RELEASING.md (moved from wiki/release.md): - Drop the nonexistent `--config=shells/devbox-fast.json` flag from the sync-versions and release-dry-run commands (scripts live in root devbox.json) wiki/devbox.md: - Rewrite to reflect that Android/iOS SDK, emulator/simulator, and device management moved into the segment-integrations/mobile-devtools Devbox plugins consumed by the example workspaces; the root env is now build/test/release only - Remove dead references to nix/, shells/, and examples/E2E/ - Correct the Releases note: npm publishing uses OIDC trusted publishing, not NPM_TOKEN Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 049b8ec commit f3376f3

4 files changed

Lines changed: 112 additions & 75 deletions

File tree

CONTRIBUTING.md

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@ React Native requires different versions of the tools/languages you might be usi
1515

1616
## Development workflow
1717

18-
To get started with the project, run `yarn bootstrap` in the root directory to install the required dependencies for each package:
18+
To get started with the project, install the dependencies for each package. The recommended path is to enter the Devbox shell, whose init hook runs `yarn install` for you (see [wiki/devbox.md](/wiki/devbox.md)):
1919

2020
```sh
21-
yarn bootstrap
21+
devbox shell
2222
```
2323

24-
While developing, you can run the [example app](/example/) to test your changes.
25-
code
24+
If you are not using Devbox, install dependencies directly with:
25+
26+
```sh
27+
yarn install
28+
```
29+
30+
While developing, you can run the [example app](/examples/AnalyticsReactNativeExample/) to test your changes.
31+
2632
To start the packager:
2733

2834
```sh
@@ -44,7 +50,7 @@ yarn example ios
4450
Make sure your code passes TypeScript and ESLint. Run the following to verify:
4551

4652
```sh
47-
yarn typescript
53+
yarn typecheck
4854
yarn lint
4955
```
5056

@@ -60,24 +66,25 @@ Remember to add tests for your change if possible. Run the unit tests by:
6066
yarn test
6167
```
6268

63-
The are also end-to-end tests. First you will have to build the app and then run the tests:
69+
There are also end-to-end tests, driven by Detox through Devbox in the example workspaces under `examples/` (`e2e-latest` and `e2e-compat`). The E2E scripts live in each example's `devbox.json`, not the repo root. From an example directory you build, then test:
6470

65-
```
66-
# Start the server (*note there's a separate e2e command*)
67-
yarn e2e start:e2e
71+
```sh
72+
cd examples/e2e-latest # or examples/e2e-compat
6873

6974
# iOS
70-
yarn e2e e2e:build:ios
71-
yarn e2e e2e:test:ios
75+
devbox run build:ios
76+
devbox run test:ios
7277

7378
# Android
74-
yarn e2e e2e:build:android
75-
yarn e2e e2e:test:android
79+
devbox run build:android
80+
devbox run test:android
7681
```
7782

78-
To edit the Objective-C / Swift files, open `example/ios/AnalyticsReactNativeExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > @segment/analytics-react-native`.
83+
See [wiki/e2e/setup.md](/wiki/e2e/setup.md) for the full setup, and `.github/workflows/e2e-tests.yml` for how CI orchestrates these runs.
84+
85+
To edit the Objective-C / Swift files, open `examples/AnalyticsReactNativeExample/ios/AnalyticsReactNativeExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > @segment/analytics-react-native`.
7986

80-
To edit the Kotlin files, open `example/android` in Android studio and find the source files at `segmentanalyticsreactnative` under `Android`.
87+
To edit the Kotlin files, open `examples/AnalyticsReactNativeExample/android` in Android studio and find the source files at `segmentanalyticsreactnative` under `Android`.
8188

8289
### Commit message convention
8390

@@ -102,21 +109,20 @@ Our pre-commit hooks verify that the linter and tests pass when committing.
102109

103110
### Scripts
104111

105-
The `package.json` file contains various scripts for common tasks:
112+
The root `package.json` file contains various scripts for common tasks:
106113

107-
- `yarn bootstrap`: setup project by installing all dependencies and pods.
108-
- `yarn typescript`: type-check files with TypeScript.
114+
- `yarn typecheck`: type-check files with TypeScript.
109115
- `yarn lint`: lint files with ESLint.
110116
- `yarn test`: run unit tests with Jest.
117+
- `yarn build`: build all public workspaces.
111118
- `yarn example start`: start the Metro server for the example app.
112119
- `yarn example android`: run the example app on Android.
113120
- `yarn example ios`: run the example app on iOS.
114-
- `yarn e2e e2e:build:ios`: builds the e2e app using detox
115-
- `yarn e2e e2e:test:ios`: runs the e2e on a simulator(headless if not ran manually)
116-
- `yarn e2e e2e:build:android`: builds the e2e app using detox
117-
- `yarn e2e e2e:test:android`: runs the e2e on an emulator
118-
- `yarn e2e ios:deeplink`: opens the ios app via deep link (example app must already be installed)
119-
- `yarn e2e android:deeplink`: opens the Android app via deep link (example app must already be installed)
121+
122+
End-to-end tests are run from the example workspaces via Devbox (see above and `examples/<example>/devbox.json`):
123+
124+
- `devbox run build:ios` / `devbox run test:ios`: build and run the iOS E2E suite with Detox.
125+
- `devbox run build:android` / `devbox run test:android`: build and run the Android E2E suite with Detox.
120126

121127
### Sending a pull request
122128

@@ -132,10 +138,10 @@ When you're sending a pull request:
132138

133139
## Release
134140

135-
Release is automated in GHA. By default `yarn release` won't let you trigger a release from your personal computer.
141+
Release is automated in GitHub Actions. By default `yarn release` won't let you trigger a release from your personal computer.
136142

137-
To trigger a release go to Actions. Select the `Publish` workflow and trigger a new job.
143+
To trigger a release, go to Actions, select the `Release` workflow, click "Run workflow", and choose a release type (`dry-run`, `beta`, or `production`).
138144

139-
Automatically the workflow will analyze the commits, bump versions, create changesets, build and release to NPM the packages that need so.
145+
The workflow analyzes the conventional-commit history, bumps versions, builds, and publishes to npm the packages that need it. See [RELEASING.md](/RELEASING.md) for the full release guide (release types, beta/fix-candidate flow, and version syncing).
140146

141-
The CI/CD is automated using [semantic-release](https://github.com/semantic-release/semantic-release).
147+
The CI/CD is automated using [semantic-release](https://github.com/semantic-release/semantic-release) and [multi-semantic-release](https://github.com/qiwi/multi-semantic-release).
File renamed without changes.

wiki/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ Internal documentation for analytics-react-native contributors.
1919

2020
## Release
2121

22-
- [Release Guide](release.md) — Cutting releases with semantic-release and multi-semantic-release
22+
- [Release Guide](../RELEASING.md) — Cutting releases with semantic-release and multi-semantic-release

wiki/devbox.md

Lines changed: 77 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,101 @@
11
# Devbox
22

3-
This repo uses [Devbox](https://www.jetify.com/devbox/) for reproducible builds. Each example app has its own `devbox.json` that pins Node.js, JDK, and build tools via Nix, with the [`mobile-devtools`](https://github.com/segment-integrations/mobile-devtools) plugin providing emulator/simulator management.
3+
This repo uses [Devbox](https://www.jetify.com/devbox/docs/) to provide reproducible, project-local development environments. Devbox uses Nix under the hood to pin tool versions so everyone gets the same setup. You don't need to know Nix to use it.
44

5-
The root `devbox.json` is for library development only (linting, building, testing, releasing). E2E builds and device management live in the per-app configs.
5+
There are two tiers of Devbox environment in this repo:
66

7-
## Getting started
7+
1. **Root environment** (`devbox.json` at the repo root) — a lean environment for building, testing, linting, formatting, and releasing the library packages. It does **not** provision the Android SDK, emulators, or iOS simulators.
8+
2. **Example/E2E environments** (`examples/e2e-latest/devbox.json`, `examples/e2e-compat/devbox.json`) — full mobile build + device environments for running the Detox end-to-end suites. These provision the Android and iOS toolchains via the shared [mobile-devtools](https://github.com/segment-integrations/mobile-devtools) Devbox plugins.
89

9-
1. Install Devbox: https://www.jetify.com/devbox/docs/installing_devbox/
10-
2. Navigate to an example app directory:
11-
```bash
12-
cd examples/e2e-compat # or e2e-latest
13-
```
14-
3. Run commands via `devbox run`:
15-
```bash
16-
devbox run install
17-
devbox run install:pods # iOS only
18-
devbox run build:android
19-
devbox run build:ios
20-
```
10+
## Root environment
2111

22-
## Per-app configuration
12+
Enter it from the repo root with `devbox shell`. The init hook sets `PROJECT_ROOT`, adds `node_modules/.bin` to `PATH`, runs `yarn install` if dependencies are missing, prebuilds `packages/core/src/info.ts`, and installs the Husky git hooks.
2313

24-
Each example app's `devbox.json` defines:
14+
### Packages
2515

26-
- **Packages**: Node.js, Yarn, JDK, and optional extras (watchman, etc.)
27-
- **Plugin**: `mobile-devtools` from `github:segment-integrations/mobile-devtools?dir=plugins/react-native&ref=main`
28-
- **Environment variables**: SDK versions, artifact paths, cmake version
29-
- **Scripts**: `install`, `install:pods`, `build:android`, `build:ios`, `test:android`, `test:ios`
16+
`cocoapods`, `nodejs` 22, `yarn-berry`, `jq`, `treefmt`, `nixfmt`, `shfmt`.
3017

31-
### Plugin-provided scripts
18+
### Scripts
3219

33-
The `mobile-devtools` plugin adds device management commands:
20+
Run with `devbox run <script>`:
3421

35-
| Script | Description |
36-
| -------------------- | --------------------------- |
37-
| `start:emu [device]` | Start Android emulator |
38-
| `stop:emu` | Stop Android emulator |
39-
| `start:sim [device]` | Start iOS simulator |
40-
| `stop:sim` | Stop iOS simulator |
41-
| `start:android` | Build + deploy to emulator |
42-
| `start:ios` | Build + deploy to simulator |
22+
- `build` — build all public workspaces (`yarn build`).
23+
- `test` — run unit tests (`yarn test`).
24+
- `typecheck` — type-check (`yarn typecheck`).
25+
- `lint` / `format` / `format-check` — ESLint and treefmt.
26+
- `check` — runs lint, format-check, build, typecheck, and test in sequence (the local equivalent of CI).
27+
- `clean` — clean build artifacts and `node_modules`.
28+
- `release` / `release-dry-run` — run multi-semantic-release (see [RELEASING.md](../RELEASING.md)); these are invoked by the `Release` GitHub workflow, not run locally as a rule.
29+
- `sync-versions` — reconcile `package.json` versions with what was published to npm (`scripts/sync-versions.sh`).
30+
- `update-apps` — refresh the example apps' dependencies against the workspace.
31+
- `ci:install` / `ci:commitlint` — used by CI.
4332

44-
## Root devbox.json
33+
## Example / E2E environments
4534

46-
The root config is for library development and CI:
35+
The Detox E2E suites live in the example workspaces:
4736

48-
| Script | Description |
49-
| --------------- | ------------------------------------- |
50-
| `build` | Build all packages |
51-
| `test` | Run unit tests |
52-
| `lint` | Run ESLint |
53-
| `typecheck` | Run TypeScript type checking |
54-
| `format` | Format with prettier |
55-
| `release` | Publish packages via semantic-release |
56-
| `sync-versions` | Sync package.json versions with npm |
37+
- `examples/e2e-latest` — newest supported React Native.
38+
- `examples/e2e-compat` — minimum supported React Native.
39+
40+
Each `devbox.json` includes the React Native plugin from mobile-devtools:
41+
42+
```json
43+
"include": [
44+
"github:segment-integrations/mobile-devtools?dir=plugins/react-native&ref=main"
45+
]
46+
```
47+
48+
The React Native plugin composes the Android and iOS plugins, which provide the emulator/simulator lifecycle and device management. Project-local device definitions and lock files are committed under each example's `devbox.d/` directory (`segment-integrations.mobile-devtools.android/` and `…ios/`, with `devices/min.json` and `devices/max.json` plus their `.lock` files), so the SDK/device configuration is reviewable in PRs and reproducible across machines.
49+
50+
### Running E2E
51+
52+
From an example directory:
53+
54+
```sh
55+
cd examples/e2e-latest # or examples/e2e-compat
56+
57+
# iOS
58+
devbox run build:ios
59+
devbox run test:ios
60+
61+
# Android
62+
devbox run build:android
63+
devbox run test:android
64+
```
65+
66+
The `build:*` scripts are defined locally in each example's `devbox.json`; `test:*` boot a simulator/emulator (via the plugin's `start:sim` / `start:emu`) and then run Detox. See [wiki/e2e/setup.md](e2e/setup.md) for the shared test architecture and [.github/workflows/e2e-tests.yml](../.github/workflows/e2e-tests.yml) for how CI orchestrates the matrix.
67+
68+
### Plugin-provided commands
69+
70+
The mobile-devtools React Native plugin exposes device/build helpers that the example scripts build on, including:
71+
72+
- **Android:** `devbox run start:emu`, `devbox run stop:emu`, `devbox run reset:emu`, `devbox run start:android` (build + install + launch).
73+
- **iOS:** `devbox run start:sim`, `devbox run stop:sim`, `devbox run start:ios` (build + install + launch).
74+
- **Metro:** `devbox run start:metro`, `devbox run stop:metro`.
75+
- **Diagnostics:** `devbox run doctor`, `devbox run verify:setup`.
76+
77+
For the full command list, configurable env vars, and device-definition/lock-file workflow, see the plugin docs in the [mobile-devtools](https://github.com/segment-integrations/mobile-devtools) repo (`plugins/react-native/README.md` and `REFERENCE.md`, plus the `plugins/android` and `plugins/ios` READMEs).
78+
79+
### Configuring SDK / device versions
80+
81+
SDK levels and build tools are set via env vars in the example's `devbox.json` (e.g. `ANDROID_COMPILE_SDK`, `ANDROID_BUILD_TOOLS_VERSION`, `CMAKE_VERSION`, `ANDROID_APP_APK`, `IOS_APP_ARTIFACT`). Device targets are defined in the `devbox.d/.../devices/*.json` files and pinned by the adjacent `.lock` files; after editing a device definition, regenerate its lock file per the plugin docs. The Detox device wiring lives in each example's `.detoxrc.js`.
5782

5883
## iOS build notes
5984

85+
iOS uses the host Xcode toolchain — there is no Nix-provisioned iOS SDK. Make sure full Xcode is installed (Command Line Tools alone are not enough for `simctl`), the right toolchain is selected (`xcode-select --print-path`), and you have accepted the Xcode license. On macOS, `devbox shell` injects Nix toolchain variables; the plugin's init hooks re-select the system toolchain so Xcode builds work.
86+
6087
Both example apps use a two-step iOS build to avoid Metro resolution issues in the monorepo:
6188

62-
1. `RCT_NO_LAUNCH_PACKAGER=1 SKIP_BUNDLING=1 xcodebuild ...` — builds native binary without bundling JS or spawning Metro
63-
2. `react-native bundle ...` — creates the JS bundle directly into the .app
89+
1. `RCT_NO_LAUNCH_PACKAGER=1 SKIP_BUNDLING=1 xcodebuild ...` — builds the native binary without bundling JS or spawning Metro.
90+
2. `react-native bundle ...` — creates the JS bundle directly into the `.app`.
6491

6592
`RCT_NO_LAUNCH_PACKAGER=1` prevents the Xcode "Start Packager" build phase from opening a Metro terminal during release builds.
6693

6794
## Android build notes
6895

69-
- `e2e-compat` (RN 0.72): Standard `./gradlew assembleRelease`
70-
- `e2e-latest` (RN 0.84): Runs `generateCodegenArtifactsFromSchema --rerun-tasks` before assembly (required for New Architecture)
96+
- `e2e-compat` (RN 0.72): standard `./gradlew assembleRelease`.
97+
- `e2e-latest` (RN 0.84): runs `generateCodegenArtifactsFromSchema --rerun-tasks` before assembly (required for the New Architecture).
98+
99+
## Releases
100+
101+
`devbox run release` (root environment) runs `yarn install --immutable`, `yarn build`, and `yarn release` (multi-semantic-release). It is invoked by the production/beta jobs of the `Release` GitHub workflow. Publishing to npm uses OIDC trusted publishing with provenance — there is **no** `NPM_TOKEN`; the workflow passes only `GH_TOKEN` (`github.token`) for GitHub releases. See [RELEASING.md](../RELEASING.md) for the full release guide.

0 commit comments

Comments
 (0)