@radhya/mach 2.0.41 → 2.0.43
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 +9 -3
- package/dist/index.js +173 -157
- package/docs/ota.md +71 -0
- package/expo-plugin/index.js +5 -4
- package/package.json +4 -2
package/docs/ota.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
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. It also refreshes an older project-local `@radhya/mach` package so Expo prebuild uses a plugin compatible with the running CLI. 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. Runtime precedence is command `--runtime-version`, `ota.runtimeVersion`, `ota.runtimeVersionPolicy`, Expo config, then package version fallback. When Mach has a policy, old hardcoded Expo runtime values do not override it.
|
|
58
|
+
|
|
59
|
+
`mach ota verify`, `mach ota publish`, and OTA-enabled Expo builds validate the final resolved Expo URL, channel, and runtime. They stop with a repair instruction if the project-local plugin would embed different values.
|
|
60
|
+
|
|
61
|
+
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.
|
|
62
|
+
|
|
63
|
+
## Operations
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
mach ota list
|
|
67
|
+
mach ota rollback --update-id <updateId>
|
|
68
|
+
mach ota promote --update-id <updateId>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
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.
|
package/expo-plugin/index.js
CHANGED
|
@@ -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) ||
|
|
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 =
|
|
100
|
+
const runtimeVersion = first(process.env.MACH_OTA_RUNTIME_VERSION, ota.runtimeVersion)
|
|
100
101
|
const runtimeVersionPolicy = nonEmpty(ota.runtimeVersionPolicy) || 'appVersion'
|
|
101
|
-
const channel =
|
|
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
|
|
|
@@ -122,7 +123,7 @@ module.exports = function withMachDeepLinks(config) {
|
|
|
122
123
|
}
|
|
123
124
|
if (ota.runtimeVersion) {
|
|
124
125
|
config.runtimeVersion = ota.runtimeVersion
|
|
125
|
-
} else if (
|
|
126
|
+
} else if (ota.runtimeVersionPolicy) {
|
|
126
127
|
config.runtimeVersion = { policy: ota.runtimeVersionPolicy }
|
|
127
128
|
}
|
|
128
129
|
config.extra.mach = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radhya/mach",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.43",
|
|
4
4
|
"description": "Mach CLI: Cloud Build Orchestrator for React Native & Expo",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -11,10 +11,12 @@
|
|
|
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",
|
|
19
|
+
"test": "tsx --test src/**/*.test.ts && node --test tests/*.test.cjs",
|
|
18
20
|
"start": "node dist/index.js",
|
|
19
21
|
"dev": "tsx src/index.ts",
|
|
20
22
|
"release": "semantic-release"
|