@radhya/mach 2.0.10 → 2.0.12
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/dist/index.js +149 -128
- package/docs/frameworks/README.md +72 -0
- package/docs/frameworks/expo.md +148 -0
- package/docs/frameworks/flutter.md +67 -0
- package/docs/frameworks/react-native.md +159 -0
- package/package.json +3 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Framework Guides
|
|
2
|
+
|
|
3
|
+
Mach uses `mach.config.json` as the source of truth for framework behavior. Builds do not infer framework from `package.json`, because package scanning is fragile in real projects and can make Expo, bare React Native, and future Flutter support affect each other accidentally.
|
|
4
|
+
|
|
5
|
+
## Choose Your Framework
|
|
6
|
+
|
|
7
|
+
| If your project is... | Set `framework` to | Use this guide |
|
|
8
|
+
| --- | --- | --- |
|
|
9
|
+
| A vanilla React Native app with committed `ios/` and `android/` folders | `"react-native"` | [Bare React Native](react-native.md) |
|
|
10
|
+
| An Expo app that should run `expo prebuild` during cloud builds | `"expo"` | [Expo](expo.md) |
|
|
11
|
+
| A Flutter app | `"flutter"` | [Flutter](flutter.md) |
|
|
12
|
+
|
|
13
|
+
`mach init` and `mach link` create:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"framework": "react-native"
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Change this to `"expo"` before building an Expo project. Flutter is accepted in config for forward compatibility, but Flutter builds intentionally fail until the Flutter builder is implemented.
|
|
22
|
+
|
|
23
|
+
## Why This Is Explicit
|
|
24
|
+
|
|
25
|
+
The same repository can contain Expo packages, React Native native folders, custom build scripts, or migration leftovers. Automatic framework detection can pick the wrong pipeline and break a live build. Explicit config gives each project a stable contract:
|
|
26
|
+
|
|
27
|
+
- React Native builds never run Expo prebuild.
|
|
28
|
+
- Expo builds keep the existing Expo prebuild and dev-client behavior.
|
|
29
|
+
- Flutter can be added later without changing `mach build` commands.
|
|
30
|
+
- Documentation, CI, and support conversations can point to one clear setting.
|
|
31
|
+
|
|
32
|
+
## Required Config
|
|
33
|
+
|
|
34
|
+
Every buildable project should have this root field:
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"projectId": "your-mach-project-id",
|
|
39
|
+
"framework": "react-native",
|
|
40
|
+
"name": "MyApp",
|
|
41
|
+
"slug": "my-app"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Allowed values:
|
|
46
|
+
|
|
47
|
+
- `react-native`
|
|
48
|
+
- `expo`
|
|
49
|
+
- `flutter`
|
|
50
|
+
|
|
51
|
+
Aliases such as `reactnative` and `react_native` are normalized to `react-native`, but new projects should use the canonical `react-native` value.
|
|
52
|
+
|
|
53
|
+
## Common Commands
|
|
54
|
+
|
|
55
|
+
The commands do not change between frameworks:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
mach build --platform ios --profile staging
|
|
59
|
+
mach build --platform android --profile staging
|
|
60
|
+
mach build --platform ios --profile production --auto-submit
|
|
61
|
+
mach build --platform android --profile production --auto-submit
|
|
62
|
+
mach submit --latest --platform ios --profile production
|
|
63
|
+
mach submit --latest --platform android --profile production
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Framework selection only changes what happens inside the build runner.
|
|
67
|
+
|
|
68
|
+
## Failure Messages
|
|
69
|
+
|
|
70
|
+
If `framework` is missing, Mach stops before queuing the build and asks you to add one of the allowed values. If `framework` is invalid, Mach stops before upload and prints the accepted values. If `framework` is `flutter`, Mach currently stops with a clear "Flutter builds are not implemented yet" message.
|
|
71
|
+
|
|
72
|
+
This is intentional. A build should fail early and clearly instead of silently running the wrong native pipeline.
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Expo Builds
|
|
2
|
+
|
|
3
|
+
Use this guide when your app is an Expo project and Mach should run Expo prebuild before native compilation.
|
|
4
|
+
|
|
5
|
+
## Required Config
|
|
6
|
+
|
|
7
|
+
`mach.config.json` must declare Expo explicitly:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"framework": "expo",
|
|
12
|
+
"ios": {
|
|
13
|
+
"bundleIdentifier": "com.example.app",
|
|
14
|
+
"buildNumber": "auto"
|
|
15
|
+
},
|
|
16
|
+
"android": {
|
|
17
|
+
"package": "com.example.app",
|
|
18
|
+
"versionCode": "auto"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Mach does not infer Expo from `package.json`. This avoids accidental behavior changes when dependencies move or when a project contains Expo packages for a non-Expo reason.
|
|
24
|
+
|
|
25
|
+
## When To Use This
|
|
26
|
+
|
|
27
|
+
Use `framework: "expo"` when:
|
|
28
|
+
|
|
29
|
+
- The app is configured through `app.json`, `app.config.js`, or `app.config.ts`.
|
|
30
|
+
- Native folders may be generated or refreshed by Expo prebuild.
|
|
31
|
+
- You use Expo config plugins.
|
|
32
|
+
- You use Expo development client builds.
|
|
33
|
+
- You expect Expo-managed Android/iOS native config to be applied before native compilation.
|
|
34
|
+
|
|
35
|
+
Do not use this value for a bare React Native project whose `ios/` and `android/` folders are manually maintained and should not be regenerated.
|
|
36
|
+
|
|
37
|
+
## Pipeline Behavior
|
|
38
|
+
|
|
39
|
+
For Expo, Mach:
|
|
40
|
+
|
|
41
|
+
- Installs JavaScript dependencies.
|
|
42
|
+
- Runs `expo prebuild --platform ios --no-install` for iOS builds.
|
|
43
|
+
- Runs `expo prebuild --platform android --no-install` for Android builds.
|
|
44
|
+
- Sets Expo dotenv protection for builds.
|
|
45
|
+
- Applies Expo dev-client exclusion for non-development builds.
|
|
46
|
+
- Applies Expo-specific Android Gradle properties only for Expo builds.
|
|
47
|
+
- Applies Mach signing, versioning, artifact upload, and optional store submission after prebuild.
|
|
48
|
+
|
|
49
|
+
Mach does not:
|
|
50
|
+
|
|
51
|
+
- Auto-enable Expo just because `expo` exists in `package.json`.
|
|
52
|
+
- Run Expo prebuild for projects configured as `react-native`.
|
|
53
|
+
- Treat Flutter projects as Expo projects.
|
|
54
|
+
|
|
55
|
+
## Development Client
|
|
56
|
+
|
|
57
|
+
For Expo development client builds:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"build": {
|
|
62
|
+
"development": {
|
|
63
|
+
"developmentClient": true,
|
|
64
|
+
"distribution": "development",
|
|
65
|
+
"environment": "development"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Then run:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
mach build --platform ios --profile development
|
|
75
|
+
mach build --platform android --profile development
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
For staging or production, leave `developmentClient` off unless you intentionally want a dev client artifact.
|
|
79
|
+
|
|
80
|
+
## Project Layout
|
|
81
|
+
|
|
82
|
+
Typical layout:
|
|
83
|
+
|
|
84
|
+
```text
|
|
85
|
+
my-app/
|
|
86
|
+
mach.config.json
|
|
87
|
+
package.json
|
|
88
|
+
app.json or app.config.*
|
|
89
|
+
ios/ optional before build
|
|
90
|
+
android/ optional before build
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Mach can run Expo prebuild when native folders are absent or need to be regenerated. If you commit native folders and do not want them regenerated, use `framework: "react-native"` instead.
|
|
94
|
+
|
|
95
|
+
## App Versioning
|
|
96
|
+
|
|
97
|
+
For Android store builds, set:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"android": {
|
|
102
|
+
"versionCode": "auto"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
For iOS store builds, set:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"ios": {
|
|
112
|
+
"buildNumber": "auto"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
This updates native build numbers only. Apple also requires the marketing version to increase when a released version train is closed. In Expo projects, that is usually `expo.version` in `app.json` or `app.config.*`.
|
|
118
|
+
|
|
119
|
+
## Common Commands
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
mach build --platform ios --profile staging
|
|
123
|
+
mach build --platform android --profile staging
|
|
124
|
+
mach build --platform ios --profile production --auto-version --auto-submit
|
|
125
|
+
mach build --platform android --profile production --auto-version --auto-submit
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## When Not To Use Expo Framework
|
|
129
|
+
|
|
130
|
+
Do not set `framework: "expo"` if the native `ios/` and `android/` projects are maintained manually and should not be regenerated. Use `framework: "react-native"` instead.
|
|
131
|
+
|
|
132
|
+
## Migration To Bare React Native
|
|
133
|
+
|
|
134
|
+
If an Expo project has been fully ejected or moved to manually maintained native projects:
|
|
135
|
+
|
|
136
|
+
1. Commit `ios/` and `android/`.
|
|
137
|
+
2. Change `framework` from `"expo"` to `"react-native"`.
|
|
138
|
+
3. Remove Expo prebuild assumptions from Mach prebuild hooks.
|
|
139
|
+
4. Run a staging build for iOS and Android before production.
|
|
140
|
+
|
|
141
|
+
## Troubleshooting
|
|
142
|
+
|
|
143
|
+
| Symptom | Check |
|
|
144
|
+
| --- | --- |
|
|
145
|
+
| Mach says `framework` is missing | Add `"framework": "expo"` at the root of `mach.config.json`. |
|
|
146
|
+
| Native folders are being regenerated unexpectedly | You are using the Expo pipeline. Switch to `react-native` only if the native folders are now manually owned. |
|
|
147
|
+
| Expo dev-client is included in production | Ensure `developmentClient` is not enabled in the production profile. |
|
|
148
|
+
| App Store submission fails because the version train is closed | Increase the marketing version (`expo.version` or equivalent config), rebuild, then submit again. |
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Flutter Builds
|
|
2
|
+
|
|
3
|
+
Flutter is reserved in Mach configuration so the CLI can support it without changing user-facing commands later.
|
|
4
|
+
|
|
5
|
+
## Current Status
|
|
6
|
+
|
|
7
|
+
`framework: "flutter"` is recognized as a valid config value, but Flutter cloud builders are not implemented yet. If you run a build with Flutter selected, Mach fails with a clear message instead of trying to run the React Native or Expo pipeline.
|
|
8
|
+
|
|
9
|
+
## Planned Config Shape
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"framework": "flutter",
|
|
14
|
+
"ios": {
|
|
15
|
+
"bundleIdentifier": "com.example.app",
|
|
16
|
+
"buildNumber": "auto"
|
|
17
|
+
},
|
|
18
|
+
"android": {
|
|
19
|
+
"package": "com.example.app",
|
|
20
|
+
"versionCode": "auto"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Planned Behavior
|
|
26
|
+
|
|
27
|
+
The Flutter builder should be separate from the React Native and Expo builders:
|
|
28
|
+
|
|
29
|
+
- Android should run Flutter/Gradle commands from the Flutter project.
|
|
30
|
+
- iOS should run Flutter build/archive commands and then the same managed signing/upload flow.
|
|
31
|
+
- Expo prebuild and React Native Metro cache handling should not run for Flutter.
|
|
32
|
+
- Store submission should keep using the same `mach submit` command surface.
|
|
33
|
+
|
|
34
|
+
Until that builder exists, use `react-native` or `expo`.
|
|
35
|
+
|
|
36
|
+
## Why It Is Already In Config
|
|
37
|
+
|
|
38
|
+
Mach accepts `flutter` now so projects, Dashboard records, and docs can move toward a framework-neutral model before Flutter execution is enabled. This avoids another command change later. The command remains:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
mach build --platform ios --profile production
|
|
42
|
+
mach build --platform android --profile production
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Only the internal build runner changes once Flutter is implemented.
|
|
46
|
+
|
|
47
|
+
## Current Failure Mode
|
|
48
|
+
|
|
49
|
+
If you run a build today with:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"framework": "flutter"
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Mach stops before starting the React Native or Expo build pipeline and prints that Flutter builds are not implemented yet. This is safer than trying to run Gradle or Xcode with React Native assumptions.
|
|
58
|
+
|
|
59
|
+
## Implementation Checklist
|
|
60
|
+
|
|
61
|
+
When Flutter support is added, keep it isolated:
|
|
62
|
+
|
|
63
|
+
- Add Flutter-specific Android and iOS build runners.
|
|
64
|
+
- Keep Expo prebuild logic out of Flutter.
|
|
65
|
+
- Keep React Native Metro and bundling assumptions out of Flutter.
|
|
66
|
+
- Reuse Mach credentials, signing, artifact upload, build pages, and submission flows.
|
|
67
|
+
- Keep `mach build`, `mach submit`, and Dashboard UX unchanged.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Bare React Native Builds
|
|
2
|
+
|
|
3
|
+
Use this guide when your project is a vanilla React Native app with committed `ios/` and `android/` directories.
|
|
4
|
+
|
|
5
|
+
## Required Config
|
|
6
|
+
|
|
7
|
+
`mach.config.json` must declare the framework explicitly:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"framework": "react-native",
|
|
12
|
+
"ios": {
|
|
13
|
+
"bundleIdentifier": "com.example.app",
|
|
14
|
+
"buildNumber": "auto"
|
|
15
|
+
},
|
|
16
|
+
"android": {
|
|
17
|
+
"package": "com.example.app",
|
|
18
|
+
"versionCode": "auto"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Mach does not inspect `package.json` to decide whether a project is Expo or React Native. Keep this field accurate before running CI builds.
|
|
24
|
+
|
|
25
|
+
## When To Use This
|
|
26
|
+
|
|
27
|
+
Use `framework: "react-native"` when:
|
|
28
|
+
|
|
29
|
+
- Your native projects are owned by the repository.
|
|
30
|
+
- The app builds from `ios/` and `android/` directly.
|
|
31
|
+
- You do not want Mach to regenerate native projects.
|
|
32
|
+
- You may still use React Native libraries, CocoaPods, Gradle plugins, Firebase, Sentry, or other native integrations manually.
|
|
33
|
+
|
|
34
|
+
Do not use this value for an Expo project that depends on prebuild to generate native files. Use `framework: "expo"` for that.
|
|
35
|
+
|
|
36
|
+
## Pipeline Behavior
|
|
37
|
+
|
|
38
|
+
For bare React Native, Mach:
|
|
39
|
+
|
|
40
|
+
- Installs JavaScript dependencies.
|
|
41
|
+
- Uses committed native projects.
|
|
42
|
+
- Runs `pod install` for iOS when needed.
|
|
43
|
+
- Runs Xcode archive/export for iOS.
|
|
44
|
+
- Runs Gradle for Android.
|
|
45
|
+
- Applies Mach signing, versioning, artifact upload, and optional store submission.
|
|
46
|
+
|
|
47
|
+
Mach does not:
|
|
48
|
+
|
|
49
|
+
- Run `expo prebuild`.
|
|
50
|
+
- Inject Expo-only Gradle properties.
|
|
51
|
+
- Set Expo dev-client exclusion variables.
|
|
52
|
+
- Decide framework from Expo packages in `package.json`.
|
|
53
|
+
|
|
54
|
+
## Common Commands
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
mach build --platform ios --profile staging
|
|
58
|
+
mach build --platform android --profile staging
|
|
59
|
+
mach build --platform ios --profile production --auto-submit
|
|
60
|
+
mach build --platform android --profile production --auto-submit
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Project Layout
|
|
64
|
+
|
|
65
|
+
Expected layout:
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
my-app/
|
|
69
|
+
mach.config.json
|
|
70
|
+
package.json
|
|
71
|
+
ios/
|
|
72
|
+
android/
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Android should include `android/gradlew`. iOS should include a usable workspace or project. If multiple iOS schemes exist, set the scheme explicitly.
|
|
76
|
+
|
|
77
|
+
## iOS Notes
|
|
78
|
+
|
|
79
|
+
Mach uses the existing native iOS project. If multiple schemes exist, set the scheme in config:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"ios": {
|
|
84
|
+
"bundleIdentifier": "com.example.app",
|
|
85
|
+
"iosScheme": "MyApp",
|
|
86
|
+
"buildNumber": "auto"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
For store builds, upload iOS signing credentials and App Store Connect credentials from the Dashboard or CLI.
|
|
92
|
+
|
|
93
|
+
## Android Notes
|
|
94
|
+
|
|
95
|
+
Mach runs Gradle from `android/gradlew` when present. Production builds default to `bundleRelease`; internal builds default to `assembleRelease`; development-client style builds default to `assembleDebug`.
|
|
96
|
+
|
|
97
|
+
Set package and version code at the root:
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"android": {
|
|
102
|
+
"package": "com.example.app",
|
|
103
|
+
"versionCode": "auto"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
For Google Play submission and Play-backed versionCode lookup, upload a Google Play service account credential for the exact package id.
|
|
109
|
+
|
|
110
|
+
## Development Builds
|
|
111
|
+
|
|
112
|
+
Bare React Native does not use Expo development-client behavior. If a profile contains `developmentClient`, Mach ignores Expo-only dev-client environment handling unless `framework` is `expo`.
|
|
113
|
+
|
|
114
|
+
For iOS development signing, use:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"build": {
|
|
119
|
+
"development": {
|
|
120
|
+
"distribution": "development",
|
|
121
|
+
"environment": "development"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
For Android debug-style builds, set a custom Gradle command if needed:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"build": {
|
|
132
|
+
"development": {
|
|
133
|
+
"android": {
|
|
134
|
+
"buildCommand": "assembleDebug"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Migration From Expo
|
|
142
|
+
|
|
143
|
+
If a project previously used Expo and now uses bare React Native:
|
|
144
|
+
|
|
145
|
+
1. Change `framework` from `"expo"` to `"react-native"`.
|
|
146
|
+
2. Commit the generated native projects.
|
|
147
|
+
3. Remove Expo-only build assumptions from custom prebuild scripts.
|
|
148
|
+
4. Run one staging build before production.
|
|
149
|
+
|
|
150
|
+
Mach will stop running Expo prebuild as soon as the framework is set to `react-native`.
|
|
151
|
+
|
|
152
|
+
## Troubleshooting
|
|
153
|
+
|
|
154
|
+
| Symptom | Check |
|
|
155
|
+
| --- | --- |
|
|
156
|
+
| Build fails with missing `ios/` or `android/` | Commit the native project folders or switch to `framework: "expo"` if Expo should generate them. |
|
|
157
|
+
| Expo prebuild is not running | This is expected for `react-native`. Change `framework` to `expo` only if the project is an Expo app. |
|
|
158
|
+
| Android version code does not update in `app.json` | Bare React Native versioning is native-project driven. Keep native Gradle versioning wired to Mach's generated values. |
|
|
159
|
+
| Dev-client behavior changed after migration | `developmentClient` is Expo-only. Use native debug/release config for bare React Native. |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radhya/mach",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.12",
|
|
4
4
|
"description": "Mach CLI: Cloud Build Orchestrator for React Native & Expo",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
"mach": "./dist/index.js"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"dist/"
|
|
11
|
+
"dist/",
|
|
12
|
+
"docs/frameworks/"
|
|
12
13
|
],
|
|
13
14
|
"scripts": {
|
|
14
15
|
"build": "tsup src/index.ts src/commands/isolated-upload.ts --format esm --clean --minify --dts",
|