@radhya/mach 2.6.5 → 2.6.7
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 +5 -3
- package/dist/index.js +162 -159
- package/docs/deep-links.md +37 -2
- package/expo-plugin/index.js +15 -12
- package/package.json +1 -1
package/docs/deep-links.md
CHANGED
|
@@ -32,12 +32,20 @@ Precedence is:
|
|
|
32
32
|
command flags > existing deepLinks config > profile-specific config > root mach.config.json > Expo config inference > prompts/defaults
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
For
|
|
35
|
+
For a linked project using Mach Web Hosting, this is enough:
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
mach deeplink setup
|
|
38
|
+
mach deeplink setup
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
Setup presents only stable deep-link hosts: the Mach Production address
|
|
42
|
+
(`project.getmach.dev`), then any active Production customer domain, followed
|
|
43
|
+
by a manual URL option. It does not offer Staging or immutable preview URLs.
|
|
44
|
+
Use `--base-url` when the app is hosted elsewhere or when you need an explicit
|
|
45
|
+
override. The chosen hostname is compiled into the native app; select a new
|
|
46
|
+
host later only when you are ready to run setup again and ship a new native
|
|
47
|
+
build.
|
|
48
|
+
|
|
41
49
|
Use `--profile` when the team/app metadata lives under a non-production submit profile:
|
|
42
50
|
|
|
43
51
|
```bash
|
|
@@ -74,6 +82,12 @@ mach deeplink setup \
|
|
|
74
82
|
|
|
75
83
|
When `--output` is not provided, Mach uses `public` if that folder exists; otherwise it writes to `deep-links` and prints a hosting note.
|
|
76
84
|
|
|
85
|
+
When you deploy with `mach web deploy`, Mach adds these association files to the
|
|
86
|
+
finished web output automatically. This works even when the web exporter writes
|
|
87
|
+
to `dist` or `build/web` while deep-link setup wrote files under `public` or
|
|
88
|
+
`deep-links`. The generated files replace stale association files in the upload,
|
|
89
|
+
so the hosted release matches `mach.config.json`.
|
|
90
|
+
|
|
77
91
|
`mach.config.json` is the only Mach deep-link source of truth. Values already available from the selected profile or root config are not duplicated inside `deepLinks`. A typical generated block is intentionally small:
|
|
78
92
|
|
|
79
93
|
```json
|
|
@@ -165,6 +179,27 @@ export default {
|
|
|
165
179
|
}
|
|
166
180
|
```
|
|
167
181
|
|
|
182
|
+
### Multi-app Expo workspaces
|
|
183
|
+
|
|
184
|
+
When several separately shipped apps share one Expo `app.config.ts`, keep a **single workspace wrapper** and let it select the Mach config for the active build. Do not add one fixed plugin entry per product: every config plugin runs for every build, so a fixed Pocket entry could otherwise add Pocket links to another app.
|
|
185
|
+
|
|
186
|
+
`mach deeplink setup` still writes each product’s association files and configuration when run from that product directory. It intentionally does not inject a fixed plugin into the shared Expo root. The wrapper chooses the config using the same environment variable that chooses the product:
|
|
187
|
+
|
|
188
|
+
```js
|
|
189
|
+
const withMach = require('@radhya/mach/expo-plugin')
|
|
190
|
+
|
|
191
|
+
module.exports = (config) => {
|
|
192
|
+
const appKey = process.env.EXPO_PUBLIC_APP_KEY || 'main'
|
|
193
|
+
return withMach(config, {
|
|
194
|
+
machConfigPath: appKey === 'main'
|
|
195
|
+
? 'mach.config.json'
|
|
196
|
+
: `apps/${appKey}/mach.config.json`,
|
|
197
|
+
})
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Put that wrapper once in the root `plugins` array. Each product’s build profile must set its own selector environment value. Mach resolves the parent Expo root and that profile environment during `mach deeplink verify`, so verification checks the same app configuration that the focused build uses.
|
|
202
|
+
|
|
168
203
|
## Flutter Projects
|
|
169
204
|
|
|
170
205
|
For Flutter applications, setup makes conservative, idempotent native changes:
|
package/expo-plugin/index.js
CHANGED
|
@@ -40,11 +40,14 @@ const domainFromBaseUrl = value => {
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const readMachConfig = config => {
|
|
43
|
+
const readMachConfig = (config, options = {}) => {
|
|
44
44
|
const projectRoot = config && config._internal && config._internal.projectRoot
|
|
45
45
|
? config._internal.projectRoot
|
|
46
46
|
: process.cwd()
|
|
47
|
-
const
|
|
47
|
+
const configuredPath = nonEmpty(options && options.machConfigPath)
|
|
48
|
+
const configPath = configuredPath
|
|
49
|
+
? path.resolve(projectRoot, configuredPath)
|
|
50
|
+
: path.join(projectRoot, 'mach.config.json')
|
|
48
51
|
if (!fs.existsSync(configPath)) return {}
|
|
49
52
|
return JSON.parse(fs.readFileSync(configPath, 'utf-8'))
|
|
50
53
|
}
|
|
@@ -98,8 +101,8 @@ const hasDomainFilter = (filter, domain) => {
|
|
|
98
101
|
return data.some(item => item && item.scheme === 'https' && item.host === domain)
|
|
99
102
|
}
|
|
100
103
|
|
|
101
|
-
const resolveDeepLinks = config => {
|
|
102
|
-
const machConfig = readMachConfig(config)
|
|
104
|
+
const resolveDeepLinks = (config, options) => {
|
|
105
|
+
const machConfig = readMachConfig(config, options)
|
|
103
106
|
const deepLinks = machConfig.deepLinks || {}
|
|
104
107
|
const profileName = deepLinks.profile || process.env.MACH_PROFILE || process.env.EAS_BUILD_PROFILE || 'production'
|
|
105
108
|
const profile = resolveBuildProfile(machConfig, profileName)
|
|
@@ -120,8 +123,8 @@ const resolveDeepLinks = config => {
|
|
|
120
123
|
return { ...deepLinks, baseUrl, domain, scheme }
|
|
121
124
|
}
|
|
122
125
|
|
|
123
|
-
const resolveOta = config => {
|
|
124
|
-
const machConfig = readMachConfig(config)
|
|
126
|
+
const resolveOta = (config, options) => {
|
|
127
|
+
const machConfig = readMachConfig(config, options)
|
|
125
128
|
const ota = machConfig.ota || machConfig.update || {}
|
|
126
129
|
if (ota.enabled === false) return { enabled: false }
|
|
127
130
|
const projectId = nonEmpty(machConfig.projectId)
|
|
@@ -138,8 +141,8 @@ const resolveOta = config => {
|
|
|
138
141
|
return { ...ota, enabled: Boolean(url), projectId, engine, url, runtimeVersion, runtimeVersionPolicy, channel }
|
|
139
142
|
}
|
|
140
143
|
|
|
141
|
-
const resolvePush = config => {
|
|
142
|
-
const machConfig = readMachConfig(config)
|
|
144
|
+
const resolvePush = (config, options) => {
|
|
145
|
+
const machConfig = readMachConfig(config, options)
|
|
143
146
|
const push = machConfig.push || {}
|
|
144
147
|
const projectRoot = projectRootForConfig(config)
|
|
145
148
|
return {
|
|
@@ -154,10 +157,10 @@ const resolvePush = config => {
|
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
159
|
|
|
157
|
-
module.exports = function withMachDeepLinks(config) {
|
|
158
|
-
const deepLinks = resolveDeepLinks(config)
|
|
159
|
-
const ota = resolveOta(config)
|
|
160
|
-
const push = resolvePush(config)
|
|
160
|
+
module.exports = function withMachDeepLinks(config, options) {
|
|
161
|
+
const deepLinks = resolveDeepLinks(config, options)
|
|
162
|
+
const ota = resolveOta(config, options)
|
|
163
|
+
const push = resolvePush(config, options)
|
|
161
164
|
|
|
162
165
|
config.extra = { ...(config.extra || {}) }
|
|
163
166
|
|