|
1 |
| -const fs = require('fs'); |
2 |
| -const path = require('path'); |
3 |
| -const { |
4 |
| - androidManifestPath, |
5 |
| - iosProjectPath, |
6 |
| - windowsProjectPath, |
7 |
| -} = require('react-native-test-app'); |
| 1 | +const project = (() => { |
| 2 | + const fs = require('fs'); |
| 3 | + const path = require('path'); |
| 4 | + try { |
| 5 | + const { |
| 6 | + androidManifestPath, |
| 7 | + iosProjectPath, |
| 8 | + windowsProjectPath, |
| 9 | + } = require('react-native-test-app'); |
| 10 | + return { |
| 11 | + android: { |
| 12 | + sourceDir: path.join('example', 'android'), |
| 13 | + manifestPath: androidManifestPath( |
| 14 | + path.join(__dirname, 'example', 'android') |
| 15 | + ), |
| 16 | + }, |
| 17 | + ios: { |
| 18 | + project: iosProjectPath('example/ios'), |
| 19 | + }, |
| 20 | + windows: fs.existsSync('example/windows/AsyncStorageExample.sln') && { |
| 21 | + sourceDir: path.join('example', 'windows'), |
| 22 | + solutionFile: 'AsyncStorageExample.sln', |
| 23 | + project: windowsProjectPath(path.join(__dirname, 'example', 'windows')), |
| 24 | + }, |
| 25 | + }; |
| 26 | + } catch (_) { |
| 27 | + return undefined; |
| 28 | + } |
| 29 | +})(); |
8 | 30 |
|
9 | 31 | module.exports = {
|
10 | 32 | dependencies: {
|
@@ -35,20 +57,5 @@ module.exports = {
|
35 | 57 | },
|
36 | 58 | },
|
37 | 59 | },
|
38 |
| - project: { |
39 |
| - android: { |
40 |
| - sourceDir: path.join('example', 'android'), |
41 |
| - manifestPath: androidManifestPath( |
42 |
| - path.join(__dirname, 'example', 'android') |
43 |
| - ), |
44 |
| - }, |
45 |
| - ios: { |
46 |
| - project: iosProjectPath('example/ios'), |
47 |
| - }, |
48 |
| - windows: fs.existsSync('example/windows/AsyncStorageExample.sln') && { |
49 |
| - sourceDir: path.join('example', 'windows'), |
50 |
| - solutionFile: 'AsyncStorageExample.sln', |
51 |
| - project: windowsProjectPath(path.join(__dirname, 'example', 'windows')), |
52 |
| - }, |
53 |
| - }, |
| 60 | + ...(project ? { project } : undefined), |
54 | 61 | };
|
0 commit comments