mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
[RN][Codegen] Better support filtering out non linked platforms (#48183)
This commit is contained in:
@@ -311,12 +311,27 @@ function findNotLinkedLibraries(projectRoot) {
|
||||
Object.keys(rnConfig.dependencies).forEach(name => {
|
||||
const dependency = rnConfig.dependencies[name];
|
||||
let notLinkedPlatforms = [];
|
||||
Object.keys(dependency.platforms).forEach(platform => {
|
||||
|
||||
// dependency.platforms might not be defined, as the format
|
||||
// {
|
||||
// "dependencies": {
|
||||
// "dependency-name": {
|
||||
// "root": "path/to/dependency",
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// is also supported.
|
||||
// In this case, we assume that the library is linked to all platforms.
|
||||
// We don't consider the case were `dependency-name.root` is equal to `null`, because that
|
||||
// means that the library is not linked to the app at all, and in that case the dependency
|
||||
// should be removed by the user.
|
||||
dependency.platforms && Object.keys(dependency.platforms).forEach(platform => {
|
||||
if (dependency.platforms[platform] == null) {
|
||||
notLinkedPlatforms.push(platform);
|
||||
}
|
||||
});
|
||||
notLinkedLibraries[name] = notLinkedPlatforms;
|
||||
|
||||
});
|
||||
return notLinkedLibraries;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user