Skip to content

Conversation

@mani3xis
Copy link
Contributor

I'm in the process of fixing some errors that I'm getting after integrating major changes from main, and while looking for the root-cause of those issues, I decided to do some minor code cleanups and simplifications while visiting some of the files.

This PR will leave the DRAFT status as I fix all the issues.

@mani3xis mani3xis self-assigned this Jun 17, 2025
@changeset-bot
Copy link

changeset-bot bot commented Jun 17, 2025

⚠️ No Changeset found

Latest commit: 241f830

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

This change attempts to separate the Xcframework linking logic from the directory iteration by extracting the "glob-like" function out. This change also opens the door for easier migration to a proper glob() function.
withFileTypes: true,
})
// Following extracted function mimics `glob("*/*.framework/")`
function globFrameworkDirs<T>(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this can be moved to path-utils

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this also applies a side-effect, it feels to me that it's doing a bit more than simply globbing?

Perhaps

Suggested change
function globFrameworkDirs<T>(
function globAndPrepareFrameworks<T>(

@mani3xis mani3xis marked this pull request as ready for review June 17, 2025 16:20
@mani3xis mani3xis changed the title [DRAFT] Simplify source code while visiting few cli/ sources Simplify source code while visiting few cli/ sources Jun 17, 2025
// Expect the library in the new location
assert(fs.existsSync(newLibraryPath));
// Update the binary
await spawn(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: imho this should be extracted to a separate function

@mani3xis mani3xis requested a review from kraenhansen June 17, 2025 19:00
path.join(dependency.path, modulePath)
);
}
const absoluteModulePaths = Object.values(dependenciesByName).flatMap(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💙

} else {
throw error;
}
absoluteModulePaths.map(async (originalPath) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💙

// Following extracted function mimics `glob("*/*.framework/")`
function globFrameworkDirs<T>(
startPath: string,
fn: (parentPath: string, name: string) => Promise<T>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we pick a more semantic name for this argument? It's like an action performed on every triplet + framework.

Copy link
Collaborator

@kraenhansen kraenhansen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not feeling strongly for any of my suggestions: Merge at will 👍

@mani3xis mani3xis merged commit ea0b560 into main Jun 20, 2025
4 checks passed
@mani3xis mani3xis deleted the mario/simplify-link-modules branch June 20, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants