expo-modules-autolinking 1.3.0 → 1.5.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,6 +10,19 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 1.5.0 — 2023-06-21
14
+
15
+ ### 🎉 New features
16
+
17
+ - Added support for React Native 0.72. ([#22588](https://github.com/expo/expo/pull/22588) by [@kudo](https://github.com/kudo))
18
+ - Added extra CocoaPods dependencies and Maven repositories from `expo-build-properties`. ([#22785](https://github.com/expo/expo/pull/22785) by [@kudo](https://github.com/kudo))
19
+
20
+ ## 1.4.0 — 2023-06-13
21
+
22
+ ### 🎉 New features
23
+
24
+ - Added support for React Native 0.72. ([#22588](https://github.com/expo/expo/pull/22588) by [@kudo](https://github.com/kudo))
25
+
13
26
  ## 1.3.0 — 2023-05-08
14
27
 
15
28
  ### 🎉 New features
@@ -0,0 +1,30 @@
1
+ interface AndroidMavenRepository {
2
+ url: string;
3
+ }
4
+ interface IosPod {
5
+ name: string;
6
+ version?: string;
7
+ configurations?: string[];
8
+ modular_headers?: boolean;
9
+ source?: string;
10
+ path?: string;
11
+ podspec?: string;
12
+ testspecs?: string[];
13
+ git?: string;
14
+ branch?: string;
15
+ tag?: string;
16
+ commit?: string;
17
+ }
18
+ interface ExtraDependencies {
19
+ androidMavenRepos: AndroidMavenRepository[];
20
+ iosPods?: IosPod[];
21
+ }
22
+ /**
23
+ * Gets the `expo-build-properties` settings from the app config.
24
+ */
25
+ export declare function getBuildPropertiesAsync(): Promise<Record<string, any>>;
26
+ /**
27
+ * Resolves the extra dependencies from `expo-build-properties` settings.
28
+ */
29
+ export declare function resolveExtraDependenciesAsync(): Promise<Partial<ExtraDependencies>>;
30
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.resolveExtraDependenciesAsync = exports.getBuildPropertiesAsync = void 0;
7
+ const config_1 = require("@expo/config");
8
+ const path_1 = __importDefault(require("path"));
9
+ const mergeLinkingOptions_1 = require("./mergeLinkingOptions");
10
+ /**
11
+ * Gets the `expo-build-properties` settings from the app config.
12
+ */
13
+ async function getBuildPropertiesAsync() {
14
+ const projectRoot = path_1.default.dirname(mergeLinkingOptions_1.projectPackageJsonPath);
15
+ const { exp: config } = await (0, config_1.getConfig)(projectRoot, { skipSDKVersionRequirement: true });
16
+ const buildPropertiesPlugin = config.plugins?.find((item) => item[0] === 'expo-build-properties')?.[1];
17
+ return buildPropertiesPlugin ?? {};
18
+ }
19
+ exports.getBuildPropertiesAsync = getBuildPropertiesAsync;
20
+ /**
21
+ * Resolves the extra dependencies from `expo-build-properties` settings.
22
+ */
23
+ async function resolveExtraDependenciesAsync() {
24
+ const buildProps = await getBuildPropertiesAsync();
25
+ return {
26
+ androidMavenRepos: buildProps.android?.extraMavenRepos ?? [],
27
+ iosPods: buildProps.ios?.extraPods ?? {},
28
+ };
29
+ }
30
+ exports.resolveExtraDependenciesAsync = resolveExtraDependenciesAsync;
31
+ //# sourceMappingURL=extraDependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extraDependencies.js","sourceRoot":"","sources":["../../src/autolinking/extraDependencies.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAyC;AACzC,gDAAwB;AAExB,+DAA+D;AA0B/D;;GAEG;AACI,KAAK,UAAU,uBAAuB;IAC3C,MAAM,WAAW,GAAG,cAAI,CAAC,OAAO,CAAC,4CAAsB,CAAC,CAAC;IACzD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,kBAAS,EAAC,WAAW,EAAE,EAAE,yBAAyB,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1F,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,EAAE,IAAI,CAChD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,uBAAuB,CAC9C,EAAE,CAAC,CAAC,CAAC,CAAC;IACP,OAAO,qBAAqB,IAAI,EAAE,CAAC;AACrC,CAAC;AAPD,0DAOC;AAED;;GAEG;AACI,KAAK,UAAU,6BAA6B;IACjD,MAAM,UAAU,GAAG,MAAM,uBAAuB,EAAE,CAAC;IACnD,OAAO;QACL,iBAAiB,EAAE,UAAU,CAAC,OAAO,EAAE,eAAe,IAAI,EAAE;QAC5D,OAAO,EAAE,UAAU,CAAC,GAAG,EAAE,SAAS,IAAI,EAAE;KACzC,CAAC;AACJ,CAAC;AAND,sEAMC","sourcesContent":["import { getConfig } from '@expo/config';\nimport path from 'path';\n\nimport { projectPackageJsonPath } from './mergeLinkingOptions';\n\ninterface AndroidMavenRepository {\n url: string;\n}\n\ninterface IosPod {\n name: string;\n version?: string;\n configurations?: string[];\n modular_headers?: boolean;\n source?: string;\n path?: string;\n podspec?: string;\n testspecs?: string[];\n git?: string;\n branch?: string;\n tag?: string;\n commit?: string;\n}\n\ninterface ExtraDependencies {\n androidMavenRepos: AndroidMavenRepository[];\n iosPods?: IosPod[];\n}\n\n/**\n * Gets the `expo-build-properties` settings from the app config.\n */\nexport async function getBuildPropertiesAsync(): Promise<Record<string, any>> {\n const projectRoot = path.dirname(projectPackageJsonPath);\n const { exp: config } = await getConfig(projectRoot, { skipSDKVersionRequirement: true });\n const buildPropertiesPlugin = config.plugins?.find(\n (item) => item[0] === 'expo-build-properties'\n )?.[1];\n return buildPropertiesPlugin ?? {};\n}\n\n/**\n * Resolves the extra dependencies from `expo-build-properties` settings.\n */\nexport async function resolveExtraDependenciesAsync(): Promise<Partial<ExtraDependencies>> {\n const buildProps = await getBuildPropertiesAsync();\n return {\n androidMavenRepos: buildProps.android?.extraMavenRepos ?? [],\n iosPods: buildProps.ios?.extraPods ?? {},\n };\n}\n"]}
package/build/index.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const commander_1 = __importDefault(require("commander"));
7
7
  const ReactImportsPatcher_1 = require("./ReactImportsPatcher");
8
8
  const autolinking_1 = require("./autolinking");
9
+ const extraDependencies_1 = require("./autolinking/extraDependencies");
9
10
  /**
10
11
  * Registers a command that only searches for available expo modules.
11
12
  */
@@ -59,11 +60,12 @@ module.exports = async function (args) {
59
60
  // Searches for available expo modules and resolves the results for given platform.
60
61
  registerResolveCommand('resolve', async (results, options) => {
61
62
  const modules = await (0, autolinking_1.resolveModulesAsync)(results, options);
63
+ const extraDependencies = await (0, extraDependencies_1.resolveExtraDependenciesAsync)();
62
64
  if (options.json) {
63
- console.log(JSON.stringify({ modules }));
65
+ console.log(JSON.stringify({ extraDependencies, modules }));
64
66
  }
65
67
  else {
66
- console.log(require('util').inspect({ modules }, false, null, true));
68
+ console.log(require('util').inspect({ extraDependencies, modules }, false, null, true));
67
69
  }
68
70
  }).option('-j, --json', 'Output results in the plain JSON format.', () => true, false);
69
71
  // Generates a source file listing all packages to link.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAElC,+DAA+D;AAC/D,+CAMuB;AAGvB;;GAEG;AACH,SAAS,qBAAqB,CAC5B,WAAmB,EACnB,EAAwD;IAExD,OAAO,mBAAS;SACb,OAAO,CAAC,GAAG,WAAW,aAAa,CAAC;SACpC,MAAM,CACL,qCAAqC,EACrC,8CAA8C,EAC9C,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACpD;SACA,MAAM,CACL,4BAA4B,EAC5B,uDAAuD,EACvD,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACpD;SACA,MAAM,CACL,2BAA2B,E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6BAA6B,EAC7B,kEAAkE,CACnE;SACA,MAAM,CACL,SAAS,EACT,8FAA8F,EAC9F,KAAK,CACN,CAAC;IAEJ,gCAAgC,EAAE,CAAC;IAEnC,MAAM,mBAAS;SACZ,OAAO,CAAC,OAAO,CAAC,uCAAuC,CAAC,CAAC,OAAO,CAAC;SACjE,WAAW,CAAC,8DAA8D,CAAC;SAC3E,UAAU,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import commander from 'commander';\n\nimport { patchReactImportsAsync } from './ReactImportsPatcher';\nimport {\n findModulesAsync,\n resolveModulesAsync,\n verifySearchResults,\n generatePackageListAsync,\n mergeLinkingOptionsAsync,\n} from './autolinking';\nimport { GenerateOptions, ResolveOptions, SearchOptions, SearchResults } from './types';\n\n/**\n * Registers a command that only searches for available expo modules.\n */\nfunction registerSearchCommand<OptionsType extends SearchOptions>(\n commandName: string,\n fn: (search: SearchResults, options: OptionsType) => any\n) {\n return commander\n .command(`${commandName} [paths...]`)\n .option<string[] | null>(\n '-i, --ignore-paths <ignorePaths...>',\n 'Paths to ignore when looking up for modules.',\n (value, previous) => (previous ?? []).concat(value)\n )\n .option<string[] | null>(\n '-e, --exclude <exclude...>',\n 'Package names to exclude when looking up for modules.',\n (value, previous) => (previous ?? []).concat(value)\n )\n .option(\n '-p, --platform [platform]',\n 'The platform that the resulting modules must support. Available options: \"ios\", \"android\"',\n 'ios'\n )\n .option('--silent', 'Silence resolution warnings')\n .action(async (searchPaths, providedOptions) => {\n const options = await mergeLinkingOptionsAsync<OptionsType>({\n ...providedOptions,\n searchPaths,\n });\n const searchResults = await findModulesAsync(options);\n return await fn(searchResults, options);\n });\n}\n\n/**\n * Registers a command that searches for modules and then resolves them for specific platform.\n */\nfunction registerResolveCommand<OptionsType extends ResolveOptions>(\n commandName: string,\n fn: (search: SearchResults, options: OptionsType) => any\n) {\n return registerSearchCommand<OptionsType>(commandName, fn);\n}\n\n// Register for `patch-react-imports` command\nfunction registerPatchReactImportsCommand() {\n return commander\n .command('patch-react-imports [paths...]')\n .requiredOption('--pods-root <podsRoot>', 'The path to `Pods` directory')\n .option('--dry-run', 'Only list files without writing changes to the file system')\n .action(patchReactImportsAsync);\n}\n\nmodule.exports = async function (args: string[]) {\n // Searches for available expo modules.\n registerSearchCommand<SearchOptions & { json?: boolean }>('search', async (results, options) => {\n if (options.json) {\n console.log(JSON.stringify(results));\n } else {\n console.log(require('util').inspect(results, false, null, true));\n }\n }).option<boolean>('-j, --json', 'Output results in the plain JSON format.', () => true, false);\n\n // Checks whether there are no resolving issues in the current setup.\n registerSearchCommand('verify', (results) => {\n const numberOfDuplicates = verifySearchResults(results);\n if (!numberOfDuplicates) {\n console.log('✅ Everything is fine!');\n }\n });\n\n // Searches for available expo modules and resolves the results for given platform.\n registerResolveCommand('resolve', async (results, options) => {\n const modules = await resolveModulesAsync(results, options);\n\n if (options.json) {\n console.log(JSON.stringify({ modules }));\n } else {\n console.log(require('util').inspect({ modules }, false, null, true));\n }\n }).option<boolean>('-j, --json', 'Output results in the plain JSON format.', () => true, false);\n\n // Generates a source file listing all packages to link.\n registerResolveCommand<GenerateOptions>('generate-package-list', async (results, options) => {\n const modules = options.empty ? [] : await resolveModulesAsync(results, options);\n generatePackageListAsync(modules, options);\n })\n .option(\n '-t, --target <path>',\n 'Path to the target file, where the package list should be written to.'\n )\n .option(\n '-n, --namespace <namespace>',\n 'Java package name under which the package list should be placed.'\n )\n .option(\n '--empty',\n 'Whether to only generate an empty list. Might be used when the user opts-out of autolinking.',\n false\n );\n\n registerPatchReactImportsCommand();\n\n await commander\n .version(require('expo-modules-autolinking/package.json').version)\n .description('CLI command that searches for Expo modules to autolink them.')\n .parseAsync(args, { from: 'user' });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,0DAAkC;AAElC,+DAA+D;AAC/D,+CAMuB;AACvB,uEAA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OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;SACzF;IACH,CAAC,CAAC,CAAC,MAAM,CAAU,YAAY,EAAE,0CAA0C,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAEhG,wDAAwD;IACxD,sBAAsB,CAAkB,uBAAuB,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QAC1F,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,IAAA,iCAAmB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjF,IAAA,sCAAwB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC;SACC,MAAM,CACL,qBAAqB,EACrB,uEAAuE,CACxE;SACA,MAAM,CACL,6BAA6B,EAC7B,kEAAkE,CACnE;SACA,MAAM,CACL,SAAS,EACT,8FAA8F,EAC9F,KAAK,CACN,CAAC;IAEJ,gCAAgC,EAAE,CAAC;IAEnC,MAAM,mBAAS;SACZ,OAAO,CAAC,OAAO,CAAC,uCAAuC,CAAC,CAAC,OAAO,CAAC;SACjE,WAAW,CAAC,8DAA8D,CAAC;SAC3E,UAAU,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import commander from 'commander';\n\nimport { patchReactImportsAsync } from './ReactImportsPatcher';\nimport {\n findModulesAsync,\n resolveModulesAsync,\n verifySearchResults,\n generatePackageListAsync,\n mergeLinkingOptionsAsync,\n} from './autolinking';\nimport { resolveExtraDependenciesAsync } from './autolinking/extraDependencies';\nimport { GenerateOptions, ResolveOptions, SearchOptions, SearchResults } from './types';\n\n/**\n * Registers a command that only searches for available expo modules.\n */\nfunction registerSearchCommand<OptionsType extends SearchOptions>(\n commandName: string,\n fn: (search: SearchResults, options: OptionsType) => any\n) {\n return commander\n .command(`${commandName} [paths...]`)\n .option<string[] | null>(\n '-i, --ignore-paths <ignorePaths...>',\n 'Paths to ignore when looking up for modules.',\n (value, previous) => (previous ?? []).concat(value)\n )\n .option<string[] | null>(\n '-e, --exclude <exclude...>',\n 'Package names to exclude when looking up for modules.',\n (value, previous) => (previous ?? []).concat(value)\n )\n .option(\n '-p, --platform [platform]',\n 'The platform that the resulting modules must support. Available options: \"ios\", \"android\"',\n 'ios'\n )\n .option('--silent', 'Silence resolution warnings')\n .action(async (searchPaths, providedOptions) => {\n const options = await mergeLinkingOptionsAsync<OptionsType>({\n ...providedOptions,\n searchPaths,\n });\n const searchResults = await findModulesAsync(options);\n return await fn(searchResults, options);\n });\n}\n\n/**\n * Registers a command that searches for modules and then resolves them for specific platform.\n */\nfunction registerResolveCommand<OptionsType extends ResolveOptions>(\n commandName: string,\n fn: (search: SearchResults, options: OptionsType) => any\n) {\n return registerSearchCommand<OptionsType>(commandName, fn);\n}\n\n// Register for `patch-react-imports` command\nfunction registerPatchReactImportsCommand() {\n return commander\n .command('patch-react-imports [paths...]')\n .requiredOption('--pods-root <podsRoot>', 'The path to `Pods` directory')\n .option('--dry-run', 'Only list files without writing changes to the file system')\n .action(patchReactImportsAsync);\n}\n\nmodule.exports = async function (args: string[]) {\n // Searches for available expo modules.\n registerSearchCommand<SearchOptions & { json?: boolean }>('search', async (results, options) => {\n if (options.json) {\n console.log(JSON.stringify(results));\n } else {\n console.log(require('util').inspect(results, false, null, true));\n }\n }).option<boolean>('-j, --json', 'Output results in the plain JSON format.', () => true, false);\n\n // Checks whether there are no resolving issues in the current setup.\n registerSearchCommand('verify', (results) => {\n const numberOfDuplicates = verifySearchResults(results);\n if (!numberOfDuplicates) {\n console.log('✅ Everything is fine!');\n }\n });\n\n // Searches for available expo modules and resolves the results for given platform.\n registerResolveCommand('resolve', async (results, options) => {\n const modules = await resolveModulesAsync(results, options);\n const extraDependencies = await resolveExtraDependenciesAsync();\n\n if (options.json) {\n console.log(JSON.stringify({ extraDependencies, modules }));\n } else {\n console.log(require('util').inspect({ extraDependencies, modules }, false, null, true));\n }\n }).option<boolean>('-j, --json', 'Output results in the plain JSON format.', () => true, false);\n\n // Generates a source file listing all packages to link.\n registerResolveCommand<GenerateOptions>('generate-package-list', async (results, options) => {\n const modules = options.empty ? [] : await resolveModulesAsync(results, options);\n generatePackageListAsync(modules, options);\n })\n .option(\n '-t, --target <path>',\n 'Path to the target file, where the package list should be written to.'\n )\n .option(\n '-n, --namespace <namespace>',\n 'Java package name under which the package list should be placed.'\n )\n .option(\n '--empty',\n 'Whether to only generate an empty list. Might be used when the user opts-out of autolinking.',\n false\n );\n\n registerPatchReactImportsCommand();\n\n await commander\n .version(require('expo-modules-autolinking/package.json').version)\n .description('CLI command that searches for Expo modules to autolink them.')\n .parseAsync(args, { from: 'user' });\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-autolinking",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Scripts that autolink Expo modules.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -42,11 +42,12 @@
42
42
  "tempy": "^0.7.1"
43
43
  },
44
44
  "dependencies": {
45
+ "@expo/config": "~8.1.0",
45
46
  "chalk": "^4.1.0",
46
47
  "commander": "^7.2.0",
47
48
  "fast-glob": "^3.2.5",
48
49
  "find-up": "^5.0.0",
49
50
  "fs-extra": "^9.1.0"
50
51
  },
51
- "gitHead": "4ba50c428c8369bb6b3a51a860d4898ad4ccbe78"
52
+ "gitHead": "fa5ecca8251986b9f197cc14074eec0ab6dfb6db"
52
53
  }
@@ -56,6 +56,15 @@ class ExpoModule {
56
56
  }
57
57
  }
58
58
 
59
+ // Object representing a maven repository.
60
+ class MavenRepo {
61
+ String url
62
+
63
+ MavenRepo(Object data) {
64
+ this.url = data
65
+ }
66
+ }
67
+
59
68
  class ExpoAutolinkingManager {
60
69
  private File projectDir
61
70
  private Map options
@@ -93,6 +102,11 @@ class ExpoAutolinkingManager {
93
102
  return json.modules.collect { new ExpoModule(it) }
94
103
  }
95
104
 
105
+ MavenRepo[] getExtraMavenRepos() {
106
+ Object json = resolve()
107
+ return json.extraDependencies.androidMavenRepos.collect { new MavenRepo(it) }
108
+ }
109
+
96
110
  static void generatePackageList(Project project, Map options) {
97
111
  String[] args = convertOptionsToCommandArgs('generate-package-list', options)
98
112
 
@@ -186,6 +200,7 @@ if (rootProject instanceof ProjectDescriptor) {
186
200
  ext.useExpoModules = { Map options = [:] ->
187
201
  ExpoAutolinkingManager manager = new ExpoAutolinkingManager(rootProject.projectDir, options)
188
202
  ExpoModule[] modules = manager.getModules()
203
+ MavenRepo[] extraMavenRepos = manager.getExtraMavenRepos()
189
204
 
190
205
  for (module in modules) {
191
206
  for (moduleProject in module.projects) {
@@ -197,12 +212,27 @@ if (rootProject instanceof ProjectDescriptor) {
197
212
  }
198
213
  }
199
214
 
200
- // Add plugin classpath to the root project
201
215
  gradle.beforeProject { project ->
202
- if (project === project.rootProject) {
203
- for (module in modules) {
204
- for (modulePlugin in module.plugins) {
205
- project.buildscript.dependencies.add('classpath', "${modulePlugin.group}:${modulePlugin.id}")
216
+ if (project !== project.rootProject) {
217
+ return
218
+ }
219
+ def rootProject = project
220
+
221
+ // Add plugin classpath to the root project
222
+ for (module in modules) {
223
+ for (modulePlugin in module.plugins) {
224
+ rootProject.buildscript.dependencies.add('classpath', "${modulePlugin.group}:${modulePlugin.id}")
225
+ }
226
+ }
227
+
228
+ // Add extra maven repositories to allprojects
229
+ for (mavenRepo in extraMavenRepos) {
230
+ println "Adding extra maven repository - '${mavenRepo.url}'"
231
+ }
232
+ rootProject.allprojects { eachProject ->
233
+ eachProject.repositories {
234
+ for (mavenRepo in extraMavenRepos) {
235
+ maven { url = mavenRepo.url }
206
236
  }
207
237
  }
208
238
  }
@@ -17,7 +17,9 @@ module Expo
17
17
  @podfile = podfile
18
18
  @target_definition = target_definition
19
19
  @options = options
20
- @packages = resolve()['modules'].map { |json_package| Package.new(json_package) }
20
+ resolve_result = resolve()
21
+ @packages = resolve_result['modules'].map { |json_package| Package.new(json_package) }
22
+ @extraPods = resolve_result['extraDependencies']['iosPods']
21
23
  end
22
24
 
23
25
  public def use_expo_modules!
@@ -80,6 +82,25 @@ module Expo
80
82
  }
81
83
  }
82
84
  end
85
+
86
+ @extraPods.each { |pod|
87
+ UI.info "Adding extra pod - #{pod['name']} (#{pod['version'] || '*'})"
88
+ requirements = Array.new
89
+ requirements << pod['version'] if pod['version']
90
+ options = Hash.new
91
+ options[:configurations] = pod['configurations'] if pod['configurations']
92
+ options[:modular_headers] = pod['modular_headers'] if pod['modular_headers']
93
+ options[:source] = pod['source'] if pod['source']
94
+ options[:path] = pod['path'] if pod['path']
95
+ options[:podspec] = pod['podspec'] if pod['podspec']
96
+ options[:testspecs] = pod['testspecs'] if pod['testspecs']
97
+ options[:git] = pod['git'] if pod['git']
98
+ options[:branch] = pod['branch'] if pod['branch']
99
+ options[:tag] = pod['tag'] if pod['tag']
100
+ options[:commit] = pod['commit'] if pod['commit']
101
+ requirements << options
102
+ @podfile.pod(pod['name'], *requirements)
103
+ }
83
104
  self
84
105
  end
85
106
 
@@ -3,6 +3,17 @@
3
3
 
4
4
  require 'json'
5
5
 
6
+ REACT_DEFINE_MODULES_LIST = [
7
+ 'ReactCommon',
8
+ 'React-RCTAppDelegate',
9
+ 'React-hermes',
10
+ 'React-jsc',
11
+ 'React-Fabric',
12
+ 'React-graphics',
13
+ 'React-utils',
14
+ 'React-debug',
15
+ ]
16
+
6
17
  module Pod
7
18
  class Sandbox
8
19
  private
@@ -35,7 +46,7 @@ module Pod
35
46
  patched_spec = Specification.from_json(spec_json.to_json)
36
47
 
37
48
  # Patch podspecs to define module
38
- elsif ['ReactCommon', 'React-RCTAppDelegate', 'React-hermes', 'React-jsc'].include? name
49
+ elsif REACT_DEFINE_MODULES_LIST.include? name
39
50
  spec_json = JSON.parse(podspec.to_pretty_json)
40
51
  spec_json['pod_target_xcconfig'] ||= {}
41
52
  spec_json['pod_target_xcconfig']['DEFINES_MODULE'] = 'YES'
@@ -0,0 +1,51 @@
1
+ import { getConfig } from '@expo/config';
2
+ import path from 'path';
3
+
4
+ import { projectPackageJsonPath } from './mergeLinkingOptions';
5
+
6
+ interface AndroidMavenRepository {
7
+ url: string;
8
+ }
9
+
10
+ interface IosPod {
11
+ name: string;
12
+ version?: string;
13
+ configurations?: string[];
14
+ modular_headers?: boolean;
15
+ source?: string;
16
+ path?: string;
17
+ podspec?: string;
18
+ testspecs?: string[];
19
+ git?: string;
20
+ branch?: string;
21
+ tag?: string;
22
+ commit?: string;
23
+ }
24
+
25
+ interface ExtraDependencies {
26
+ androidMavenRepos: AndroidMavenRepository[];
27
+ iosPods?: IosPod[];
28
+ }
29
+
30
+ /**
31
+ * Gets the `expo-build-properties` settings from the app config.
32
+ */
33
+ export async function getBuildPropertiesAsync(): Promise<Record<string, any>> {
34
+ const projectRoot = path.dirname(projectPackageJsonPath);
35
+ const { exp: config } = await getConfig(projectRoot, { skipSDKVersionRequirement: true });
36
+ const buildPropertiesPlugin = config.plugins?.find(
37
+ (item) => item[0] === 'expo-build-properties'
38
+ )?.[1];
39
+ return buildPropertiesPlugin ?? {};
40
+ }
41
+
42
+ /**
43
+ * Resolves the extra dependencies from `expo-build-properties` settings.
44
+ */
45
+ export async function resolveExtraDependenciesAsync(): Promise<Partial<ExtraDependencies>> {
46
+ const buildProps = await getBuildPropertiesAsync();
47
+ return {
48
+ androidMavenRepos: buildProps.android?.extraMavenRepos ?? [],
49
+ iosPods: buildProps.ios?.extraPods ?? {},
50
+ };
51
+ }
package/src/index.ts CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  generatePackageListAsync,
9
9
  mergeLinkingOptionsAsync,
10
10
  } from './autolinking';
11
+ import { resolveExtraDependenciesAsync } from './autolinking/extraDependencies';
11
12
  import { GenerateOptions, ResolveOptions, SearchOptions, SearchResults } from './types';
12
13
 
13
14
  /**
@@ -85,11 +86,12 @@ module.exports = async function (args: string[]) {
85
86
  // Searches for available expo modules and resolves the results for given platform.
86
87
  registerResolveCommand('resolve', async (results, options) => {
87
88
  const modules = await resolveModulesAsync(results, options);
89
+ const extraDependencies = await resolveExtraDependenciesAsync();
88
90
 
89
91
  if (options.json) {
90
- console.log(JSON.stringify({ modules }));
92
+ console.log(JSON.stringify({ extraDependencies, modules }));
91
93
  } else {
92
- console.log(require('util').inspect({ modules }, false, null, true));
94
+ console.log(require('util').inspect({ extraDependencies, modules }, false, null, true));
93
95
  }
94
96
  }).option<boolean>('-j, --json', 'Output results in the plain JSON format.', () => true, false);
95
97