-
Notifications
You must be signed in to change notification settings - Fork 904
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses a single code path to link and unlink all platforms
Summary: This commit removes special cases for linking iOS and Android platforms. A previous commit opened up link and other commands for other platforms to provide their own behaviors. It left special cases in tact for iOS and Android. This PR removes the special case. - Added jest tests related to the link command. - Ran the `link` and `unlink` commands for iOS and Android and confirmed no changes. facebook/react-native#17745 <!-- Help reviewers and the release process by writing your own release notes **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [-{Component}-] [ INTERNAL ] [ ENHANCEMENT ] [ {File} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| [CATEGORY] [TYPE] [LOCATION] - MESSAGE EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> [CLI][FEATURE][local-cli/link/link.js] - Removes special cases for linking in iOS and Android. Closes facebook/react-native#17961 Differential Revision: D6975951 Pulled By: hramos fbshipit-source-id: 8dd5da35619e2124ce4b3b18db8b694757792363
- Loading branch information
1 parent
142229b
commit cf01f22
Showing
13 changed files
with
97 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = function() { | ||
return { | ||
isInstalled: require('./isInstalled'), | ||
register: require('./registerNativeModule'), | ||
unregister: require('./unregisterNativeModule'), | ||
copyAssets: require('./copyAssets'), | ||
unlinkAssets: require('./unlinkAssets') | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const isInstalledIOS = require('../isInstalled'); | ||
const isInstalledPods = require('../../pods/isInstalled'); | ||
|
||
module.exports = function isInstalled(config, name) { | ||
return isInstalledIOS(config, name) || isInstalledPods(config, name); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const registerDependencyIOS = require('../registerNativeModule'); | ||
const registerDependencyPods = require('../../pods/registerNativeModule'); | ||
|
||
module.exports = function registerNativeModule( | ||
name, | ||
dependencyConfig, | ||
params, | ||
projectConfig | ||
) { | ||
if (projectConfig.podfile && dependencyConfig.podspec) { | ||
registerDependencyPods(name, dependencyConfig, projectConfig); | ||
} | ||
else { | ||
registerDependencyIOS(dependencyConfig, projectConfig); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const compact = require('lodash').compact; | ||
const isInstalledIOS = require('../isInstalled'); | ||
const isInstalledPods = require('../../pods/isInstalled'); | ||
const unregisterDependencyIOS = require('../registerNativeModule'); | ||
const unregisterDependencyPods = require('../../pods/registerNativeModule'); | ||
|
||
module.exports = function unregisterNativeModule( | ||
name, | ||
dependencyConfig, | ||
projectConfig, | ||
otherDependencies | ||
) { | ||
const isIosInstalled = isInstalledIOS(projectConfig, dependencyConfig); | ||
const isPodInstalled = isInstalledPods(projectConfig, dependencyConfig); | ||
if (isIosInstalled) { | ||
const iOSDependencies = compact(otherDependencies.map(d => d.config.ios)); | ||
unregisterDependencyIOS(dependencyConfig, projectConfig, iOSDependencies); | ||
} | ||
else if (isPodInstalled) { | ||
unregisterDependencyPods(dependencyConfig, projectConfig); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = function() { | ||
return { | ||
isInstalled: require('./common/isInstalled'), | ||
register: require('./common/registerNativeModule'), | ||
unregister: require('./common/unregisterNativeModule'), | ||
copyAssets: require('./copyAssets'), | ||
unlinkAssets: require('./unlinkAssets') | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.