Skip to main content

sv migrate

sv migrate migrates Svelte(Kit) codebases. Some migrations are built into sv; older migrations are run through svelte-migrate.

Some migrations may annotate your codebase with tasks for completion that you can find by searching for @migration.

Usage

npx sv migrate

When no migration is specified, sv migrate prompts you to pick one.

You can also specify a migration directly via the CLI:

npx sv migrate [migration]

For built-in migrations, sv migrate shows the migration steps before applying them. Required steps always run, and additional steps can be selected interactively or with --tasks. After a successful built-in migration, sv formats changed files when Prettier is installed and prompts to install any updated dependencies.

Migrations

sveltekit-3

Upgrades a SvelteKit 2 app to SvelteKit 3.

app-state

Migrates $app/stores usage to $app/state in .svelte files. See the migration guide for more details.

svelte-5

Upgrades a Svelte 4 app to use Svelte 5, and updates individual components to use runes and other Svelte 5 syntax (see migration guide).

self-closing-tags

Replaces all the self-closing non-void elements in your .svelte files. See the pull request for more details.

svelte-4

Upgrades a Svelte 3 app to use Svelte 4 (see migration guide).

sveltekit-2

Upgrades a SvelteKit 1 app to SvelteKit 2 (see migration guide).

package

Upgrades a library using @sveltejs/package version 1 to version 2. See the pull request for more details.

routes

Upgrades a pre-release SvelteKit app to use the filesystem routing conventions in SvelteKit 1. See the pull request for more details.

Options

--cwd <path>

Run the migration in a different working directory.

--no-git-check

By default, sv migrate prompts before making changes when the git working tree is dirty. Use --no-git-check to skip this check.

--files <glob>

Limit the files considered for migration to those matching a glob. A migration may still try to edit or create files outside the glob, in which case sv migrate will show a warning.

When used with --cwd, the glob is relative to the working directory.

--tasks <task...>

Select migration tasks without the interactive prompt. Required tasks always run.

Use --tasks all to run every task, or --tasks required to run only the required tasks.

--confirm

Skip the final confirmation prompt before applying the migration.

--install <package-manager>

Install dependencies with a specified package manager:

  • npm
  • pnpm
  • yarn
  • bun
  • deno

--no-install

Skip installing dependencies.

Edit this page on GitHub llms.txt

previous next