Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RN][Codegen] Better support filtering out non linked platforms #48183

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading