Skip to content

Svelte 5 migration not ideal when run from root of monorepo #13749

@sdarnell

Description

@sdarnell

Describe the bug

I now realise that it wasn't the intended behaviour of npx sv migrate svelte-5 but when run from the root of a mono repo the script doesn't quite do the right thing. Raising as a bug, to see if this could be improved or documented for others.

The key problem is that it fiddles with the package.json at the root of the monorepo but this doesn't contain the svelte dependencies. It's the sub-folders that contain the 'real' package.json files.
It also only offers the children of the current directory when asking which directory to process.

In my case, I've got pnpm workspaces setup just like the main svelte repo https://github.com/sveltejs/svelte and from the root I ran:

npx sv migrate svelte-5

sv version was 0.57

When asked for a directory to process it offered docs, packages and sites. So I selected sites (which only contains one).
The script happily processed the .svelte files, but didn't touch the package.json in sites/www/package.json

So what's the behaviour I'd expect?
I guess an error would have helped ('Your package.json does not contain svelte 4'), but the user may want to continue regardless.
Maybe process each package.json it finds (i.e. the one(s) in sites/www).
Or spotted that it was a monorepo and asked me to re-run in each svelte folder?

Raised here rather than sv repo because migration says: This migration is experimental — please report any bugs to https://github.com/sveltejs/svelte/issues

Reproduction

None given, but same mono-repo structure as svelte or kit.

Logs

No response

System Info

System:
    OS: macOS 15.0.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 87.39 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.nvm/versions/node/v20.11.1/bin/node
    npm: 10.9.0 - ~/.nvm/versions/node/v20.11.1/bin/npm
    pnpm: 9.12.1 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 129.0.6668.101
    Safari: 18.0.1

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