Skip to content

Conversation

@TMisiukiewicz
Copy link
Collaborator

@TMisiukiewicz TMisiukiewicz commented Jan 12, 2024

Summary:

fs.rm function does not expand, so when using clean command, Metro files are not removed.

This is a follow-up PR to #2161 which solves this problem for Windows, but since fs.rm does not expand at all, it still doesn't work properly for macOS. Removing OS check in this solution does not solve the issue, probably because convertPathToPattern from fast-glob modifies the pattern from metro-* to metro-\*. This PR should work correctly on both operating systems.

Closes #2161

Test Plan:

  1. Find your OS temp directory (os.tmpdir())
  2. Use start command in any CLI app
  3. ls in the temp directory to verify any metro-* are listed
  4. Use clean command, select metro option and confirm
  5. ls in the temp directory again and verify all metro-* are gone

Checklist

  • Documentation is up to date to reflect these changes.
  • Follows commit message convention described in CONTRIBUTING.md

Copy link
Collaborator

@szymonrybczak szymonrybczak left a comment

Choose a reason for hiding this comment

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

Works great on two platforms, LGTM 🙌

Comment on lines +42 to +48
glob(directory, {}, (err, foundDirectories) => {
if (err) {
reject(err);
} else {
resolve(foundDirectories);
}
});
Copy link
Member

Choose a reason for hiding this comment

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

doesn't glob have its promise interface?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it does, but starting from 9.0, and we are currently using 7.x across the project 😢

Copy link
Member

Choose a reason for hiding this comment

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

Let's upgrade it in a separate PR :D

@TMisiukiewicz TMisiukiewicz merged commit 4d79e33 into react-native-community:main Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants