diff --git a/code/lib/cli/src/automigrate/index.ts b/code/lib/cli/src/automigrate/index.ts index a20325c86119..7e4b1e045376 100644 --- a/code/lib/cli/src/automigrate/index.ts +++ b/code/lib/cli/src/automigrate/index.ts @@ -12,9 +12,10 @@ interface FixOptions { fixId?: string; yes?: boolean; dryRun?: boolean; + prerelease?: boolean; } -export const automigrate = async ({ fixId, dryRun, yes }: FixOptions = {}) => { +export const automigrate = async ({ fixId, dryRun, yes, prerelease }: FixOptions = {}) => { const packageManager = JsPackageManagerFactory.getPackageManager(); const filtered = fixId ? fixes.filter((f) => f.id === fixId) : fixes; @@ -53,7 +54,7 @@ export const automigrate = async ({ fixId, dryRun, yes }: FixOptions = {}) => { if (runAnswer.fix) { try { - await f.run({ result, packageManager, dryRun }); + await f.run({ result, packageManager, dryRun, prerelease }); logger.info(`✅ ran ${chalk.cyan(f.id)} migration`); } catch (error) { logger.info(`❌ error when running ${chalk.cyan(f.id)} migration:`); diff --git a/code/lib/cli/src/automigrate/types.ts b/code/lib/cli/src/automigrate/types.ts index ff812f7064d6..605f2e4ea7a8 100644 --- a/code/lib/cli/src/automigrate/types.ts +++ b/code/lib/cli/src/automigrate/types.ts @@ -8,6 +8,7 @@ export interface RunOptions { packageManager: JsPackageManager; result: ResultType; dryRun?: boolean; + prerelease?: boolean; } export interface Fix { diff --git a/code/lib/cli/src/generate.ts b/code/lib/cli/src/generate.ts index acfcb7e79021..f72982ce812b 100644 --- a/code/lib/cli/src/generate.ts +++ b/code/lib/cli/src/generate.ts @@ -177,6 +177,7 @@ program .description('Check storybook for known problems or migrations and apply fixes') .option('-y --yes', 'Skip prompting the user') .option('-n --dry-run', 'Only check for fixes, do not actually run them') + .option('-p --prerelease', 'Use pre-release versions when migrating') .action((fixId, options) => automigrate({ fixId, ...options }).catch((e) => { logger.error(e); diff --git a/code/lib/cli/src/upgrade.ts b/code/lib/cli/src/upgrade.ts index 2df15576bb94..79301873740d 100644 --- a/code/lib/cli/src/upgrade.ts +++ b/code/lib/cli/src/upgrade.ts @@ -175,6 +175,6 @@ export const upgrade = async ({ if (!skipCheck) { checkVersionConsistency(); - await automigrate({ dryRun, yes }); + await automigrate({ dryRun, yes, prerelease }); } };