|
1 | 1 | const fs = require('fs');
|
2 | 2 | const path = require('path');
|
3 |
| - |
4 |
| -const windowsProjectFile = path.join( |
5 |
| - 'node_modules', |
6 |
| - '.generated', |
7 |
| - 'windows', |
8 |
| - 'ReactTestApp', |
9 |
| - 'ReactTestApp.vcxproj' |
10 |
| -); |
| 3 | +const { |
| 4 | + androidManifestPath, |
| 5 | + iosProjectPath, |
| 6 | + windowsProjectPath, |
| 7 | +} = require('react-native-test-app'); |
11 | 8 |
|
12 | 9 | module.exports = {
|
13 | 10 | dependencies: {
|
@@ -41,49 +38,17 @@ module.exports = {
|
41 | 38 | project: {
|
42 | 39 | android: {
|
43 | 40 | sourceDir: path.join('example', 'android'),
|
44 |
| - manifestPath: path.relative( |
45 |
| - path.join(__dirname, 'example', 'android'), |
46 |
| - path.join( |
47 |
| - path.dirname(require.resolve('react-native-test-app/package.json')), |
48 |
| - 'android', |
49 |
| - 'app', |
50 |
| - 'src', |
51 |
| - 'main', |
52 |
| - 'AndroidManifest.xml', |
53 |
| - ), |
| 41 | + manifestPath: androidManifestPath( |
| 42 | + path.join(__dirname, 'example', 'android') |
54 | 43 | ),
|
55 | 44 | },
|
56 | 45 | ios: {
|
57 |
| - project: (() => { |
58 |
| - const { |
59 |
| - packageSatisfiesVersionRange, |
60 |
| - } = require('react-native-test-app/scripts/configure'); |
61 |
| - if ( |
62 |
| - packageSatisfiesVersionRange( |
63 |
| - '@react-native-community/cli-platform-ios', |
64 |
| - '<5.0.2', |
65 |
| - ) |
66 |
| - ) { |
67 |
| - // Prior to @react-native-community/cli-platform-ios v5.0.0, |
68 |
| - // `project` was only used to infer `sourceDir` and `podfile`. |
69 |
| - return 'example/ios/ReactTestApp-Dummy.xcodeproj'; |
70 |
| - } |
71 |
| - |
72 |
| - // `sourceDir` and `podfile` detection was fixed in |
73 |
| - // @react-native-community/cli-platform-ios v5.0.2 (see |
74 |
| - // https://github.com/react-native-community/cli/pull/1444). |
75 |
| - return 'node_modules/.generated/ios/ReactTestApp.xcodeproj'; |
76 |
| - })(), |
| 46 | + project: iosProjectPath('example/ios'), |
77 | 47 | },
|
78 |
| - windows: fs.existsSync(windowsProjectFile) && { |
| 48 | + windows: fs.existsSync('example/windows/AsyncStorageExample.sln') && { |
79 | 49 | sourceDir: path.join('example', 'windows'),
|
80 | 50 | solutionFile: 'AsyncStorageExample.sln',
|
81 |
| - project: { |
82 |
| - projectFile: path.relative( |
83 |
| - path.join(__dirname, 'example', 'windows'), |
84 |
| - windowsProjectFile, |
85 |
| - ), |
86 |
| - }, |
| 51 | + project: windowsProjectPath(path.join(__dirname, 'example', 'windows')), |
87 | 52 | },
|
88 | 53 | },
|
89 | 54 | };
|
0 commit comments