8000 feat: add `--default` flag by AdrianGonz97 · Pull Request #376 · svelte-add/svelte-add · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

feat: add --default flag #376

Merged
merged 6 commits into from
May 28, 2024
Merged

Conversation

AdrianGonz97
Copy link
Collaborator
@AdrianGonz97 AdrianGonz97 commented May 26, 2024

Closes #350

This PR adds the --default flag as a shorthand to install the default adder options for missing options.

For example, say that we have 2 tailwind options typography and forms (assume both have their defaults set to false). If we were to run the command like so:

@svelte-add/tailwindcss --default --typography

the typography plugin will still be added as it was manually specified, but the forms plugin will not.

Copy link
changeset-bot bot commented May 26, 2024

🦋 Changeset detected

Latest commit: 0cf331f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@svelte-add/core Minor
svelte-add Patch
@svelte-add/testing-library Patch
@svelte-add/website Patch
@svelte-add/bootstrap Patch
@svelte-add/bulma Patch
@svelte-add/mdsvex Patch
@svelte-add/routify Patch
@svelte-add/storybook Patch
@svelte-add/tailwindcss Patch
@svelte-add/threlte 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

manuel3108
manuel3108 previously approved these changes May 27, 2024
Copy link
Member
@manuel3108 manuel3108 left a comment

Choose a reason for hiding this comment

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

Looks good and works as expected.

Although where I'm not 100% sure about, so let me just think out loud.
The goal of #350 is to minimize the command length and the required selections within the cli.

Consider this command:

npx @svelte-add/tailwindcss --default

As of now, this interaction might create two required interactions for the user

  • At least one precondition fails
  • We could not detect a package manager

So the question arises if --default should implicitly add --skip-preconditions and --skip-install?

On the one side we could argue that with that change we could guarantee the user a zero interaction setup, but he would be missing a lot of the benefits. On the other side, we already only displays these prompts if really required (> 1 failed precondition, no PM detected) so a lot of these cli commands should already be interaction free.

Based on that I would think it's the best to leave the implementation as-is. What do you think?

@AdrianGonz97
Copy link
Collaborator Author

So the question arises if --default should implicitly add --skip-preconditions and --skip-install?

On the one side we could argue that with that change we could guarantee the user a zero interaction setup, but he would be missing a lot of the benefits. On the other side, we already only displays these prompts if really required (> 1 failed precondition, no PM detected) so a lot of these cli commands should already be interaction free.

Based on that I would think it's the best to leave the implementation as-is. What do you think?

I think it should be left as-is. --default should really only affect the adder's specific options rather than the whole experience.

@manuel3108
Copy link
Member

Cool, then we agree!

@manuel3108 manuel3108 merged commit bad241e into svelte-add:main May 28, 2024
2 of 3 checks passed
@github-actions github-actions bot mentioned this pull request May 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust the opt-out behavior of CLI flags
2 participants
0