solidjs-community / solid-cli

A custom CLI built for Solid.
https://solid-cli.netlify.app/
MIT License
61 stars 11 forks source link

add some CLI args to the `create-solid` command #36

Closed dario-piotrowicz closed 6 months ago

dario-piotrowicz commented 6 months ago

Hi 👋

This PR proposes changes to allow create-solid to accept CLI arguments

As you can see from the command's help message here: Screenshot 2024-03-02 at 18 37 07

This allows flexibility for the user to make choices either via cli arguments or via the interactive interface.

For example, running the following will create a project without interactively asking the user for the project's name and if they want to use solidStart:

npx create-solid -p my-solid-project -s

This PR introduces just a couple of CLI arguments, more can be added later, but anyways I just wanted to test the water and see if there's interest in this and if the chosen approach (using commander) is accepted.

Please have a look and let me know what you think 🙏

netlify[bot] commented 6 months ago

Deploy Preview for solid-cli canceled.

Name Link
Latest commit 133ccd4d9ec86972fb728dc42f8ed9dd710827fe
Latest deploy log https://app.netlify.com/sites/solid-cli/deploys/65e372f209788400087f0d55
dario-piotrowicz commented 6 months ago

By the way, I work at Cloudflare and a project I am part of is our create Cloudflare cli tool: https://developers.cloudflare.com/pages/get-started/c3/

C3 generates framework projects by running their create-x commands and then adds the Cloudflare integration to them (so that they can be deployed on our platform).

We've been supporting Solid using the old create-solid command up until now. Now that the package has changed we've noticed that we are no longer able to pass arguments to the create-solid command, making it very difficult for us to integrate with it (in a clean and reliable manner).

So that's why I came here trying to see if there is a willingness of adding back support to CLI arguments 🤞 (by the way, one that's really fundamental for us is the project name)

Tommypop2 commented 6 months ago

Hi @dario-piotrowicz,

Thanks so much for this PR! :)

I've merged this into the add-cli-args branch and I've switched the library for parsing command line arguments from commander to cmd-ts, since that's what we use for the main CLI (because it has a significantly smaller bundle size)

Would you mind verifying that this all works properly for you and does what you need it to? If so, let me know and I can merge this into main :)

dario-piotrowicz commented 6 months ago

Awesome! Thanks a lot @Tommypop2, I will have that a try and let you know shortly 🙂

dario-piotrowicz commented 6 months ago

@Tommypop2 it works great! thank you so very much! ❤️

Please feel free to merge and publish it whenever you can so that we can start using it in our CLI 🙏 ❤️

Tommypop2 commented 6 months ago

@dario-piotrowicz Just released a new version with these changes :) Feel free to make an issue or PR if you need any more changes!

dario-piotrowicz commented 6 months ago

@Tommypop2 thank you so very much! ❤️ 🙏

Feel free to make an issue or PR if you need any more changes!

Sure, will do! thanks so much for being so welcoming ❤️