callstack / react-native-builder-bob

👷‍♂️ Simple set of CLIs to scaffold and build React Native libraries for different targets
https://callstack.github.io/react-native-builder-bob/
2.78k stars 184 forks source link

feat: ask to use recommended template #564

Closed atlj closed 4 months ago

atlj commented 4 months ago

Summary

This is an effort to implement a recommended template. See the Golden Template RFC for context.

This adds a new parameter called --with-recommended-options and the corresponding question to the CLI. Here's how the CLI prompt looks like: Screenshot 2024-06-12 at 17 07 18

This also adds the text (Recommended) at the end of the recommended options (View + Module with backward compats and Kotlin + Obj-c at the moment).

Test plan

A. Happy Path

  1. Run create-react-native-library and answer the mail address, git repo, etc. questions.
  2. Make sure the CLI asks Do you want to customize the library type and languages?.
  3. Select Use recommended defaults.
  4. Wait until the library is generated and make sure the library is a view + module, kotlin + objective-c library.

B. Pick Customize

  1. Run create-react-native-library and answer the mail address, git repo, etc. questions.
  2. Make sure the CLI asks Do you want to customize the library type and languages?.
  3. Select Customize.
  4. Make sure the Fabric view and Turbo module with backward compat option has the (Recommended) text.

C. Pass --with-recommended-options

  1. Run create-react-native-library with --with-recommended-options parameter.
  2. Make sure the library doesn't ask you about library or type selection.
  3. Make sure the generated library uses the golden template.

D. Pass --with-recommended-options with bad parameters

  1. Run create-react-native-library with --with-recommended-options and --type module-view-new.
  2. Make sure it emits an error.