Skip to content

Conversation

@kraenhansen
Copy link
Collaborator

In the case of duplicate library names when failing react-native-node-api link all libraries would be printed with no obvious visualization on what libraries were actually duplicates.

Merging this PR will:

  • Refactor the code visualizing library maps and re-use more of the path utils in the CLI.

@kraenhansen kraenhansen self-assigned this Oct 23, 2025
@kraenhansen kraenhansen added the bug Something isn't working label Oct 23, 2025
@kraenhansen kraenhansen requested a review from Copilot October 23, 2025 11:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the duplicate library name visualization in the CLI to make it clearer which libraries are actually duplicated when react-native-node-api link fails.

Key changes:

  • Refactored library map visualization logic into reusable functions
  • Improved error messaging to show only duplicated libraries instead of all libraries

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/host/src/node/path-utils.ts Extracted getLibraryMap and visualizeLibraryMap functions, removed duplicate detection logic
packages/host/src/node/duplicates.ts Deleted file containing generic findDuplicates utility
packages/host/src/node/cli/program.ts Updated to use new getLibraryMap and visualizeLibraryMap functions
packages/host/src/node/cli/link-modules.ts Replaced hasDuplicateLibraryNames with inline duplicate detection, improved error message to show only duplicates


export function getLibraryMap(
modulePaths: string[],
// TODO: Default to iterating and printing for all supported naming strategies
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

The TODO comment references 'printing' but this function no longer handles printing/logging - that responsibility has been moved to visualizeLibraryMap. Update the TODO to reflect that this is about supporting multiple naming strategies for building the map, or move it to visualizeLibraryMap if the intent is about visualizing multiple strategies.

Suggested change
// TODO: Default to iterating and printing for all supported naming strategies
// TODO: Default to iterating for all supported naming strategies

Copilot uses AI. Check for mistakes.
Comment on lines +119 to +122
failText: () =>
`Failed to link ${platformDisplayName} Node-API modules into ${prettyPath(
platformOutputPath,
)}: ${error.message}`,
)}`,
Copy link

Copilot AI Oct 23, 2025

Choose a reason for hiding this comment

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

The error parameter was removed from the failText callback, but the error's message is no longer included in the output. This loses valuable debugging information. Consider retaining the error parameter and including error.message in the error text, or document why the error details are intentionally omitted.

Copilot uses AI. Check for mistakes.
@kraenhansen kraenhansen merged commit bb9a78c into main Oct 23, 2025
6 checks passed
@kraenhansen kraenhansen deleted the kh/fix-visualizing-duplicate-library-names branch October 23, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant