expo-build-properties 0.11.1 → 0.12.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,22 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
- ## 0.11.1 — 2024-02-01
13
+ ## 0.12.0 — 2024-04-18
14
+
15
+ ### 🛠 Breaking changes
16
+
17
+ - Removed Flipper support. ([#26581](https://github.com/expo/expo/pull/26581) by [@kudo](https://github.com/kudo))
18
+
19
+ ### 🎉 New features
20
+
21
+ - Expand `android.extraMavenRepos` to allow authentication-required Maven repositories. ([#26895](https://github.com/expo/expo/pull/26895) by [@bpeltonc](https://github.com/bpeltonc))
22
+ - Added `extraPods` and `extraMavenRepos` supports within `withBuildProperties()` that library authors could reuse in third-party libraries. ([#28106](https://github.com/expo/expo/pull/28106) by [@kudo](https://github.com/kudo))
23
+
24
+ ### 📚 3rd party library updates
25
+
26
+ - update semver from 7.5.3 to 7.5.4. ([#26876](https://github.com/expo/expo/pull/26876) by [@GaelCO](https://github.com/GaelCO))
27
+
28
+ ## 0.11.1 - 2024-02-01
14
29
 
15
30
  ### 🎉 New features
16
31
 
package/README.md CHANGED
@@ -25,12 +25,10 @@ Add plugin to `app.json`. For example:
25
25
  "android": {
26
26
  "compileSdkVersion": 31,
27
27
  "targetSdkVersion": 31,
28
- "buildToolsVersion": "31.0.0",
29
- "flipper": true
28
+ "buildToolsVersion": "31.0.0"
30
29
  },
31
30
  "ios": {
32
- "deploymentTarget": "13.0",
33
- "flipper": true
31
+ "deploymentTarget": "13.0"
34
32
  }
35
33
  }
36
34
  ]
@@ -1,7 +1,6 @@
1
1
  import { ConfigPlugin } from 'expo/config-plugins';
2
2
  import type { PluginConfigType } from './pluginConfig';
3
3
  export declare const withAndroidBuildProperties: ConfigPlugin<PluginConfigType>;
4
- export declare const withAndroidFlipper: ConfigPlugin<PluginConfigType>;
5
4
  /**
6
5
  * Appends `props.android.extraProguardRules` content into `android/app/proguard-rules.pro`
7
6
  */
package/build/android.js CHANGED
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.withAndroidQueries = exports.withAndroidCleartextTraffic = exports.updateAndroidProguardRules = exports.withAndroidPurgeProguardRulesOnce = exports.withAndroidProguardRules = exports.withAndroidFlipper = exports.withAndroidBuildProperties = void 0;
6
+ exports.withAndroidQueries = exports.withAndroidCleartextTraffic = exports.withAndroidPurgeProguardRulesOnce = exports.withAndroidProguardRules = exports.withAndroidBuildProperties = void 0;
7
+ exports.updateAndroidProguardRules = updateAndroidProguardRules;
7
8
  const config_plugins_1 = require("expo/config-plugins");
8
9
  const fs_1 = __importDefault(require("fs"));
9
10
  const path_1 = __importDefault(require("path"));
@@ -67,32 +68,19 @@ exports.withAndroidBuildProperties = createBuildGradlePropsConfigPlugin([
67
68
  propName: 'expo.useLegacyPackaging',
68
69
  propValueGetter: (config) => (config.android?.useLegacyPackaging ?? false).toString(),
69
70
  },
71
+ {
72
+ propName: 'android.extraMavenRepos',
73
+ propValueGetter: (config) => {
74
+ const extraMavenRepos = (config.android?.extraMavenRepos ?? []).map((item) => {
75
+ if (typeof item === 'string') {
76
+ return { url: item };
77
+ }
78
+ return item;
79
+ });
80
+ return JSON.stringify(extraMavenRepos);
81
+ },
82
+ },
70
83
  ], 'withAndroidBuildProperties');
71
- const withAndroidFlipper = (config, props) => {
72
- const ANDROID_FLIPPER_KEY = 'FLIPPER_VERSION';
73
- const FLIPPER_FALLBACK = '0.125.0';
74
- // when not set, make no changes
75
- if (props.android?.flipper === undefined) {
76
- return config;
77
- }
78
- return (0, config_plugins_1.withGradleProperties)(config, (c) => {
79
- // check for Flipper version in package. If set, use that
80
- let existing;
81
- const found = c.modResults.find((item) => item.type === 'property' && item.key === ANDROID_FLIPPER_KEY);
82
- if (found && found.type === 'property') {
83
- existing = found.value;
84
- }
85
- // strip key and re-add based on setting
86
- c.modResults = c.modResults.filter((item) => !(item.type === 'property' && item.key === ANDROID_FLIPPER_KEY));
87
- c.modResults.push({
88
- type: 'property',
89
- key: ANDROID_FLIPPER_KEY,
90
- value: (props.android?.flipper ?? existing ?? FLIPPER_FALLBACK),
91
- });
92
- return c;
93
- });
94
- };
95
- exports.withAndroidFlipper = withAndroidFlipper;
96
84
  /**
97
85
  * Appends `props.android.extraProguardRules` content into `android/app/proguard-rules.pro`
98
86
  */
@@ -178,7 +166,6 @@ function updateAndroidProguardRules(contents, newProguardRules, updateMode) {
178
166
  }
179
167
  return newContents;
180
168
  }
181
- exports.updateAndroidProguardRules = updateAndroidProguardRules;
182
169
  const withAndroidCleartextTraffic = (config, props) => {
183
170
  return (0, config_plugins_1.withAndroidManifest)(config, (config) => {
184
171
  if (props.android?.usesCleartextTraffic == null) {
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.renderQueryIntents = exports.renderQueryPackages = exports.renderQueryProviders = void 0;
3
+ exports.renderQueryProviders = renderQueryProviders;
4
+ exports.renderQueryPackages = renderQueryPackages;
5
+ exports.renderQueryIntents = renderQueryIntents;
4
6
  function renderQueryProviders(data) {
5
7
  const dataStr = Array.isArray(data) ? data.join(';') : data;
6
8
  return dataStr ? { $: { 'android:authorities': dataStr } } : undefined;
7
9
  }
8
- exports.renderQueryProviders = renderQueryProviders;
9
10
  function renderQueryPackages(data) {
10
11
  return (Array.isArray(data) ? data : [data]).filter(Boolean).map((datum) => ({
11
12
  $: {
@@ -13,7 +14,6 @@ function renderQueryPackages(data) {
13
14
  },
14
15
  }));
15
16
  }
16
- exports.renderQueryPackages = renderQueryPackages;
17
17
  function renderQueryIntents(queryIntents) {
18
18
  return (queryIntents?.map((intent) => {
19
19
  const { data, category, action } = intent;
@@ -36,4 +36,3 @@ function renderQueryIntents(queryIntents) {
36
36
  };
37
37
  }) ?? []);
38
38
  }
39
- exports.renderQueryIntents = renderQueryIntents;
@@ -6,7 +6,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6
6
  return (mod && mod.__esModule) ? mod : { "default": mod };
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.purgeContents = exports.appendContents = void 0;
9
+ exports.appendContents = appendContents;
10
+ exports.purgeContents = purgeContents;
10
11
  const assert_1 = __importDefault(require("assert"));
11
12
  /**
12
13
  * Append new contents to src with generated section comments
@@ -28,7 +29,6 @@ function appendContents(src, contents, sectionOptions) {
28
29
  return `${src}\n${sectionedContents}`;
29
30
  }
30
31
  }
31
- exports.appendContents = appendContents;
32
32
  /**
33
33
  * Purge a generated section
34
34
  */
@@ -38,7 +38,6 @@ function purgeContents(src, sectionOptions) {
38
38
  const regex = new RegExp(`\\n${escapeRegExp(start)}\\n[\\s\\S]*\\n${escapeRegExp(end)}`, 'gm');
39
39
  return src.replace(regex, '');
40
40
  }
41
- exports.purgeContents = purgeContents;
42
41
  /**
43
42
  * Create comments for generated section
44
43
  */
package/build/ios.js CHANGED
@@ -12,19 +12,14 @@ exports.withIosBuildProperties = createBuildPodfilePropsConfigPlugin([
12
12
  propName: 'ios.useFrameworks',
13
13
  propValueGetter: (config) => config.ios?.useFrameworks,
14
14
  },
15
- {
16
- propName: 'ios.flipper',
17
- propValueGetter: (config) => {
18
- if (typeof config.ios?.flipper === 'string' || typeof config.ios?.flipper === 'boolean') {
19
- return config.ios.flipper.toString();
20
- }
21
- return undefined;
22
- },
23
- },
24
15
  {
25
16
  propName: 'EX_DEV_CLIENT_NETWORK_INSPECTOR',
26
17
  propValueGetter: (config) => (config.ios?.networkInspector ?? true).toString(),
27
18
  },
19
+ {
20
+ propName: 'apple.extraPods',
21
+ propValueGetter: (config) => JSON.stringify(config.ios?.extraPods ?? []),
22
+ },
28
23
  ], 'withIosBuildProperties');
29
24
  const withIosDeploymentTarget = (config, props) => {
30
25
  const deploymentTarget = props.ios?.deploymentTarget;
@@ -59,14 +59,6 @@ export interface PluginConfigTypeAndroid {
59
59
  * 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).
60
60
  */
61
61
  packagingOptions?: PluginConfigTypeAndroidPackagingOptions;
62
- /**
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.
68
- */
69
- flipper?: string;
70
62
  /**
71
63
  * Enable the Network Inspector.
72
64
  *
@@ -76,21 +68,45 @@ export interface PluginConfigTypeAndroid {
76
68
  /**
77
69
  * Add extra maven repositories to all gradle projects.
78
70
  *
79
- * This acts like to add the following code to **android/build.gradle**:
71
+ *
72
+ * Takes an array of objects or strings.
73
+ * Strings are passed as the `url` property of the object with no credentials or authentication scheme.
74
+ *
75
+ * This adds the following code to **android/build.gradle**:
76
+ * ```groovy
77
+ * allprojects {
78
+ * repositories {
79
+ * maven {
80
+ * url "https://foo.com/maven-releases"
81
+ * }
82
+ * }
83
+ * ```
84
+ *
85
+ * By using an `AndroidMavenRepository` object, you can specify credentials and an authentication scheme.
86
+ *
80
87
  * ```groovy
81
88
  * allprojects {
82
89
  * repositories {
83
90
  * maven {
84
- * url [THE_EXTRA_MAVEN_REPOSITORY]
91
+ * url "https://foo.com/maven-releases"
92
+ * credentials {
93
+ * username = "bar"
94
+ * password = "baz"
95
+ * }
96
+ * authentication {
97
+ * basic(BasicAuthentication)
98
+ * }
85
99
  * }
86
100
  * }
87
101
  * }
88
102
  * ```
89
103
  *
104
+ * @see [Gradle documentation](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:case-for-maven)
105
+ *
90
106
  * @hide For the implementation details,
91
- * this property is actually handled by `expo-modules-autolinking` but not the config-plugins inside expo-build-properties.
107
+ * this property is actually handled by `expo-modules-autolinking` not the config-plugins inside `expo-build-properties`
92
108
  */
93
- extraMavenRepos?: string[];
109
+ extraMavenRepos?: (AndroidMavenRepository | string)[];
94
110
  /**
95
111
  * Indicates whether the app intends to use cleartext network traffic.
96
112
  *
@@ -115,6 +131,37 @@ export interface PluginConfigTypeAndroid {
115
131
  */
116
132
  manifestQueries?: PluginConfigTypeAndroidQueries;
117
133
  }
134
+ export interface AndroidMavenRepository {
135
+ /**
136
+ * The URL of the Maven repository.
137
+ */
138
+ url: string;
139
+ /**
140
+ * The credentials to use when accessing the Maven repository.
141
+ * May be of type PasswordCredentials, HttpHeaderCredentials, or AWSCredentials.
142
+ *
143
+ * @see the authentication schemes section of [Gradle documentation](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:authentication_schemes) for more information.
144
+ */
145
+ credentials?: AndroidMavenRepositoryCredentials;
146
+ /**
147
+ * The authentication scheme to use when accessing the Maven repository.
148
+ */
149
+ authentication?: 'basic' | 'digest' | 'header';
150
+ }
151
+ interface AndroidMavenRepositoryPasswordCredentials {
152
+ username: string;
153
+ password: string;
154
+ }
155
+ interface AndroidMavenRepositoryHttpHeaderCredentials {
156
+ name: string;
157
+ value: string;
158
+ }
159
+ interface AndroidMavenRepositoryAWSCredentials {
160
+ accessKey: string;
161
+ secretKey: string;
162
+ sessionToken?: string;
163
+ }
164
+ type AndroidMavenRepositoryCredentials = AndroidMavenRepositoryPasswordCredentials | AndroidMavenRepositoryHttpHeaderCredentials | AndroidMavenRepositoryAWSCredentials;
118
165
  /**
119
166
  * Interface representing available configuration for iOS native build properties.
120
167
  * @platform ios
@@ -133,21 +180,8 @@ export interface PluginConfigTypeIos {
133
180
  /**
134
181
  * Enable [`use_frameworks!`](https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang)
135
182
  * in `Podfile` to use frameworks instead of static libraries for Pods.
136
- *
137
- * > You cannot use `useFrameworks` and `flipper` at the same time, and
138
- * doing so will generate an error.
139
183
  */
140
184
  useFrameworks?: 'static' | 'dynamic';
141
- /**
142
- * Enable [Flipper](https://fbflipper.com/) when running your app on iOS in
143
- * Debug mode. Setting `true` enables the default version of Flipper, while
144
- * setting a semver string will enable a specific version of Flipper you've
145
- * declared in your **package.json**. The default for this configuration is `false`.
146
- *
147
- * > You cannot use `flipper` at the same time as `useFrameworks`, and
148
- * doing so will generate an error.
149
- */
150
- flipper?: boolean | string;
151
185
  /**
152
186
  * Enable the Network Inspector.
153
187
  *
@@ -182,12 +216,18 @@ export interface ExtraIosPodDependency {
182
216
  /**
183
217
  * Version of the pod.
184
218
  * CocoaPods supports various [versioning options](https://guides.cocoapods.org/using/the-podfile.html#pod).
185
- * @example `~> 0.1.2`
219
+ * @example
220
+ * ```
221
+ * ~> 0.1.2
222
+ * ```
186
223
  */
187
224
  version?: string;
188
225
  /**
189
226
  * Build configurations for which the pod should be installed.
190
- * @example `['Debug', 'Release']`
227
+ * @example
228
+ * ```
229
+ * ['Debug', 'Release']
230
+ * ```
191
231
  */
192
232
  configurations?: string[];
193
233
  /**
@@ -196,22 +236,32 @@ export interface ExtraIosPodDependency {
196
236
  modular_headers?: boolean;
197
237
  /**
198
238
  * Custom source to search for this dependency.
199
- * @example `https://github.com/CocoaPods/Specs.git`
239
+ * @example
240
+ * ```
241
+ * https://github.com/CocoaPods/Specs.git
242
+ * ```
200
243
  */
201
244
  source?: string;
202
245
  /**
203
246
  * Custom local filesystem path to add the dependency.
204
- * @example `~/Documents/AFNetworking`
247
+ * @example
248
+ * ```
249
+ * ~/Documents/AFNetworking
250
+ * ```
205
251
  */
206
252
  path?: string;
207
253
  /**
208
254
  * Custom podspec path.
209
- * @example `https://example.com/JSONKit.podspec`
255
+ * @example
256
+ * ```https://example.com/JSONKit.podspec```
210
257
  */
211
258
  podspec?: string;
212
259
  /**
213
260
  * Test specs can be optionally included via the :testspecs option. By default, none of a Pod's test specs are included.
214
- * @example `['UnitTests', 'SomeOtherTests']`
261
+ * @example
262
+ * ```
263
+ * ['UnitTests', 'SomeOtherTests']
264
+ * ```
215
265
  */
216
266
  testspecs?: string[];
217
267
  /**
@@ -314,3 +364,4 @@ export interface PluginConfigTypeAndroidQueriesData {
314
364
  * @ignore
315
365
  */
316
366
  export declare function validateConfig(config: any): PluginConfigType;
367
+ export {};
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.validateConfig = void 0;
6
+ exports.validateConfig = validateConfig;
7
7
  const ajv_1 = __importDefault(require("ajv"));
8
8
  const semver_1 = __importDefault(require("semver"));
9
9
  /**
@@ -36,10 +36,6 @@ const schema = {
36
36
  enableProguardInReleaseBuilds: { type: 'boolean', nullable: true },
37
37
  enableShrinkResourcesInReleaseBuilds: { type: 'boolean', nullable: true },
38
38
  extraProguardRules: { type: 'string', nullable: true },
39
- flipper: {
40
- type: 'string',
41
- nullable: true,
42
- },
43
39
  packagingOptions: {
44
40
  type: 'object',
45
41
  properties: {
@@ -51,7 +47,63 @@ const schema = {
51
47
  nullable: true,
52
48
  },
53
49
  networkInspector: { type: 'boolean', nullable: true },
54
- extraMavenRepos: { type: 'array', items: { type: 'string' }, nullable: true },
50
+ extraMavenRepos: {
51
+ type: 'array',
52
+ items: {
53
+ type: ['string', 'object'],
54
+ anyOf: [
55
+ { type: 'string', nullable: false },
56
+ {
57
+ type: 'object',
58
+ required: ['url'],
59
+ properties: {
60
+ url: { type: 'string', nullable: false },
61
+ credentials: {
62
+ type: 'object',
63
+ oneOf: [
64
+ {
65
+ type: 'object',
66
+ properties: {
67
+ username: { type: 'string' },
68
+ password: { type: 'string' },
69
+ },
70
+ required: ['username', 'password'],
71
+ additionalProperties: false,
72
+ },
73
+ {
74
+ type: 'object',
75
+ properties: {
76
+ name: { type: 'string' },
77
+ value: { type: 'string' },
78
+ },
79
+ required: ['name', 'value'],
80
+ additionalProperties: false,
81
+ },
82
+ {
83
+ type: 'object',
84
+ properties: {
85
+ accessKey: { type: 'string' },
86
+ secretKey: { type: 'string' },
87
+ sessionToken: { type: 'string', nullable: true },
88
+ },
89
+ required: ['accessKey', 'secretKey'],
90
+ additionalProperties: false,
91
+ },
92
+ ],
93
+ nullable: true,
94
+ },
95
+ authentication: {
96
+ type: 'string',
97
+ enum: ['basic', 'digest', 'header'],
98
+ nullable: true,
99
+ },
100
+ },
101
+ additionalProperties: false,
102
+ },
103
+ ],
104
+ },
105
+ nullable: true,
106
+ },
55
107
  usesCleartextTraffic: { type: 'boolean', nullable: true },
56
108
  useLegacyPackaging: { type: 'boolean', nullable: true },
57
109
  manifestQueries: {
@@ -92,10 +144,6 @@ const schema = {
92
144
  newArchEnabled: { type: 'boolean', nullable: true },
93
145
  deploymentTarget: { type: 'string', pattern: '\\d+\\.\\d+', nullable: true },
94
146
  useFrameworks: { type: 'string', enum: ['static', 'dynamic'], nullable: true },
95
- flipper: {
96
- type: ['boolean', 'string'],
97
- nullable: true,
98
- },
99
147
  networkInspector: { type: 'boolean', nullable: true },
100
148
  extraPods: {
101
149
  type: 'array',
@@ -182,15 +230,9 @@ function validateConfig(config) {
182
230
  throw new Error('Invalid expo-build-properties config: ' + JSON.stringify(validate.errors));
183
231
  }
184
232
  maybeThrowInvalidVersions(config);
185
- // explicitly block using use_frameworks and Flipper in iOS
186
- // https://github.com/facebook/flipper/issues/2414
187
- if (Boolean(config.ios?.flipper) && config.ios?.useFrameworks !== undefined) {
188
- throw new Error('`ios.flipper` cannot be enabled when `ios.useFrameworks` is set.');
189
- }
190
233
  if (config.android?.enableShrinkResourcesInReleaseBuilds === true &&
191
234
  config.android?.enableProguardInReleaseBuilds !== true) {
192
235
  throw new Error('`android.enableShrinkResourcesInReleaseBuilds` requires `android.enableProguardInReleaseBuilds` to be enabled.');
193
236
  }
194
237
  return config;
195
238
  }
196
- exports.validateConfig = validateConfig;
@@ -22,7 +22,6 @@ const withBuildProperties = (config, props) => {
22
22
  //
23
23
  // plugins order matter: the later one would run first
24
24
  config = (0, android_1.withAndroidPurgeProguardRulesOnce)(config);
25
- config = (0, android_1.withAndroidFlipper)(config, pluginConfig);
26
25
  config = (0, ios_1.withIosBuildProperties)(config, pluginConfig);
27
26
  config = (0, ios_1.withIosDeploymentTarget)(config, pluginConfig);
28
27
  return config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-build-properties",
3
- "version": "0.11.1",
3
+ "version": "0.12.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",
@@ -32,7 +32,7 @@
32
32
  "homepage": "https://docs.expo.dev/versions/latest/sdk/build-properties",
33
33
  "dependencies": {
34
34
  "ajv": "^8.11.0",
35
- "semver": "^7.5.3"
35
+ "semver": "^7.6.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "expo-module-scripts": "^3.0.0"
@@ -40,5 +40,5 @@
40
40
  "peerDependencies": {
41
41
  "expo": "*"
42
42
  },
43
- "gitHead": "9e4890b069b18598ea429734b5114b40e3afeabb"
43
+ "gitHead": "4165b8d72e1b9a1889c2767534cc619e21468110"
44
44
  }
package/src/android.ts CHANGED
@@ -4,7 +4,6 @@ import {
4
4
  History,
5
5
  withAndroidManifest,
6
6
  withDangerousMod,
7
- withGradleProperties,
8
7
  } from 'expo/config-plugins';
9
8
  import fs from 'fs';
10
9
  import path from 'path';
@@ -73,45 +72,22 @@ export const withAndroidBuildProperties = createBuildGradlePropsConfigPlugin<Plu
73
72
  propName: 'expo.useLegacyPackaging',
74
73
  propValueGetter: (config) => (config.android?.useLegacyPackaging ?? false).toString(),
75
74
  },
75
+ {
76
+ propName: 'android.extraMavenRepos',
77
+ propValueGetter: (config) => {
78
+ const extraMavenRepos = (config.android?.extraMavenRepos ?? []).map((item) => {
79
+ if (typeof item === 'string') {
80
+ return { url: item };
81
+ }
82
+ return item;
83
+ });
84
+ return JSON.stringify(extraMavenRepos);
85
+ },
86
+ },
76
87
  ],
77
88
  'withAndroidBuildProperties'
78
89
  );
79
90
 
80
- export const withAndroidFlipper: ConfigPlugin<PluginConfigType> = (config, props) => {
81
- const ANDROID_FLIPPER_KEY = 'FLIPPER_VERSION';
82
- const FLIPPER_FALLBACK = '0.125.0';
83
-
84
- // when not set, make no changes
85
- if (props.android?.flipper === undefined) {
86
- return config;
87
- }
88
-
89
- return withGradleProperties(config, (c) => {
90
- // check for Flipper version in package. If set, use that
91
- let existing: string | undefined;
92
-
93
- const found = c.modResults.find(
94
- (item) => item.type === 'property' && item.key === ANDROID_FLIPPER_KEY
95
- );
96
- if (found && found.type === 'property') {
97
- existing = found.value;
98
- }
99
-
100
- // strip key and re-add based on setting
101
- c.modResults = c.modResults.filter(
102
- (item) => !(item.type === 'property' && item.key === ANDROID_FLIPPER_KEY)
103
- );
104
-
105
- c.modResults.push({
106
- type: 'property',
107
- key: ANDROID_FLIPPER_KEY,
108
- value: (props.android?.flipper ?? existing ?? FLIPPER_FALLBACK) as string,
109
- });
110
-
111
- return c;
112
- });
113
- };
114
-
115
91
  /**
116
92
  * Appends `props.android.extraProguardRules` content into `android/app/proguard-rules.pro`
117
93
  */
package/src/ios.ts CHANGED
@@ -14,19 +14,14 @@ export const withIosBuildProperties = createBuildPodfilePropsConfigPlugin<Plugin
14
14
  propName: 'ios.useFrameworks',
15
15
  propValueGetter: (config) => config.ios?.useFrameworks,
16
16
  },
17
- {
18
- propName: 'ios.flipper',
19
- propValueGetter: (config) => {
20
- if (typeof config.ios?.flipper === 'string' || typeof config.ios?.flipper === 'boolean') {
21
- return config.ios.flipper.toString();
22
- }
23
- return undefined;
24
- },
25
- },
26
17
  {
27
18
  propName: 'EX_DEV_CLIENT_NETWORK_INSPECTOR',
28
19
  propValueGetter: (config) => (config.ios?.networkInspector ?? true).toString(),
29
20
  },
21
+ {
22
+ propName: 'apple.extraPods',
23
+ propValueGetter: (config) => JSON.stringify(config.ios?.extraPods ?? []),
24
+ },
30
25
  ],
31
26
  'withIosBuildProperties'
32
27
  );
@@ -80,15 +80,6 @@ export interface PluginConfigTypeAndroid {
80
80
  */
81
81
  packagingOptions?: PluginConfigTypeAndroidPackagingOptions;
82
82
 
83
- /**
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.
89
- */
90
- flipper?: string;
91
-
92
83
  /**
93
84
  * Enable the Network Inspector.
94
85
  *
@@ -99,21 +90,45 @@ export interface PluginConfigTypeAndroid {
99
90
  /**
100
91
  * Add extra maven repositories to all gradle projects.
101
92
  *
102
- * This acts like to add the following code to **android/build.gradle**:
93
+ *
94
+ * Takes an array of objects or strings.
95
+ * Strings are passed as the `url` property of the object with no credentials or authentication scheme.
96
+ *
97
+ * This adds the following code to **android/build.gradle**:
98
+ * ```groovy
99
+ * allprojects {
100
+ * repositories {
101
+ * maven {
102
+ * url "https://foo.com/maven-releases"
103
+ * }
104
+ * }
105
+ * ```
106
+ *
107
+ * By using an `AndroidMavenRepository` object, you can specify credentials and an authentication scheme.
108
+ *
103
109
  * ```groovy
104
110
  * allprojects {
105
111
  * repositories {
106
112
  * maven {
107
- * url [THE_EXTRA_MAVEN_REPOSITORY]
113
+ * url "https://foo.com/maven-releases"
114
+ * credentials {
115
+ * username = "bar"
116
+ * password = "baz"
117
+ * }
118
+ * authentication {
119
+ * basic(BasicAuthentication)
120
+ * }
108
121
  * }
109
122
  * }
110
123
  * }
111
124
  * ```
112
125
  *
126
+ * @see [Gradle documentation](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:case-for-maven)
127
+ *
113
128
  * @hide For the implementation details,
114
- * this property is actually handled by `expo-modules-autolinking` but not the config-plugins inside expo-build-properties.
129
+ * this property is actually handled by `expo-modules-autolinking` not the config-plugins inside `expo-build-properties`
115
130
  */
116
- extraMavenRepos?: string[];
131
+ extraMavenRepos?: (AndroidMavenRepository | string)[];
117
132
  /**
118
133
  * Indicates whether the app intends to use cleartext network traffic.
119
134
  *
@@ -139,6 +154,45 @@ export interface PluginConfigTypeAndroid {
139
154
  manifestQueries?: PluginConfigTypeAndroidQueries;
140
155
  }
141
156
 
157
+ export interface AndroidMavenRepository {
158
+ /**
159
+ * The URL of the Maven repository.
160
+ */
161
+ url: string;
162
+ /**
163
+ * The credentials to use when accessing the Maven repository.
164
+ * May be of type PasswordCredentials, HttpHeaderCredentials, or AWSCredentials.
165
+ *
166
+ * @see the authentication schemes section of [Gradle documentation](https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:authentication_schemes) for more information.
167
+ */
168
+ credentials?: AndroidMavenRepositoryCredentials;
169
+ /**
170
+ * The authentication scheme to use when accessing the Maven repository.
171
+ */
172
+ authentication?: 'basic' | 'digest' | 'header';
173
+ }
174
+
175
+ interface AndroidMavenRepositoryPasswordCredentials {
176
+ username: string;
177
+ password: string;
178
+ }
179
+
180
+ interface AndroidMavenRepositoryHttpHeaderCredentials {
181
+ name: string;
182
+ value: string;
183
+ }
184
+
185
+ interface AndroidMavenRepositoryAWSCredentials {
186
+ accessKey: string;
187
+ secretKey: string;
188
+ sessionToken?: string;
189
+ }
190
+
191
+ type AndroidMavenRepositoryCredentials =
192
+ | AndroidMavenRepositoryPasswordCredentials
193
+ | AndroidMavenRepositoryHttpHeaderCredentials
194
+ | AndroidMavenRepositoryAWSCredentials;
195
+
142
196
  /**
143
197
  * Interface representing available configuration for iOS native build properties.
144
198
  * @platform ios
@@ -158,23 +212,9 @@ export interface PluginConfigTypeIos {
158
212
  /**
159
213
  * Enable [`use_frameworks!`](https://guides.cocoapods.org/syntax/podfile.html#use_frameworks_bang)
160
214
  * in `Podfile` to use frameworks instead of static libraries for Pods.
161
- *
162
- * > You cannot use `useFrameworks` and `flipper` at the same time, and
163
- * doing so will generate an error.
164
215
  */
165
216
  useFrameworks?: 'static' | 'dynamic';
166
217
 
167
- /**
168
- * Enable [Flipper](https://fbflipper.com/) when running your app on iOS in
169
- * Debug mode. Setting `true` enables the default version of Flipper, while
170
- * setting a semver string will enable a specific version of Flipper you've
171
- * declared in your **package.json**. The default for this configuration is `false`.
172
- *
173
- * > You cannot use `flipper` at the same time as `useFrameworks`, and
174
- * doing so will generate an error.
175
- */
176
- flipper?: boolean | string;
177
-
178
218
  /**
179
219
  * Enable the Network Inspector.
180
220
  *
@@ -211,12 +251,18 @@ export interface ExtraIosPodDependency {
211
251
  /**
212
252
  * Version of the pod.
213
253
  * CocoaPods supports various [versioning options](https://guides.cocoapods.org/using/the-podfile.html#pod).
214
- * @example `~> 0.1.2`
254
+ * @example
255
+ * ```
256
+ * ~> 0.1.2
257
+ * ```
215
258
  */
216
259
  version?: string;
217
260
  /**
218
261
  * Build configurations for which the pod should be installed.
219
- * @example `['Debug', 'Release']`
262
+ * @example
263
+ * ```
264
+ * ['Debug', 'Release']
265
+ * ```
220
266
  */
221
267
  configurations?: string[];
222
268
  /**
@@ -225,22 +271,32 @@ export interface ExtraIosPodDependency {
225
271
  modular_headers?: boolean;
226
272
  /**
227
273
  * Custom source to search for this dependency.
228
- * @example `https://github.com/CocoaPods/Specs.git`
274
+ * @example
275
+ * ```
276
+ * https://github.com/CocoaPods/Specs.git
277
+ * ```
229
278
  */
230
279
  source?: string;
231
280
  /**
232
281
  * Custom local filesystem path to add the dependency.
233
- * @example `~/Documents/AFNetworking`
282
+ * @example
283
+ * ```
284
+ * ~/Documents/AFNetworking
285
+ * ```
234
286
  */
235
287
  path?: string;
236
288
  /**
237
289
  * Custom podspec path.
238
- * @example `https://example.com/JSONKit.podspec`
290
+ * @example
291
+ * ```https://example.com/JSONKit.podspec```
239
292
  */
240
293
  podspec?: string;
241
294
  /**
242
295
  * Test specs can be optionally included via the :testspecs option. By default, none of a Pod's test specs are included.
243
- * @example `['UnitTests', 'SomeOtherTests']`
296
+ * @example
297
+ * ```
298
+ * ['UnitTests', 'SomeOtherTests']
299
+ * ```
244
300
  */
245
301
  testspecs?: string[];
246
302
  /**
@@ -361,11 +417,6 @@ const schema: JSONSchemaType<PluginConfigType> = {
361
417
  enableShrinkResourcesInReleaseBuilds: { type: 'boolean', nullable: true },
362
418
  extraProguardRules: { type: 'string', nullable: true },
363
419
 
364
- flipper: {
365
- type: 'string',
366
- nullable: true,
367
- },
368
-
369
420
  packagingOptions: {
370
421
  type: 'object',
371
422
  properties: {
@@ -379,7 +430,63 @@ const schema: JSONSchemaType<PluginConfigType> = {
379
430
 
380
431
  networkInspector: { type: 'boolean', nullable: true },
381
432
 
382
- extraMavenRepos: { type: 'array', items: { type: 'string' }, nullable: true },
433
+ extraMavenRepos: {
434
+ type: 'array',
435
+ items: {
436
+ type: ['string', 'object'],
437
+ anyOf: [
438
+ { type: 'string', nullable: false },
439
+ {
440
+ type: 'object',
441
+ required: ['url'],
442
+ properties: {
443
+ url: { type: 'string', nullable: false },
444
+ credentials: {
445
+ type: 'object',
446
+ oneOf: [
447
+ {
448
+ type: 'object',
449
+ properties: {
450
+ username: { type: 'string' },
451
+ password: { type: 'string' },
452
+ },
453
+ required: ['username', 'password'],
454
+ additionalProperties: false,
455
+ },
456
+ {
457
+ type: 'object',
458
+ properties: {
459
+ name: { type: 'string' },
460
+ value: { type: 'string' },
461
+ },
462
+ required: ['name', 'value'],
463
+ additionalProperties: false,
464
+ },
465
+ {
466
+ type: 'object',
467
+ properties: {
468
+ accessKey: { type: 'string' },
469
+ secretKey: { type: 'string' },
470
+ sessionToken: { type: 'string', nullable: true },
471
+ },
472
+ required: ['accessKey', 'secretKey'],
473
+ additionalProperties: false,
474
+ },
475
+ ],
476
+ nullable: true,
477
+ },
478
+ authentication: {
479
+ type: 'string',
480
+ enum: ['basic', 'digest', 'header'],
481
+ nullable: true,
482
+ },
483
+ },
484
+ additionalProperties: false,
485
+ },
486
+ ],
487
+ },
488
+ nullable: true,
489
+ },
383
490
 
384
491
  usesCleartextTraffic: { type: 'boolean', nullable: true },
385
492
 
@@ -424,11 +531,6 @@ const schema: JSONSchemaType<PluginConfigType> = {
424
531
  deploymentTarget: { type: 'string', pattern: '\\d+\\.\\d+', nullable: true },
425
532
  useFrameworks: { type: 'string', enum: ['static', 'dynamic'], nullable: true },
426
533
 
427
- flipper: {
428
- type: ['boolean', 'string'],
429
- nullable: true,
430
- },
431
-
432
534
  networkInspector: { type: 'boolean', nullable: true },
433
535
 
434
536
  extraPods: {
@@ -525,12 +627,6 @@ export function validateConfig(config: any): PluginConfigType {
525
627
 
526
628
  maybeThrowInvalidVersions(config);
527
629
 
528
- // explicitly block using use_frameworks and Flipper in iOS
529
- // https://github.com/facebook/flipper/issues/2414
530
- if (Boolean(config.ios?.flipper) && config.ios?.useFrameworks !== undefined) {
531
- throw new Error('`ios.flipper` cannot be enabled when `ios.useFrameworks` is set.');
532
- }
533
-
534
630
  if (
535
631
  config.android?.enableShrinkResourcesInReleaseBuilds === true &&
536
632
  config.android?.enableProguardInReleaseBuilds !== true
@@ -4,7 +4,6 @@ import {
4
4
  withAndroidBuildProperties,
5
5
  withAndroidProguardRules,
6
6
  withAndroidPurgeProguardRulesOnce,
7
- withAndroidFlipper,
8
7
  withAndroidCleartextTraffic,
9
8
  withAndroidQueries,
10
9
  } from './android';
@@ -32,7 +31,6 @@ export const withBuildProperties: ConfigPlugin<PluginConfigType> = (config, prop
32
31
  // plugins order matter: the later one would run first
33
32
  config = withAndroidPurgeProguardRulesOnce(config);
34
33
 
35
- config = withAndroidFlipper(config, pluginConfig);
36
34
  config = withIosBuildProperties(config, pluginConfig);
37
35
  config = withIosDeploymentTarget(config, pluginConfig);
38
36