Skip to content

Commit 96ffd35

Browse files
authored
Remove react-native commands from cli when installed as 'react-native-macos' (#227)
* Add logic to remove ios and android commands from react-native cli when installed as `react-native-macos` * Linted the js
1 parent 9bf2c75 commit 96ffd35

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

react-native.config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@
1111
const ios = require('@react-native-community/cli-platform-ios');
1212
const android = require('@react-native-community/cli-platform-android');
1313

14+
// Remove commands so that react-native-macos can coexist with react-native in repos that depend on both.
15+
const path = require('path');
16+
const isReactNativeMacOS = path.basename(__dirname) === 'react-native-macos';
17+
const iosCommands = isReactNativeMacOS ? [] : ios.commands;
18+
const androidCommands = isReactNativeMacOS ? [] : android.commands;
19+
1420
module.exports = {
15-
commands: [...ios.commands, ...android.commands],
21+
commands: [...iosCommands, ...androidCommands],
1622
platforms: {
1723
ios: {
1824
linkConfig: ios.linkConfig,

0 commit comments

Comments
 (0)