repack icon indicating copy to clipboard operation
repack copied to clipboard

[RFC] Override `start` command in `react-native.config.js`

Open szymonrybczak opened this issue 1 year ago • 8 comments

Describe the feature

In React Native Community CLI recently we allowed to override existing commands from react-native.config.js: https://github.com/react-native-community/cli/pull/2229.

Motivation

When running run-ios and run-android we're executing node /path/to/cli start, so automatically it starts Metro bundler instead of Re.Pack, which may be confusing for non-advanced users.

This also will unblock https://github.com/nrwl/nx/issues/20847

szymonrybczak avatar Jan 09 '24 12:01 szymonrybczak

cc @jbroma @tom-sherman @thymikee

szymonrybczak avatar Jan 09 '24 12:01 szymonrybczak

This issue has been marked as stale because it has been inactive for 30 days. Please update this issue or it will be automatically closed in 14 days.

github-actions[bot] avatar Feb 25 '24 00:02 github-actions[bot]

@szymonrybczak

I gave it some thought and I think this will be a good way going forward, this will reduce the overhead when migrating from metro and avoid some silly mistakes on users part. It's also worth noting that we the commands used in Re.Pack are aligned to that of metro so the change so it should be relatively smooth to add. If somebody uses metro fro development and Re.Pack for production, it can still manually adjusted in react-native.config.js.

This is quite a big change and definitely breaking so I'm adding an RFC to the title, and hope to gain more opinion on this matter.

jbroma avatar Feb 29 '24 14:02 jbroma

@RafikiTiki @thymikee @tom-sherman some insights from you would be great

jbroma avatar Feb 29 '24 14:02 jbroma

As long as we document how to fall back to previous behavior, or expose metro's start command, I'm good with moving forward with this 👍🏼

thymikee avatar Feb 29 '24 14:02 thymikee

Massively in favour of this default.

I think 90% of developers onboarded hit an issue where they somehow manage to trigger metro.

tom-sherman avatar Feb 29 '24 14:02 tom-sherman

Let's do this! If someone uses a sophisticated setup (i.e. Metro for dev, webpack for prod) I'd say they'll know how to set it up properly with Repack switch to being the default. For the rest of the users, it would save them time spent on figuring out why Metro was started instead of webpack.

Easing the new tool friction is always good 🚀

RafikiTiki avatar Mar 01 '24 10:03 RafikiTiki

We should proceeded with this feature when RN 0.74 with CLI 13 lands. I did some brief testing and it seems to work nicely by just changing the name of the commands.

Actionable items:

  • [ ] - Change command names in packages/repack/commands.js
  • [ ] - Add legacyCommands for compatibility with older versions of RN
  • [ ] - Align @callstack/repack-init to be able to choose whether to use overriden or separate commands
  • [ ] - Update Getting Started section in docs to reflect these changes and mention how to use legacyCommands

jbroma avatar Mar 06 '24 12:03 jbroma

This issue has been marked as stale because it has been inactive for 30 days. Please update this issue or it will be automatically closed in 14 days.

github-actions[bot] avatar Apr 06 '24 00:04 github-actions[bot]

Closed by #537

thymikee avatar Apr 07 '24 06:04 thymikee