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

[BREAKING] feat: override start & bundle commands #537

Merged
merged 5 commits into from
Apr 4, 2024
Merged

Conversation

jbroma
Copy link
Member

@jbroma jbroma commented Apr 4, 2024

Summary

Closes #93
Closes #487

Override start & bundle commands from CLI.

For maximum compatibility, instead of replacing webpack-start and webpack-bundle commands, the overrides were added on top of old commands. This results in following behaviour:

  • for React-Native <0.74 (CLI <13) - CLI won't apply overrides, webpack commands will work just as before
  • for React-Native >=0.74 (CLI >=13) - both overrides and webpack commands work

It's possible to opt out of overrides by simply filtering out commands in react-native.config.js:

const commands = require('@callstack/repack/commands');

module.exports = {
  commands: commands.filter((command) => command.name.startsWith('webpack')),
};

This also solves the issue with launching metro dev server when running react-native run-ios or react-native run-android - Re.Pack dev server will be launched instead

Test plan

  • - tested locally
  • - add basic tests to TesterApp suite

Copy link

changeset-bot bot commented Apr 4, 2024

🦋 Changeset detected

Latest commit: 67cf989

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 Major
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

@jbroma
Copy link
Member Author

jbroma commented Apr 4, 2024

Copy link
Contributor

@szymonrybczak szymonrybczak left a comment

Choose a reason for hiding this comment

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

LGTM, I think it'd be valuable to add note to docs 👍

@szymonrybczak
Copy link
Contributor

For future it'd good to also somehow inform user about options that are not available, because right now we're explicitly using the same options as Metro's start and bundle command, and some of them aren't implemented (yet).

const startCommand = cliCommands.find(({ name }) => name === 'start');
const bundleCommand = cliCommands.find(({ name }) => name === 'bundle');

@jbroma
Copy link
Member Author

jbroma commented Apr 4, 2024

For future it'd good to also somehow inform user about options that are not available, because right now we're explicitly using the same options as Metro's start and bundle command, and some of them aren't implemented (yet).

const startCommand = cliCommands.find(({ name }) => name === 'start');
const bundleCommand = cliCommands.find(({ name }) => name === 'bundle');

agree 💯, we need to address this in a separate PR and most likely after v4 release

@jbroma jbroma merged commit cabb7b2 into v4 Apr 4, 2024
3 checks passed
@jbroma jbroma deleted the feat/override-commands branch April 4, 2024 19:39
jbroma added a commit that referenced this pull request Apr 5, 2024
* feat: override metro commands by default

* feat: update types for commands

* test: add basic tests to TesterApp suite

* chore: add changeset

* chore: adjust changeset
jbroma added a commit that referenced this pull request Apr 5, 2024
* feat: override metro commands by default

* feat: update types for commands

* test: add basic tests to TesterApp suite

* chore: add changeset

* chore: adjust changeset
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.

3 participants