Use @react-native-communty/cli-plugin-metro project to bundling, and remove custom code in CLI and related packages
I created @rnx-kit/metro-service from code in @react-native-community/cli to give us immediate access to calling Metro programmatically.
Check with @react-native-community/cli devs -- grabbou specifically -- about factoring out the code that talks to metro.
The code I separated out of @react-native-community/cli is the buildBundle API and all subordinate APIs and types.
See /packages/cli/src/commands/bundle/buildBundle.ts.
Talked with some people on discord including a maintainer, and I got the nod to go ahead with refactoring bundling & config code into separate cli packages.
- [x] Move bundling command logic into /packages/cli-bundle-api and submit PR. There was an ask to focus on the asset logic and leave the bundling "command" where it is. This makes sense, but I need to review so I don't lose any logic.
- [x] Once approved, submit fixes on top from the this PR
- [x] Also, submit a PR which exposes the Metro config loader (and dependencies) into /packages/metro-config
- [x] Once released/published, make use of both packages in our CLI
PR: https://github.com/react-native-community/cli/pull/1447
@react-native-community/cli release version 6.1.0 includes the PR
Still need to remove the custom code I added (copied) from @rnc community project. Now that it's all wrapped up and exposed through CLI, we should use that instead.
For future reference, @react-native-community/[email protected] is equivalent to [email protected].
headsup: things have been moving around -> https://github.com/facebook/react-native/pull/38795