mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 04:01:48 +08:00
15 lines
459 B
TypeScript
15 lines
459 B
TypeScript
import { listCodemods, runCodemod } from '@storybook/codemod';
|
|
|
|
export async function migrate(
|
|
migration: any,
|
|
{ configDir, glob, dryRun, list, rename, logger, parser }: any
|
|
) {
|
|
if (list) {
|
|
listCodemods().forEach((key: any) => logger.log(key));
|
|
} else if (migration) {
|
|
await runCodemod(migration, { configDir, glob, dryRun, logger, rename, parser });
|
|
} else {
|
|
throw new Error('Migrate: please specify a migration name or --list');
|
|
}
|
|
}
|