Skip to content

feat(addons): pass setup defaults to dependencies - #1419

Merged
manuel3108 merged 10 commits into
sveltejs:mainfrom
LudoLoops:feat/setup-addon-dependency-options
Nov 18, 2026
Merged

manuel3108 merged 10 commits into
sveltejs:mainfrom
LudoLoops:feat/setup-addon-dependency-options

Conversation

@LudoLoops

Copy link
Copy Markdown
Contributor

Summary

  • Expose resolved add-on options (including defaults) to setup, so an add-on can conditionally compose dependencies based on its selected mode.
  • Let dependsOn(id, defaults) provide typed defaults for automatically added official add-ons. Defaults do not override options when the dependency was explicitly selected; conflicting sibling defaults remain unanswered for the normal prompt.
  • Add coverage for setup values, dependency option resolution, explicit selection, nested defaults, and conflicting defaults.

This is needed for conditional composition in SvelteForge's dashboard addon: only the dashboard variant should automatically add official Drizzle and Better Auth, with PostgreSQL settings, while the base variant remains auth-free. Related upstream request: #1219. Related consumer issue: lelabdev/svforge#547.

Validation

  • pnpm build — passed
  • pnpm --filter sv check — passed
  • pnpm lint — passed
  • pnpm test --project core setup — 7 passed
  • pnpm test --project cli add — 4 passed
  • pnpm test — 511 passed, 29 skipped; 8 failures were environment-related: Playwright browser binary unavailable, plus unrelated full-project CLI fixture timeout and pnpm version mismatch (11.27.0 vs repository-required 11.28.3).

@pkg-svelte-dev

pkg-svelte-dev Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Install the latest version of sv from c2d0fd1:

pnx https://pkg.svelte.dev/sv/c/c2d0fd1be277eda88eb19cddad39f30782a4eddc create

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/cli/pr/1419

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c2d0fd1

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

This PR includes changesets to release 1 package
Name Type
sv Minor

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

Copy link
Copy Markdown
Member

@copilot fix the conflicts

…icts

# Conflicts:
#	packages/sv/api-surface.md
#	packages/sv/src/cli/add.ts
- prompt each level before its setup (incl. interactive picker), so dependencies see parent defaults
- validate defaults against the dependency's options and conditions
- verify clean tree and unsupported add-ons before prompting
- reuse prompt-time setup results when applying
- document setup options and dependsOn defaults
@svelte-docs-bot

Copy link
Copy Markdown

@jycouet jycouet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thx!

Comment thread packages/sv/api-surface.md Outdated
setup?: (
workspace: Workspace & {
dependsOn: (id: AddonId) => void;
options: WorkspaceOptions<Args> & Record<string, unknown>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

THIS should not be options, but something else... like it's options coming from cli + from other addons + ... options alone i a bit strange!

@manuel3108 manuel3108 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@manuel3108
manuel3108 merged commit 8a000b6 into sveltejs:main Nov 18, 2026
9 of 10 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-addon-integration-tests Run the addon integration test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants