Skip to content

Commit

Permalink
[RN][Codegen] Better support filtering out non linked platforms (#48183)
Browse files Browse the repository at this point in the history
  • Loading branch information
cipolleschi authored Dec 9, 2024
1 parent 93e9d57 commit fcbcf80
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit fcbcf80

Please sign in to comment.