sveltejs / sveltejs/cli

feat: Allow `dependsOn` to pass default add-on options if the user doesn't specify them

Open
#1,219 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

pkg:add
Dominant language
TypeScript
Stars
506
Forks
107
Avg merge
5d 15h
Merged PRs (30d)
28

Description

While authoring the sv community add-on for shadcn-svelte, I found myself wishing to pass predefined default options to add-on dependencies.

For example, rather than just defining an add-on dependency like this:

	// ...
	setup: ({ dependsOn }) => {
		dependsOn("tailwindcss");
	},

we could have something that allows default options:

	// ...
	setup: ({ dependsOn }) => {
		dependsOn("tailwindcss", { plugins: [] });
	},

so if the users calls the add-on without adding the dependency like so:

sv add @shadcn-svelte

then the interactive prompt won't appear for them for tailwindcss.

Of course, if they do specify the dependency:

sv add @shadcn-svelte tailwindcss

then the prompt for tailwindcss's options will appear like normal. Likewise, if the add-on just does dependsOn("tailwindcss"), then the prompt for options will also appear.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the sv add command handles dependsOn dependencies, explicit dependency arguments, and interactive option prompts. Compare the three examples in the issue: default options should suppress the prompt only when the dependency is omitted, while explicitly requested dependencies or dependencies without defaults should prompt normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.