diff --git a/package.json b/package.json index c0491a10..ed206520 100644 --- a/package.json +++ b/package.json @@ -88,7 +88,7 @@ "react-native": "^0.66.0-0", "react-native-builder-bob": "^0.18.0", "react-native-macos": "^0.66.0-0", - "react-native-test-app": "^1.2.1", + "react-native-test-app": "^1.3.4", "react-native-web": "^0.17.0", "react-native-windows": "^0.66.0-0", "react-test-renderer": "17.0.2", diff --git a/react-native.config.js b/react-native.config.js index 9a6402af..28f10f0d 100644 --- a/react-native.config.js +++ b/react-native.config.js @@ -1,10 +1,32 @@ -const fs = require('fs'); -const path = require('path'); -const { - androidManifestPath, - iosProjectPath, - windowsProjectPath, -} = require('react-native-test-app'); +const project = (() => { + const fs = require('fs'); + const path = require('path'); + try { + const { + androidManifestPath, + iosProjectPath, + windowsProjectPath, + } = require('react-native-test-app'); + return { + android: { + sourceDir: path.join('example', 'android'), + manifestPath: androidManifestPath( + path.join(__dirname, 'example', 'android') + ), + }, + ios: { + project: iosProjectPath('example/ios'), + }, + windows: fs.existsSync('example/windows/AsyncStorageExample.sln') && { + sourceDir: path.join('example', 'windows'), + solutionFile: 'AsyncStorageExample.sln', + project: windowsProjectPath(path.join(__dirname, 'example', 'windows')), + }, + }; + } catch (_) { + return undefined; + } +})(); module.exports = { dependencies: { @@ -35,20 +57,5 @@ module.exports = { }, }, }, - project: { - android: { - sourceDir: path.join('example', 'android'), - manifestPath: androidManifestPath( - path.join(__dirname, 'example', 'android') - ), - }, - ios: { - project: iosProjectPath('example/ios'), - }, - windows: fs.existsSync('example/windows/AsyncStorageExample.sln') && { - sourceDir: path.join('example', 'windows'), - solutionFile: 'AsyncStorageExample.sln', - project: windowsProjectPath(path.join(__dirname, 'example', 'windows')), - }, - }, + ...(project ? { project } : undefined), }; diff --git a/yarn.lock b/yarn.lock index 0e66bb97..8d1c2d4c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11224,10 +11224,10 @@ react-native-macos@^0.66.0-0: whatwg-fetch "^3.0.0" ws "^6.1.4" -react-native-test-app@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/react-native-test-app/-/react-native-test-app-1.2.1.tgz#1dcf1b3be57689b185e019eced91223d274bbe2e" - integrity sha512-+M0cps3k95JNdCvcrq2sXmblAOzG/Zv/6xU100kRS/wn5lL/3MHTkKq/0+BKiLB/ov5iHozGcB+Sn3FqezTuhw== +react-native-test-app@^1.3.4: + version "1.3.4" + resolved "https://registry.yarnpkg.com/react-native-test-app/-/react-native-test-app-1.3.4.tgz#d828620e93a8400c4502d1c15f7282f8922c3e47" + integrity sha512-+tdvSAXyKnpzq1EnILwMFS8AIETDW/Sahc+gaN4D9kQ0vB1C/OC0sC/ily5GMi1PokQI41xNktqOvq/V+Q4leA== dependencies: ajv "^8.0.0" chalk "^4.1.0"