Move prettyPath to cli-utils package#279
Merged
kraenhansen merged 3 commits intomainfrom Oct 21, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the prettyPath utility function by moving it from the host package to the cli-utils package, making it available for reuse across all CLI tooling packages in the monorepo.
Key changes:
- Moved
prettyPathfunction fromhost/src/node/path-utils.tstocli-utils/src/paths.ts - Updated all import statements across 8 files to use the centralized implementation
- Replaced inline path formatting logic with
prettyPathcalls for consistency
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/cli-utils/src/paths.ts | New file containing the prettyPath utility function moved from host package |
| packages/cli-utils/src/index.ts | Exports the new paths module |
| packages/host/src/node/path-utils.ts | Removed prettyPath function and added import from cli-utils |
| packages/host/src/node/index.ts | Removed prettyPath from exports |
| packages/host/src/node/cli/program.ts | Updated import to use cli-utils instead of path-utils |
| packages/host/src/node/cli/link-modules.ts | Updated import to use cli-utils instead of path-utils |
| packages/host/src/node/cli/hermes.ts | Updated import to use cli-utils instead of path-utils |
| packages/gyp-to-cmake/src/cli.ts | Added prettyPath import and improved log message formatting |
| packages/ferric/src/build.ts | Replaced inline path formatting with prettyPath call |
| packages/cmake-rn/src/platforms/apple.ts | Replaced inline path formatting with prettyPath call |
| packages/cmake-rn/src/platforms/android.ts | Replaced inline path formatting with prettyPath call |
Comment on lines
+37
to
+41
| console.log( | ||
| `Transforming ${prettyPath(gypPath)} → ${prettyPath(cmakeListsPath)}`, | ||
| ); | ||
|
|
||
| const gyp = readBindingFile(gypPath, disallowUnknownProperties); |
There was a problem hiding this comment.
The cmakeListsPath is now computed before reading the gyp file, but it's only used after the transformation. If readBindingFile throws an error, the user will see the transformation message without any transformation actually being attempted. Consider moving the log statement after readBindingFile to ensure the file can be read before announcing the transformation.
Suggested change
| console.log( | |
| `Transforming ${prettyPath(gypPath)} → ${prettyPath(cmakeListsPath)}`, | |
| ); | |
| const gyp = readBindingFile(gypPath, disallowUnknownProperties); | |
| const gyp = readBindingFile(gypPath, disallowUnknownProperties); | |
| console.log( | |
| `Transforming ${prettyPath(gypPath)} → ${prettyPath(cmakeListsPath)}`, | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This was used across CLIs so it seems more appropriate to move it into the common CLI utils package.