@radhya/mach 2.0.41 → 2.0.42

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/docs/ota.md ADDED
@@ -0,0 +1,69 @@
1
+ # Mach OTA Updates
2
+
3
+ Mach OTA publishes JavaScript bundles and assets through Mach API and Mach-managed object storage. It does not publish releases to EAS Update, and mobile apps never receive storage credentials.
4
+
5
+ ## Supported apps
6
+
7
+ Mach currently uses the open-source `expo-updates` runtime for both supported React Native workflows:
8
+
9
+ | `framework` | Native workflow | OTA setup |
10
+ | --- | --- | --- |
11
+ | `expo` | Expo prebuild/CNG | Installs `expo-updates` and applies `@radhya/mach/expo-plugin` during prebuild. |
12
+ | `react-native` | Committed `ios/` and `android/` projects | Installs Expo Modules when needed, installs `expo-updates`, and synchronizes its native configuration without running prebuild. |
13
+
14
+ `mach-react-native` is reserved for a future Mach-owned client and is not a supported engine yet.
15
+
16
+ ## Initial setup
17
+
18
+ Run setup from the project root:
19
+
20
+ ```bash
21
+ mach ota setup
22
+ mach ota verify
23
+ ```
24
+
25
+ Setup reads project ID, framework, channel, runtime policy, and existing URL from `mach.config.json`. Command flags have higher precedence. Interactive setup asks before installing dependencies; use `mach --yes ota setup` in automation. Use `--skip-install` only when dependencies are managed separately.
26
+
27
+ For a bare React Native project, setup may make these intentional changes:
28
+
29
+ - Install and configure the `expo` package and Expo Modules autolinking.
30
+ - Install the React Native-version-compatible `expo-updates` package.
31
+ - Add `@radhya/mach/expo-plugin` to Expo app config.
32
+ - Synchronize the Mach URL, channel request header, and resolved runtime into Android native resources and `Expo.plist`.
33
+
34
+ Expo's official `install-expo-modules` and `expo-updates configuration:syncnative` commands perform version-sensitive native changes. Mach does not maintain a separate set of native text patches.
35
+
36
+ After setup, review the project diff and make one new native build:
37
+
38
+ ```bash
39
+ mach build --platform ios --profile production
40
+ mach build --platform android --profile production
41
+ ```
42
+
43
+ Only binaries built after setup can receive Mach OTA updates.
44
+
45
+ ## Publish
46
+
47
+ ```bash
48
+ mach ota publish --channel production --platform all --message "Fix checkout screen"
49
+ ```
50
+
51
+ Mach exports through Expo CLI for both Expo and bare React Native, uploads the protocol manifest and assets, and activates the release for the matching project, channel, platform, and runtime version.
52
+
53
+ The default `ON_LOAD` behavior downloads a compatible release on one cold launch and runs it on the next cold launch. The dashboard records unique downloaded, applied, and failed installations from Expo Updates request headers.
54
+
55
+ ## Runtime compatibility
56
+
57
+ The native binary and OTA manifest must contain the same runtime version. Mach injects the resolved runtime into Expo config during builds and publishes, and synchronizes it into committed bare native projects before a Mach build.
58
+
59
+ The default `appVersion` policy uses the app/package version as the compatibility boundary. Use an explicit `ota.runtimeVersion` or `--runtime-version` only when deliberately managing compatibility yourself.
60
+
61
+ ## Operations
62
+
63
+ ```bash
64
+ mach ota list
65
+ mach ota rollback --update-id <updateId>
66
+ mach ota promote --update-id <updateId>
67
+ ```
68
+
69
+ Rollback disables the selected active release so compatible clients receive the previous active release on their next checks. Promotion changes the active channel without rebuilding assets.
@@ -90,15 +90,16 @@ const resolveOta = config => {
90
90
  const ota = machConfig.ota || machConfig.update || {}
91
91
  if (ota.enabled === false) return { enabled: false }
92
92
  const projectId = nonEmpty(machConfig.projectId)
93
- const engine = nonEmpty(ota.engine) || (machConfig.framework === 'expo' ? 'expo-updates' : undefined)
93
+ const engine = nonEmpty(ota.engine) || 'expo-updates'
94
94
  const url = first(
95
+ process.env.MACH_OTA_URL,
95
96
  ota.url,
96
97
  ota.deploymentUrl,
97
98
  projectId && engine !== 'mach-react-native' ? `https://mach-api.securejs.in/api/ota/expo/${projectId}` : undefined
98
99
  )
99
- const runtimeVersion = nonEmpty(ota.runtimeVersion)
100
+ const runtimeVersion = first(process.env.MACH_OTA_RUNTIME_VERSION, ota.runtimeVersion)
100
101
  const runtimeVersionPolicy = nonEmpty(ota.runtimeVersionPolicy) || 'appVersion'
101
- const channel = nonEmpty(ota.channel) || 'production'
102
+ const channel = first(process.env.MACH_OTA_CHANNEL, ota.channel) || 'production'
102
103
  return { ...ota, enabled: Boolean(url), projectId, engine, url, runtimeVersion, runtimeVersionPolicy, channel }
103
104
  }
104
105
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@radhya/mach",
3
- "version": "2.0.41",
3
+ "version": "2.0.42",
4
4
  "description": "Mach CLI: Cloud Build Orchestrator for React Native & Expo",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -11,7 +11,8 @@
11
11
  "dist/",
12
12
  "expo-plugin/",
13
13
  "docs/frameworks/",
14
- "docs/deep-links.md"
14
+ "docs/deep-links.md",
15
+ "docs/ota.md"
15
16
  ],
16
17
  "scripts": {
17
18
  "build": "tsup src/index.ts src/commands/isolated-upload.ts --format esm --clean --minify --dts",