Skip to content

breaking: Replace launchEditor implementation#2587

Merged
huntie merged 1 commit into
react-native-community:mainfrom
huntie:launch-editor-pkg
Jan 29, 2025
Merged

breaking: Replace launchEditor implementation#2587
huntie merged 1 commit into
react-native-community:mainfrom
huntie:launch-editor-pkg

Conversation

@huntie

@huntie huntie commented Jan 28, 2025

Copy link
Copy Markdown
Collaborator

Summary:

Replace the custom implementation of launchEditor in the cli-tools package with a call to launch-editor.

  • This PR is marked as breaking due to anticipated misalignments for esoteric editor setups.

Why launch-editor?

  • Originally forked from react-dev-utils, which is the same base implementation that was originally copied into this repo.
  • Well-maintained packages with 21 commits in 2024.
    • e.g. has support for Cursor, where we do not.
  • 7.7M weekly downloads and depended on by Vue.js' CLI utils (@vue/cli-shared-utils).

Test Plan:

  • Build this repo via yarn build.
  • Link @react-native-community/cli-tools and @react-native-community/cli-server-api into a local checkout of react-native via yarn link.
  • Open RNTester, modified to throw an error on launch.
Screen.Recording.2025-01-29.at.13.01.33.mov

✅ RedBox is rendered with stack trace
✅ Tapping item in component stack opens in my active editor (VS Code)
✅ Assert new code is called with temp console log

Checklist

  • Documentation is up to date to reflect these changes.
  • Follows commit message convention described in CONTRIBUTING.md
@huntie huntie force-pushed the launch-editor-pkg branch from c03c021 to a7cc06a Compare January 28, 2025 15:54
@huntie huntie marked this pull request as ready for review January 29, 2025 13:01
@huntie huntie requested review from szymonrybczak and removed request for adamTrz January 29, 2025 13:02
export default function launchEditor(
fileName: string,
lineNumber: number,
projectRoots: ReadonlyArray<string>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: why do we keep this argument instead of just removing it?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For now, to not break the API of the cli-tools package itself. (Although, doing this isn't far off 👀)

@szymonrybczak szymonrybczak left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Awesome! Thank you for working on this 👏

@huntie huntie merged commit c8b527a into react-native-community:main Jan 29, 2025
@huntie huntie deleted the launch-editor-pkg branch January 29, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants