@radhya/mach 1.1.0 → 1.2.0
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 +177 -9
- package/dist/chunk-UILXWVHH.js +1 -0
- package/dist/chunk-YZYFEHP5.js +1 -0
- package/dist/commands/isolated-upload.js +1 -1
- package/dist/credentials-SVT5MSVT.js +1 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-4ZWPER6A.js +0 -1
- package/dist/chunk-FJHQRYN7.js +0 -1
- package/dist/credentials-2UGPELU7.js +0 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ npm install -g @radhya/mach
|
|
|
16
16
|
# Login to Mach Dashboard
|
|
17
17
|
mach login
|
|
18
18
|
|
|
19
|
-
# Initialize a project
|
|
19
|
+
# Initialize a new project
|
|
20
20
|
mach init
|
|
21
21
|
|
|
22
22
|
# Link an existing project
|
|
@@ -45,6 +45,13 @@ mach build --platform android
|
|
|
45
45
|
| `mach sitemap` | Generate sitemap.xml from Expo Router |
|
|
46
46
|
| `mach audit` | Run automated security audit on the project |
|
|
47
47
|
|
|
48
|
+
### Legacy Commands
|
|
49
|
+
|
|
50
|
+
| Command | Description |
|
|
51
|
+
|---------|-------------|
|
|
52
|
+
| `mach credentials:setup` | Automated credential provisioning |
|
|
53
|
+
| `mach credentials:service` | Upload service credentials (ASC API Key / Google Service JSON) |
|
|
54
|
+
|
|
48
55
|
## Cloud Builds
|
|
49
56
|
|
|
50
57
|
Build your apps on cloud infrastructure using AWS Spot Instances — fast, cost-effective, and fully automated.
|
|
@@ -66,12 +73,36 @@ mach build --platform android --dry-run
|
|
|
66
73
|
### Build Options
|
|
67
74
|
|
|
68
75
|
- `--platform <os>` — Target platform: `ios` or `android` (required)
|
|
69
|
-
- `--profile <name>` — Build profile
|
|
76
|
+
- `--profile <name>` — Build profile from `mach.config.json` (e.g., `production`, `staging`, `development`)
|
|
77
|
+
- `--auto-version` — **(Android)** Automatically resolve and increment versionCode via Google Play API
|
|
70
78
|
- `--local` — Run build on local machine
|
|
71
79
|
- `--dry-run` — Generate script without launching
|
|
72
80
|
- `--verbose` — Enable verbose logging
|
|
73
81
|
- `--simulator` — Build for iOS Simulator (no signing required)
|
|
74
82
|
|
|
83
|
+
## Automated Versioning (Android)
|
|
84
|
+
|
|
85
|
+
Mach can automatically resolve your next `versionCode` by querying the Google Play Store. This prevents "Duplicate Version Code" rejection errors.
|
|
86
|
+
|
|
87
|
+
### Setup
|
|
88
|
+
Ensure you have uploaded a **Google Service Account JSON** to the Mach Dashboard under Service Credentials.
|
|
89
|
+
|
|
90
|
+
### usage
|
|
91
|
+
Set the version code to `"auto"` in your config:
|
|
92
|
+
```json
|
|
93
|
+
"android": {
|
|
94
|
+
"versionCode": "auto"
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
Or pass the flag via CLI:
|
|
98
|
+
```bash
|
|
99
|
+
mach build --platform android --auto-version
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
> [!TIP]
|
|
103
|
+
> Mach queries all tracks (Internal, Alpha, Beta, Production), finds the highest existing version, and increments it by 1 for your new build.
|
|
104
|
+
|
|
105
|
+
|
|
75
106
|
## Store Submission
|
|
76
107
|
|
|
77
108
|
Automate your App Store and Google Play submissions directly from the CLI.
|
|
@@ -115,24 +146,113 @@ Create a `mach.config.json` in your project root:
|
|
|
115
146
|
"teamId": "XXXXXXXXXX"
|
|
116
147
|
},
|
|
117
148
|
"android": {
|
|
118
|
-
"package": "com.example.myapp"
|
|
149
|
+
"package": "com.example.myapp",
|
|
150
|
+
"versionCode": "auto"
|
|
119
151
|
}
|
|
120
152
|
}
|
|
121
153
|
```
|
|
122
154
|
|
|
123
155
|
### Build Profiles
|
|
124
156
|
|
|
125
|
-
Define multiple build profiles
|
|
157
|
+
Define multiple build profiles under the `build` key. Profiles support deep inheritance via `extends`.
|
|
126
158
|
|
|
127
159
|
```json
|
|
128
160
|
{
|
|
129
161
|
"projectId": "your-project-id",
|
|
130
|
-
"
|
|
162
|
+
"name": "MyApp",
|
|
163
|
+
"slug": "my-app",
|
|
164
|
+
"scheme": "myapp",
|
|
165
|
+
"android": { "package": "com.example.myapp" },
|
|
166
|
+
"ios": { "bundleIdentifier": "com.example.myapp" },
|
|
167
|
+
"build": {
|
|
168
|
+
"base": {},
|
|
131
169
|
"development": {
|
|
132
|
-
"
|
|
170
|
+
"extends": "base",
|
|
171
|
+
"developmentClient": true,
|
|
172
|
+
"environment": "development"
|
|
173
|
+
},
|
|
174
|
+
"staging": {
|
|
175
|
+
"extends": "base",
|
|
176
|
+
"distribution": "internal"
|
|
133
177
|
},
|
|
134
178
|
"production": {
|
|
135
|
-
"
|
|
179
|
+
"extends": "base",
|
|
180
|
+
"distribution": "store"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"submit": {
|
|
184
|
+
"production": {
|
|
185
|
+
"android": { "track": "internal" },
|
|
186
|
+
"ios": {
|
|
187
|
+
"ascAppId": "1234567890",
|
|
188
|
+
"appleTeamId": "XXXXXXXXXX"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Profile Properties
|
|
196
|
+
|
|
197
|
+
| Property | Description |
|
|
198
|
+
|----------|-------------|
|
|
199
|
+
| `extends` | Inherit settings from another profile (recursive) |
|
|
200
|
+
| `environment` | Map to a Dashboard Secret Environment (`development`, `staging`, `production`). Defaults to profile name. |
|
|
201
|
+
| `developmentClient` | `true` to build with `expo-dev-client` |
|
|
202
|
+
| `distribution` | `internal` (TestFlight/Play Console) or `store` (Production) |
|
|
203
|
+
| `preBuild` / `postBuild` | Reference a script or run a raw command |
|
|
204
|
+
| `envGroups` | Array of environment group names to merge into this profile |
|
|
205
|
+
|
|
206
|
+
### Platform Overrides
|
|
207
|
+
|
|
208
|
+
Any property can be overridden per platform using `ios` or `android` blocks:
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
{
|
|
212
|
+
"build": {
|
|
213
|
+
"development": {
|
|
214
|
+
"extends": "base",
|
|
215
|
+
"developmentClient": true,
|
|
216
|
+
"ios": {
|
|
217
|
+
"simulator": true,
|
|
218
|
+
"iosDeploymentTarget": "15.0"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Environment Groups
|
|
226
|
+
|
|
227
|
+
Define reusable sets of environment variables shared across profiles:
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"envGroups": {
|
|
232
|
+
"common": {
|
|
233
|
+
"API_URL": "https://api.example.com"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"build": {
|
|
237
|
+
"production": {
|
|
238
|
+
"envGroups": ["common"]
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Scripts
|
|
245
|
+
|
|
246
|
+
Define custom build hooks:
|
|
247
|
+
|
|
248
|
+
```json
|
|
249
|
+
{
|
|
250
|
+
"scripts": {
|
|
251
|
+
"clean": "rm -rf ios/build android/app/build"
|
|
252
|
+
},
|
|
253
|
+
"build": {
|
|
254
|
+
"production": {
|
|
255
|
+
"preBuild": "scripts.clean"
|
|
136
256
|
}
|
|
137
257
|
}
|
|
138
258
|
}
|
|
@@ -140,14 +260,32 @@ Define multiple build profiles for different environments:
|
|
|
140
260
|
|
|
141
261
|
## Environment Variables
|
|
142
262
|
|
|
263
|
+
Mach allows you to securely inject secrets directly into your cloud builds without exposing them in your codebase. All secrets are fully encrypted using AES-256-GCM.
|
|
264
|
+
|
|
143
265
|
```bash
|
|
144
|
-
# Set environment variables
|
|
266
|
+
# Set environment variables for the project (Defaults to Secret mode)
|
|
145
267
|
mach env set API_URL=https://api.example.com SECRET_KEY=xxx
|
|
146
268
|
|
|
147
269
|
# List all variables
|
|
148
270
|
mach env list
|
|
149
271
|
```
|
|
150
272
|
|
|
273
|
+
### Android Keystore Passwords
|
|
274
|
+
For maximum security, your Android Keystore (`.jks`) file is stored in a separate encrypted S3 bucket away from its passwords.
|
|
275
|
+
|
|
276
|
+
To provide your passwords to the Cloud Builder, you **must** define them as Mach Environment variables (Secrets). Mach will automatically securely decrypt and inject them during the Gradle build process.
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Set the master password for the keystore (used for both the Keystore and the Key Alias)
|
|
280
|
+
mach env set KEYSTORE_PASSWORD_PRODUCTION=my_super_secret_password
|
|
281
|
+
|
|
282
|
+
# If your Keystore password and Key Alias password differ, you can set both independently:
|
|
283
|
+
mach env set KEYSTORE_PASSWORD_PRODUCTION=my_key_pass KEYSTORE_STORE_PASSWORD_PRODUCTION=my_store_pass
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
*(Note: Replace `PRODUCTION` with `STAGING` or `DEVELOPMENT` depending on your targeted build profile).*
|
|
287
|
+
|
|
288
|
+
|
|
151
289
|
## Development Server
|
|
152
290
|
|
|
153
291
|
```bash
|
|
@@ -172,6 +310,36 @@ mach audit --fix
|
|
|
172
310
|
mach audit --json # CI/CD friendly output
|
|
173
311
|
```
|
|
174
312
|
|
|
313
|
+
## Authentication
|
|
314
|
+
|
|
315
|
+
### Interactive Login
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
mach login
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
Credentials are stored in `~/.mach/credentials.json`.
|
|
322
|
+
|
|
323
|
+
### CI/CD (Token-based)
|
|
324
|
+
|
|
325
|
+
Set the `MACH_TOKEN` environment variable for non-interactive authentication:
|
|
326
|
+
|
|
327
|
+
```bash
|
|
328
|
+
export MACH_TOKEN=your-personal-access-token
|
|
329
|
+
mach build --platform ios --profile production
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Generate tokens from the Mach Dashboard under Settings > Personal Access Tokens.
|
|
333
|
+
|
|
334
|
+
## Environment Variables Reference
|
|
335
|
+
|
|
336
|
+
| Variable | Description |
|
|
337
|
+
|----------|-------------|
|
|
338
|
+
| `MACH_TOKEN` | Personal access token for CI/CD (skips login) |
|
|
339
|
+
| `MACH_API_URL` | Override the API endpoint (default: `https://mach-api.securejs.in`) |
|
|
340
|
+
| `MACH_DEBUG` | Enable debug logging |
|
|
341
|
+
| `MACH_P12_PASSWORD` | iOS certificate password (avoids interactive prompt) |
|
|
342
|
+
|
|
175
343
|
## Requirements
|
|
176
344
|
|
|
177
345
|
- Node.js 18+
|
|
@@ -185,4 +353,4 @@ ISC
|
|
|
185
353
|
|
|
186
354
|
---
|
|
187
355
|
|
|
188
|
-
Built by [Radhya Softlabs](https://
|
|
356
|
+
Built by [Radhya Softlabs](https://radhyasoftlabs.com)
|