From e31835fd4c13e762253e1fd3cf7a3e52039cc581 Mon Sep 17 00:00:00 2001 From: Manuel Serret Date: Thu, 7 Nov 2024 18:17:22 +0100 Subject: [PATCH] feat: `migrate` allow passing path or component --- .changeset/giant-sloths-exist.md | 5 +++++ packages/cli/commands/migrate.ts | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 .changeset/giant-sloths-exist.md 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[]) {