expo-build-properties 0.6.0 → 0.8.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/CHANGELOG.md CHANGED
@@ -10,7 +10,23 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 0.6.0 — 2023-04-14
13
+ ## 0.8.0 — 2023-06-21
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Replaced `unstable_networkInspector` as `networkInspector` and enabled the feature by default. ([#22994](https://github.com/expo/expo/pull/22994) by [@kudo](https://github.com/kudo))
18
+
19
+ ### 🎉 New features
20
+
21
+ - Added `android.extraMavenRepos` and `ios.extraPods` support. ([#22785](https://github.com/expo/expo/pull/22785) by [@kudo](https://github.com/kudo))
22
+
23
+ ## 0.7.0 — 2023-05-08
24
+
25
+ ### 🐛 Bug fixes
26
+
27
+ - Fixed false alarm error throwing when `ios.flipper=false` and `useFrameworks`. ([#22296](https://github.com/expo/expo/pull/22296) by [@kudo](https://github.com/kudo))
28
+
29
+ ## 0.6.0 - 2023-04-14
14
30
 
15
31
  ### 🎉 New features
16
32
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # expo-build-properties
2
2
 
3
- **`expo-build-properties`** is a config plugin for managed apps to override the default native build properties.
3
+ **`expo-build-properties`** is a [config plugin](https://docs.expo.dev/config-plugins/introduction/) to customize native build properties when using [`npx expo prebuild`](https://docs.expo.dev/workflow/prebuild/).
4
4
 
5
5
  ## API documentation
6
6
 
@@ -9,10 +9,8 @@
9
9
 
10
10
  ### Installation
11
11
 
12
- **Note:** To use this config plugin, your apps must be a managed app and build by either [EAS Build](/build/introduction.md) or `expo run:[android|ios]`.
13
-
14
12
  ```
15
- expo install expo-build-properties
13
+ npx expo install expo-build-properties
16
14
  ```
17
15
 
18
16
  Add plugin to `app.json`. For example:
@@ -48,4 +46,4 @@ Contributions are very welcome! Please refer to guidelines described in the [con
48
46
  [docs-main]: https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/build-properties.mdx
49
47
  [docs-stable]: https://docs.expo.dev/versions/latest/sdk/build-properties/
50
48
  [contributing]: https://github.com/expo/expo#contributing
51
- [config-plugins]: https://docs.expo.dev/guides/config-plugins/
49
+ [config-plugins]: https://docs.expo.dev/home/config-plugins/introduction
package/build/android.js CHANGED
@@ -60,7 +60,7 @@ exports.withAndroidBuildProperties = createBuildGradlePropsConfigPlugin([
60
60
  },
61
61
  {
62
62
  propName: 'EX_DEV_CLIENT_NETWORK_INSPECTOR',
63
- propValueGetter: (config) => config.android?.unstable_networkInspector?.toString(),
63
+ propValueGetter: (config) => (config.android?.networkInspector ?? true).toString(),
64
64
  },
65
65
  ], 'withAndroidBuildProperties');
66
66
  const withAndroidFlipper = (config, props) => {
package/build/ios.js CHANGED
@@ -23,7 +23,7 @@ exports.withIosBuildProperties = createBuildPodfilePropsConfigPlugin([
23
23
  },
24
24
  {
25
25
  propName: 'EX_DEV_CLIENT_NETWORK_INSPECTOR',
26
- propValueGetter: (config) => config.ios?.unstable_networkInspector?.toString(),
26
+ propValueGetter: (config) => (config.ios?.networkInspector ?? true).toString(),
27
27
  },
28
28
  ], 'withIosBuildProperties');
29
29
  const withIosDeploymentTarget = (config, props) => {
@@ -60,17 +60,37 @@ export interface PluginConfigTypeAndroid {
60
60
  */
61
61
  packagingOptions?: PluginConfigTypeAndroidPackagingOptions;
62
62
  /**
63
- * Change the [Flipper](https://fbflipper.com/) version when running your app on Android.
64
- * Flipper is by default enabled with the version that comes bundled with react-native.
65
- * However, you can set the `flipper` property to a semver string and specify an
66
- * alternate Flipper version.
63
+ * By default, Flipper is enabled with the version that comes bundled with `react-native`.
64
+ *
65
+ * Use this to change the [Flipper](https://fbflipper.com/) version when
66
+ * running your app on Android. You can set the `flipper` property to a
67
+ * semver string and specify an alternate Flipper version.
67
68
  */
68
69
  flipper?: string;
69
70
  /**
70
- * Enable the experimental Network Inspector for [Development builds](https://docs.expo.dev/develop/development-builds/introduction/).
71
- * SDK 49+ is required.
71
+ * Enable the Network Inspector.
72
+ *
73
+ * @default true
74
+ */
75
+ networkInspector?: boolean;
76
+ /**
77
+ * Add extra maven repositories to all gradle projects.
78
+ *
79
+ * This acts like to add the following code to **android/build.gradle**:
80
+ * ```groovy
81
+ * allprojects {
82
+ * repositories {
83
+ * maven {
84
+ * url [THE_EXTRA_MAVEN_REPOSITORY]
85
+ * }
86
+ * }
87
+ * }
88
+ * ```
89
+ *
90
+ * @hide For the implementation details,
91
+ * this property is actually handled by `expo-modules-autolinking` but not the config-plugins inside expo-build-properties.
72
92
  */
73
- unstable_networkInspector?: boolean;
93
+ extraMavenRepos?: string[];
74
94
  }
75
95
  /**
76
96
  * Interface representing available configuration for iOS native build properties.
@@ -91,24 +111,112 @@ export interface PluginConfigTypeIos {
91
111
  * Enable [`use_frameworks!`](https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang)
92
112
  * in `Podfile` to use frameworks instead of static libraries for Pods.
93
113
  *
94
- * Note: You cannot use `useFrameworks` and `flipper` at the same time
114
+ * > You cannot use `useFrameworks` and `flipper` at the same time , and
115
+ * doing so will generate an error.
95
116
  */
96
117
  useFrameworks?: 'static' | 'dynamic';
97
118
  /**
98
119
  * Enable [Flipper](https://fbflipper.com/) when running your app on iOS in
99
120
  * Debug mode. Setting `true` enables the default version of Flipper, while
100
121
  * setting a semver string will enable a specific version of Flipper you've
101
- * declared in your package.json. The default for this configuration is `false`.
122
+ * declared in your **package.json**. The default for this configuration is `false`.
102
123
  *
103
- * Note: You cannot use `flipper` at the same time as `useFrameworks`, and
124
+ * > You cannot use `flipper` at the same time as `useFrameworks`, and
104
125
  * doing so will generate an error.
105
126
  */
106
127
  flipper?: boolean | string;
107
128
  /**
108
- * Enable the experimental Network Inspector for [Development builds](https://docs.expo.dev/develop/development-builds/introduction/).
109
- * SDK 49+ is required.
129
+ * Enable the Network Inspector.
130
+ *
131
+ * @default true
132
+ */
133
+ networkInspector?: boolean;
134
+ /**
135
+ * Add extra CocoaPods dependencies for all targets.
136
+ *
137
+ * This acts like to add the following code to **ios/Podfile**:
138
+ * ```
139
+ * pod '[EXTRA_POD_NAME]', '~> [EXTRA_POD_VERSION]'
140
+ * # e.g.
141
+ * pod 'Protobuf', '~> 3.14.0'
142
+ * ```
143
+ *
144
+ * @hide For the implementation details,
145
+ * this property is actually handled by `expo-modules-autolinking` but not the config-plugins inside expo-build-properties.
146
+ */
147
+ extraPods?: ExtraIosPodDependency[];
148
+ }
149
+ /**
150
+ * Interface representing extra CocoaPods dependency.
151
+ * @see [Podfile syntax reference](https://guides.cocoapods.org/syntax/podfile.html#pod)
152
+ * @platform ios
153
+ */
154
+ export interface ExtraIosPodDependency {
155
+ /**
156
+ * Name of the pod.
157
+ */
158
+ name: string;
159
+ /**
160
+ * Version of the pod.
161
+ * CocoaPods supports various [versioning options](https://guides.cocoapods.org/using/the-podfile.html#pod).
162
+ * @example `~> 0.1.2`
163
+ */
164
+ version?: string;
165
+ /**
166
+ * Build configurations for which the pod should be installed.
167
+ * @example `['Debug', 'Release']`
168
+ */
169
+ configurations?: string[];
170
+ /**
171
+ * Whether this pod should use modular headers.
172
+ */
173
+ modular_headers?: boolean;
174
+ /**
175
+ * Custom source to search for this dependency.
176
+ * @example `https://github.com/CocoaPods/Specs.git`
177
+ */
178
+ source?: string;
179
+ /**
180
+ * Custom local filesystem path to add the dependency.
181
+ * @example `~/Documents/AFNetworking`
182
+ */
183
+ path?: string;
184
+ /**
185
+ * Custom podspec path.
186
+ * @example `https://example.com/JSONKit.podspec`
187
+ */
188
+ podspec?: string;
189
+ /**
190
+ * Test specs can be optionally included via the :testspecs option. By default, none of a Pod's test specs are included.
191
+ * @example `['UnitTests', 'SomeOtherTests']`
192
+ */
193
+ testspecs?: string[];
194
+ /**
195
+ * Use the bleeding edge version of a Pod.
196
+ *
197
+ * @example
198
+ * ```
199
+ * { "name": "AFNetworking", "git": "https://github.com/gowalla/AFNetworking.git", "tag": "0.7.0" }
200
+ * ```
201
+ *
202
+ * This acts like to add this pod dependency statement:
203
+ * ```
204
+ * pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :tag => '0.7.0'
205
+ * ```
206
+ */
207
+ git?: string;
208
+ /**
209
+ * The git branch to fetch. See the {@link git} property for more information.
210
+ */
211
+ branch?: string;
212
+ /**
213
+ * The git tag to fetch. See the {@link git} property for more information.
214
+ */
215
+ tag?: string;
216
+ /**
217
+ * The git commit to fetch. See the {@link git} property for more information.
110
218
  */
111
- unstable_networkInspector?: boolean;
219
+ commit?: string;
112
220
  }
113
221
  /**
114
222
  * Interface representing available configuration for Android Gradle plugin [PackagingOptions](https://developer.android.com/reference/tools/gradle-api/7.0/com/android/build/api/dsl/PackagingOptions).
@@ -50,7 +50,8 @@ const schema = {
50
50
  },
51
51
  nullable: true,
52
52
  },
53
- unstable_networkInspector: { type: 'boolean', nullable: true },
53
+ networkInspector: { type: 'boolean', nullable: true },
54
+ extraMavenRepos: { type: 'array', items: { type: 'string' }, nullable: true },
54
55
  },
55
56
  nullable: true,
56
57
  },
@@ -64,7 +65,29 @@ const schema = {
64
65
  type: ['boolean', 'string'],
65
66
  nullable: true,
66
67
  },
67
- unstable_networkInspector: { type: 'boolean', nullable: true },
68
+ networkInspector: { type: 'boolean', nullable: true },
69
+ extraPods: {
70
+ type: 'array',
71
+ items: {
72
+ type: 'object',
73
+ required: ['name'],
74
+ properties: {
75
+ name: { type: 'string' },
76
+ version: { type: 'string', nullable: true },
77
+ configurations: { type: 'array', items: { type: 'string' }, nullable: true },
78
+ modular_headers: { type: 'boolean', nullable: true },
79
+ source: { type: 'string', nullable: true },
80
+ path: { type: 'string', nullable: true },
81
+ podspec: { type: 'string', nullable: true },
82
+ testspecs: { type: 'array', items: { type: 'string' }, nullable: true },
83
+ git: { type: 'string', nullable: true },
84
+ branch: { type: 'string', nullable: true },
85
+ tag: { type: 'string', nullable: true },
86
+ commit: { type: 'string', nullable: true },
87
+ },
88
+ },
89
+ nullable: true,
90
+ },
68
91
  },
69
92
  nullable: true,
70
93
  },
@@ -130,7 +153,7 @@ function validateConfig(config) {
130
153
  maybeThrowInvalidVersions(config);
131
154
  // explicitly block using use_frameworks and Flipper in iOS
132
155
  // https://github.com/facebook/flipper/issues/2414
133
- if (config?.ios?.flipper !== undefined && config?.ios?.useFrameworks !== undefined) {
156
+ if (Boolean(config.ios?.flipper) && config.ios?.useFrameworks !== undefined) {
134
157
  throw new Error('`ios.flipper` cannot be enabled when `ios.useFrameworks` is set.');
135
158
  }
136
159
  if (config.android?.enableShrinkResourcesInReleaseBuilds === true &&
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-build-properties",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Config plugin to customize native build properties on prebuild",
5
5
  "main": "build/withBuildProperties.js",
6
6
  "types": "build/withBuildProperties.d.ts",
@@ -40,5 +40,5 @@
40
40
  "peerDependencies": {
41
41
  "expo": "*"
42
42
  },
43
- "gitHead": "6b73082d014ebe93f091aa75cd06f4d4d90eff19"
43
+ "gitHead": "fa5ecca8251986b9f197cc14074eec0ab6dfb6db"
44
44
  }
package/src/android.ts CHANGED
@@ -65,7 +65,7 @@ export const withAndroidBuildProperties = createBuildGradlePropsConfigPlugin<Plu
65
65
  },
66
66
  {
67
67
  propName: 'EX_DEV_CLIENT_NETWORK_INSPECTOR',
68
- propValueGetter: (config) => config.android?.unstable_networkInspector?.toString(),
68
+ propValueGetter: (config) => (config.android?.networkInspector ?? true).toString(),
69
69
  },
70
70
  ],
71
71
  'withAndroidBuildProperties'
package/src/ios.ts CHANGED
@@ -25,7 +25,7 @@ export const withIosBuildProperties = createBuildPodfilePropsConfigPlugin<Plugin
25
25
  },
26
26
  {
27
27
  propName: 'EX_DEV_CLIENT_NETWORK_INSPECTOR',
28
- propValueGetter: (config) => config.ios?.unstable_networkInspector?.toString(),
28
+ propValueGetter: (config) => (config.ios?.networkInspector ?? true).toString(),
29
29
  },
30
30
  ],
31
31
  'withIosBuildProperties'
@@ -81,18 +81,39 @@ export interface PluginConfigTypeAndroid {
81
81
  packagingOptions?: PluginConfigTypeAndroidPackagingOptions;
82
82
 
83
83
  /**
84
- * Change the [Flipper](https://fbflipper.com/) version when running your app on Android.
85
- * Flipper is by default enabled with the version that comes bundled with react-native.
86
- * However, you can set the `flipper` property to a semver string and specify an
87
- * alternate Flipper version.
84
+ * By default, Flipper is enabled with the version that comes bundled with `react-native`.
85
+ *
86
+ * Use this to change the [Flipper](https://fbflipper.com/) version when
87
+ * running your app on Android. You can set the `flipper` property to a
88
+ * semver string and specify an alternate Flipper version.
88
89
  */
89
90
  flipper?: string;
90
91
 
91
92
  /**
92
- * Enable the experimental Network Inspector for [Development builds](https://docs.expo.dev/develop/development-builds/introduction/).
93
- * SDK 49+ is required.
93
+ * Enable the Network Inspector.
94
+ *
95
+ * @default true
96
+ */
97
+ networkInspector?: boolean;
98
+
99
+ /**
100
+ * Add extra maven repositories to all gradle projects.
101
+ *
102
+ * This acts like to add the following code to **android/build.gradle**:
103
+ * ```groovy
104
+ * allprojects {
105
+ * repositories {
106
+ * maven {
107
+ * url [THE_EXTRA_MAVEN_REPOSITORY]
108
+ * }
109
+ * }
110
+ * }
111
+ * ```
112
+ *
113
+ * @hide For the implementation details,
114
+ * this property is actually handled by `expo-modules-autolinking` but not the config-plugins inside expo-build-properties.
94
115
  */
95
- unstable_networkInspector?: boolean;
116
+ extraMavenRepos?: string[];
96
117
  }
97
118
 
98
119
  /**
@@ -115,7 +136,8 @@ export interface PluginConfigTypeIos {
115
136
  * Enable [`use_frameworks!`](https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang)
116
137
  * in `Podfile` to use frameworks instead of static libraries for Pods.
117
138
  *
118
- * Note: You cannot use `useFrameworks` and `flipper` at the same time
139
+ * > You cannot use `useFrameworks` and `flipper` at the same time , and
140
+ * doing so will generate an error.
119
141
  */
120
142
  useFrameworks?: 'static' | 'dynamic';
121
143
 
@@ -123,18 +145,107 @@ export interface PluginConfigTypeIos {
123
145
  * Enable [Flipper](https://fbflipper.com/) when running your app on iOS in
124
146
  * Debug mode. Setting `true` enables the default version of Flipper, while
125
147
  * setting a semver string will enable a specific version of Flipper you've
126
- * declared in your package.json. The default for this configuration is `false`.
148
+ * declared in your **package.json**. The default for this configuration is `false`.
127
149
  *
128
- * Note: You cannot use `flipper` at the same time as `useFrameworks`, and
150
+ * > You cannot use `flipper` at the same time as `useFrameworks`, and
129
151
  * doing so will generate an error.
130
152
  */
131
153
  flipper?: boolean | string;
132
154
 
133
155
  /**
134
- * Enable the experimental Network Inspector for [Development builds](https://docs.expo.dev/develop/development-builds/introduction/).
135
- * SDK 49+ is required.
156
+ * Enable the Network Inspector.
157
+ *
158
+ * @default true
159
+ */
160
+ networkInspector?: boolean;
161
+
162
+ /**
163
+ * Add extra CocoaPods dependencies for all targets.
164
+ *
165
+ * This acts like to add the following code to **ios/Podfile**:
166
+ * ```
167
+ * pod '[EXTRA_POD_NAME]', '~> [EXTRA_POD_VERSION]'
168
+ * # e.g.
169
+ * pod 'Protobuf', '~> 3.14.0'
170
+ * ```
171
+ *
172
+ * @hide For the implementation details,
173
+ * this property is actually handled by `expo-modules-autolinking` but not the config-plugins inside expo-build-properties.
174
+ */
175
+ extraPods?: ExtraIosPodDependency[];
176
+ }
177
+
178
+ /**
179
+ * Interface representing extra CocoaPods dependency.
180
+ * @see [Podfile syntax reference](https://guides.cocoapods.org/syntax/podfile.html#pod)
181
+ * @platform ios
182
+ */
183
+ export interface ExtraIosPodDependency {
184
+ /**
185
+ * Name of the pod.
186
+ */
187
+ name: string;
188
+ /**
189
+ * Version of the pod.
190
+ * CocoaPods supports various [versioning options](https://guides.cocoapods.org/using/the-podfile.html#pod).
191
+ * @example `~> 0.1.2`
192
+ */
193
+ version?: string;
194
+ /**
195
+ * Build configurations for which the pod should be installed.
196
+ * @example `['Debug', 'Release']`
136
197
  */
137
- unstable_networkInspector?: boolean;
198
+ configurations?: string[];
199
+ /**
200
+ * Whether this pod should use modular headers.
201
+ */
202
+ modular_headers?: boolean;
203
+ /**
204
+ * Custom source to search for this dependency.
205
+ * @example `https://github.com/CocoaPods/Specs.git`
206
+ */
207
+ source?: string;
208
+ /**
209
+ * Custom local filesystem path to add the dependency.
210
+ * @example `~/Documents/AFNetworking`
211
+ */
212
+ path?: string;
213
+ /**
214
+ * Custom podspec path.
215
+ * @example `https://example.com/JSONKit.podspec`
216
+ */
217
+ podspec?: string;
218
+ /**
219
+ * Test specs can be optionally included via the :testspecs option. By default, none of a Pod's test specs are included.
220
+ * @example `['UnitTests', 'SomeOtherTests']`
221
+ */
222
+ testspecs?: string[];
223
+ /**
224
+ * Use the bleeding edge version of a Pod.
225
+ *
226
+ * @example
227
+ * ```
228
+ * { "name": "AFNetworking", "git": "https://github.com/gowalla/AFNetworking.git", "tag": "0.7.0" }
229
+ * ```
230
+ *
231
+ * This acts like to add this pod dependency statement:
232
+ * ```
233
+ * pod 'AFNetworking', :git => 'https://github.com/gowalla/AFNetworking.git', :tag => '0.7.0'
234
+ * ```
235
+ */
236
+ git?: string;
237
+ /**
238
+ * The git branch to fetch. See the {@link git} property for more information.
239
+ */
240
+ branch?: string;
241
+ /**
242
+ * The git tag to fetch. See the {@link git} property for more information.
243
+ */
244
+ tag?: string;
245
+ /**
246
+ * The git commit to fetch. See the {@link git} property for more information.
247
+ */
248
+ commit?: string;
138
249
  }
139
250
 
140
251
  /**
@@ -193,7 +304,9 @@ const schema: JSONSchemaType<PluginConfigType> = {
193
304
  nullable: true,
194
305
  },
195
306
 
196
- unstable_networkInspector: { type: 'boolean', nullable: true },
307
+ networkInspector: { type: 'boolean', nullable: true },
308
+
309
+ extraMavenRepos: { type: 'array', items: { type: 'string' }, nullable: true },
197
310
  },
198
311
  nullable: true,
199
312
  },
@@ -209,7 +322,30 @@ const schema: JSONSchemaType<PluginConfigType> = {
209
322
  nullable: true,
210
323
  },
211
324
 
212
- unstable_networkInspector: { type: 'boolean', nullable: true },
325
+ networkInspector: { type: 'boolean', nullable: true },
326
+
327
+ extraPods: {
328
+ type: 'array',
329
+ items: {
330
+ type: 'object',
331
+ required: ['name'],
332
+ properties: {
333
+ name: { type: 'string' },
334
+ version: { type: 'string', nullable: true },
335
+ configurations: { type: 'array', items: { type: 'string' }, nullable: true },
336
+ modular_headers: { type: 'boolean', nullable: true },
337
+ source: { type: 'string', nullable: true },
338
+ path: { type: 'string', nullable: true },
339
+ podspec: { type: 'string', nullable: true },
340
+ testspecs: { type: 'array', items: { type: 'string' }, nullable: true },
341
+ git: { type: 'string', nullable: true },
342
+ branch: { type: 'string', nullable: true },
343
+ tag: { type: 'string', nullable: true },
344
+ commit: { type: 'string', nullable: true },
345
+ },
346
+ },
347
+ nullable: true,
348
+ },
213
349
  },
214
350
  nullable: true,
215
351
  },
@@ -284,7 +420,7 @@ export function validateConfig(config: any): PluginConfigType {
284
420
 
285
421
  // explicitly block using use_frameworks and Flipper in iOS
286
422
  // https://github.com/facebook/flipper/issues/2414
287
- if (config?.ios?.flipper !== undefined && config?.ios?.useFrameworks !== undefined) {
423
+ if (Boolean(config.ios?.flipper) && config.ios?.useFrameworks !== undefined) {
288
424
  throw new Error('`ios.flipper` cannot be enabled when `ios.useFrameworks` is set.');
289
425
  }
290
426