Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI: Instruct the correct auto-migration command #26515

Merged
merged 6 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('getMigrationSummary', () => {

─────────────────────────────────────────────────

If you'd like to run the migrations again, you can do so by running 'npx storybook@next automigrate'
If you'd like to run the migrations again, you can do so by running 'npx storybook automigrate'

The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook.

Expand All @@ -124,7 +124,7 @@ describe('getMigrationSummary', () => {
expect(summary).toMatchInlineSnapshot(`
"No migrations were applicable to your project

If you'd like to run the migrations again, you can do so by running 'npx storybook@next automigrate'
If you'd like to run the migrations again, you can do so by running 'npx storybook automigrate'

The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook.

Expand All @@ -144,7 +144,7 @@ describe('getMigrationSummary', () => {
expect(summary).toMatchInlineSnapshot(`
"No migrations were applicable to your project

If you'd like to run the migrations again, you can do so by running 'npx storybook@next automigrate'
If you'd like to run the migrations again, you can do so by running 'npx storybook automigrate'

The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook.

Expand Down
4 changes: 2 additions & 2 deletions code/lib/cli/src/automigrate/helpers/getMigrationSummary.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import chalk from 'chalk';
import boxen from 'boxen';
import dedent from 'ts-dedent';
import type { InstallationMetadata } from '@storybook/core-common';
import { type InstallationMetadata } from '@storybook/core-common';
import type { FixSummary } from '../types';
import { FixStatus } from '../types';

Expand Down Expand Up @@ -63,7 +63,7 @@ export function getMigrationSummary({
messages.push(getGlossaryMessages(fixSummary, fixResults, logFile).join(messageDivider));

messages.push(dedent`If you'd like to run the migrations again, you can do so by running '${chalk.cyan(
'npx storybook@next automigrate'
'npx storybook automigrate'
)}'

The automigrations try to migrate common patterns in your project, but might not contain everything needed to migrate to the latest version of Storybook.
Expand Down
7 changes: 1 addition & 6 deletions code/lib/cli/src/doctor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
getIncompatibleStorybookPackages,
} from './getIncompatibleStorybookPackages';
import { getDuplicatedDepsWarnings } from './getDuplicatedDepsWarnings';
import { isPrerelease } from './utils';

const logger = console;
const LOG_FILE_NAME = 'doctor-storybook.log';
Expand Down Expand Up @@ -141,12 +140,8 @@ export const doctor = async ({
}
}

const doctorCommand = isPrerelease(storybookVersion)
? 'npx storybook@next doctor'
: 'npx storybook@latest doctor';

const commandMessage = `You can always recheck the health of your project by running:\n${chalk.cyan(
doctorCommand
'npx storybook doctor'
)}`;
logger.info();

Expand Down
10 changes: 5 additions & 5 deletions code/lib/core-events/src/errors/server-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export class MissingFrameworkFieldError extends StorybookError {
return dedent`
Could not find a 'framework' field in Storybook config.

Please run 'npx storybook@next automigrate' to automatically fix your config.
Please run 'npx storybook automigrate' to automatically fix your config.
`;
}
}
Expand All @@ -98,7 +98,7 @@ export class InvalidFrameworkNameError extends StorybookError {
return dedent`
Invalid value of '${this.data.frameworkName}' in the 'framework' field of Storybook config.

Please run 'npx storybook@next automigrate' to automatically fix your config.
Please run 'npx storybook automigrate' to automatically fix your config.
`;
}
}
Expand Down Expand Up @@ -276,7 +276,7 @@ export class AngularLegacyBuildOptionsError extends StorybookError {
Your Storybook startup script uses a solution that is not supported anymore.
You must use Angular builder to have an explicit configuration on the project used in angular.json.

Please run 'npx storybook@next automigrate' to automatically fix your config.
Please run 'npx storybook automigrate' to automatically fix your config.
`;
}
}
Expand Down Expand Up @@ -390,7 +390,7 @@ export class NoMatchingExportError extends StorybookError {
Correct example:
{ "@storybook/react": "7.5.3", "@storybook/react-vite": "7.5.3", "storybook": "7.5.3" }

Please run \`npx storybook@latest doctor\` for guidance on how to fix this issue.
Please run \`npx storybook doctor\` for guidance on how to fix this issue.
`;
}
}
Expand Down Expand Up @@ -557,7 +557,7 @@ export class UpgradeStorybookToSameVersionError extends StorybookError {

If you intended to re-run automigrations, you should run the "automigrate" command directly instead:

"npx storybook@${this.data.beforeVersion} automigrate"
"npx storybook automigrate"
`;
}
}
Expand Down
Loading