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

feat: add --example none, --replace-directory, and --skip-git options #668

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gabrielmoreira
Copy link

Hello! First, thank you for the work on Bob and create-react-native-library.

I've made a few modifications on create-react-native-library to support a tooling (qdk) setup I'm working on.

Summary of Changes:

  1. Added --example none option: Allows creating libraries without an example app.
  2. Added --replace-directory option: Enables overwriting the template in an existing directory, using a similar option name as in the React Native CLI.
  3. Added --skip-git option: Prevents any git commands from running during template creation, also following a naming convention similar to the React Native CLI.

Context:

In my tool (qdk), I have templates for different project structures, and one of these templates uses create-react-native-library to set up a React Native library project. The goal is to generate only the library code, without an example app, without interfering with the project git, and with the flexibility to overwrite an existing directory if it already contains some files.

Thanks for considering these additions!

P.S.: By the way, the options added here follow a similar naming convention to npx @react-native-community/cli init options, for consistency.

I also considered contributing an optional parameter to fix the version of npx @react-native-community/cli@<<VERSION>> init, but for my case, not creating the example app was more beneficial. The vanilla example was giving me errors during generation, even though it was working a few days ago. Fixing the version of create-react-library wasn’t enough.

Additionally, I thought about adding an option to specify the package manager instead of trying to detect it. However, this would require more testing with various package managers, so I decided to hold off on that for now.

@gabrielmoreira gabrielmoreira changed the title Add --example none, --replace-directory, and --skip-git options to create-react-native-library feat: add --example none, --replace-directory, and --skip-git options to create-react-native-library Oct 26, 2024
@gabrielmoreira gabrielmoreira changed the title feat: add --example none, --replace-directory, and --skip-git options to create-react-native-library feat: add --example none, --replace-directory, and --skip-git options Oct 26, 2024
@gabrielmoreira
Copy link
Author

Hi folks! This PR is a small, focused change with three simple commits. If someone could take a quick look, I'd really appreciate it!

Copy link
Member

@satya164 satya164 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I'd like to make following changes:

  • To match the convention for booleans, instead of skip-git, add a git boolean option, and default it to true. To disable git, user would be able to pass --no-git
  • I'd remove replace-directory option. I'd like to avoid additional option for this since you can just delete the folder beforehand in your code.

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.

2 participants