Skip to content

Commit

Permalink
feat: migrate allow passing path or component
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel3108 committed Nov 7, 2024
1 parent 3435754 commit e31835f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/giant-sloths-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

feat: `migrate` allow passing path or component
8 changes: 6 additions & 2 deletions packages/cli/commands/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>', 'migration to run')
.argument('[path]', 'component path or directory to migrate')
.option('-C, --cwd <path>', 'path to working directory', process.cwd())
.configureHelp({
formatHelp() {
Expand All @@ -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[]) {
Expand Down

0 comments on commit e31835f

Please sign in to comment.