Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: get commands options and description from new package #477

Merged

Conversation

szymonrybczak
Copy link
Contributor

Summary

Fixes #473. With React Native 0.73, we've migrated start and bundle command to Core. So right now when resolving path to CLI and trying to require these commands from CLI, script will fail. In this PR I changed the require.resolve to look into new package, where these commands are living right now.

Test plan

  1. Create new React Native app with npx react-native@latest init app
  2. Init Re.Pack with npx @callstack/reapck-init
  3. Apply changes from this PR
  4. npx react-native config should be executed correctly.

Copy link

changeset-bot bot commented Dec 12, 2023

🦋 Changeset detected

Latest commit: c019a75

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@callstack/repack Minor
testerapp Patch

Not sure what this means? Click here to learn what changesets are.

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

try {
cliPath = path.dirname(
require.resolve('react-native/node_modules/@react-native-community/cli')
require.resolve('@react-native/community-cli-plugin')
Copy link
Member

Choose a reason for hiding this comment

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

This will break Re.Pack working with 0.71 or 0.72, isn't it? Couldn't we look for "bin" entry in react-native package, which points to the cli?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately we can't go with the easy path, because right now start and bundle command are added in react-native.config.js so they won't exist under /commands dir.

@jbroma
Copy link
Member

jbroma commented Dec 12, 2023

@szymonrybczak is this still compatible with previous versions? We need to ensure compatibility with at least last 3 versions of RN (0.71, 0.72, 0.73)

@RafikiTiki
Copy link
Member

With the backwards compatibility it looks great, thanks!

Copy link
Member

@jbroma jbroma left a comment

Choose a reason for hiding this comment

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

Just few details to fix, other than that GJ! 🚀

packages/repack/commands.js Outdated Show resolved Hide resolved
packages/repack/commands.js Outdated Show resolved Hide resolved
packages/repack/commands.js Outdated Show resolved Hide resolved
szymonrybczak and others added 3 commits December 15, 2023 07:14
@szymonrybczak
Copy link
Contributor Author

szymonrybczak commented Dec 15, 2023

Suggestions applied, should be good now! 🙌

Copy link
Member

@jbroma jbroma left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@jbroma jbroma merged commit e1476e6 into callstack:main Dec 18, 2023
4 checks passed
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.

[email protected] @callstack/repack/commands error
4 participants