Skip to content

Commit 2eace8e

Browse files
committed
simplify react-native.config.js
1 parent d3708a4 commit 2eace8e

File tree

1 file changed

+10
-45
lines changed

1 file changed

+10
-45
lines changed

react-native.config.js

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
const fs = require('fs');
22
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');
118

129
module.exports = {
1310
dependencies: {
@@ -41,49 +38,17 @@ module.exports = {
4138
project: {
4239
android: {
4340
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')
5443
),
5544
},
5645
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'),
7747
},
78-
windows: fs.existsSync(windowsProjectFile) && {
48+
windows: fs.existsSync('example/windows/AsyncStorageExample.sln') && {
7949
sourceDir: path.join('example', 'windows'),
8050
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')),
8752
},
8853
},
8954
};

0 commit comments

Comments
 (0)