A CLI to run codemods for Svelte This project use jscodeshift underneath which allows this tool to leverage the standard codemod tooling for JavaScript in Svelte projects.
npm install -g sveltemod
sveltemod <codemod> <file>
Example:
sveltemod transforms/v5-derived.js src/App.svelte
You can also use jscodeshift to run the codemods like:
jscodeshift --transform=./transforms/v5-derived.js --extensions=svelte ./src/App.svelte
$: area = width * height;
const area = $derived(width * height);
$: console.log(area);
$effect(() => {
console.log(area);
});
export let width;
export let height;
let { width, height } = $props();
let count = 0;
let count = $state(0);