diff --git a/.changeset/giant-sloths-exist.md b/.changeset/giant-sloths-exist.md new file mode 100644 index 00000000..14cefeb6 --- /dev/null +++ b/.changeset/giant-sloths-exist.md @@ -0,0 +1,5 @@ +--- +'sv': patch +--- + +feat: `migrate` allow passing path or component diff --git a/packages/cli/commands/migrate.ts b/packages/cli/commands/migrate.ts index 88a5dd7c..6676c824 100644 --- a/packages/cli/commands/migrate.ts +++ b/packages/cli/commands/migrate.ts @@ -7,6 +7,7 @@ import { getUserAgent } from '../common.ts'; export const migrate = new Command('migrate') .description('a CLI for migrating Svelte(Kit) codebases') .argument('', 'migration to run') + .argument('[path]', 'component path or directory to migrate') .option('-C, --cwd ', 'path to working directory', process.cwd()) .configureHelp({ formatHelp() { @@ -15,8 +16,11 @@ export const migrate = new Command('migrate') return ''; } }) - .action((migration, options) => { - runMigrate(options.cwd, [migration]); + .action((migration, path, options) => { + const args = [migration]; + if (path) args.push(path); + + runMigrate(options.cwd, args); }); function runMigrate(cwd: string, args: string[]) {