Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Migration script for app-state does not migrate derived #16758

@AntonioVentilii

Description

@AntonioVentilii

Describe the bug

I have some global derived store that are derived from the deprecated page store ($app/stores). Now, I want to migrate them with the script, but it does not work (it does nothing), so I need to do it manually. And I am not 100% sure if I am doing it correctly, retaining the reactivity (any suggestion welcomed).

Reproduction

put this snippet in a file

import { page } from '$app/stores';
import type { OptionString } from '$lib/types/string';
import { derived, type Readable } from 'svelte/store';

export const routeToken: Readable<OptionString> = derived(
	[page],
	([
		{
			data: { token }
		}
	]) => token
);

and run

npx sv migrate app-state

Logs

Nothing happens or changes:

npx sv migrate app-state
┌  Welcome to the svelte-migrate CLI! (v1.10.1)
│
▲  This will update files in the current directory.
│  If you're inside a monorepo, don't run this in the root directory, rather run it in all projects independently.
│
◇  Continue?
│  Yes
│
◇  Which folders should be migrated?
│  src
│
◆  ✔ Your project has been migrated
│
◇  Recommended next steps: ──────────────────────────────╮
│                                                        │
│  1: Install the updated dependencies by running npm i  │
│  2: git commit -m "migration to $app/state"            │
│  3: Run git diff to review changes.                    │
│                                                        │
├────────────────────────────────────────────────────────╯
│
└  You're all set!

System Info

System:
    OS: macOS 15.6.1
    CPU: (11) arm64 Apple M3 Pro
    Memory: 112.69 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.17.0 - /usr/local/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.9.2 - /usr/local/bin/npm
    pnpm: 10.12.1 - /usr/local/bin/pnpm
  Browsers:
    Chrome: 140.0.7339.133
    Safari: 18.6
  npmPackages:
    svelte: ^5.33.18 => 5.33.18

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions