Skip to content

Commit

Permalink
Merge pull request #26515 from storybookjs/norbert/fix-mention-next-i…
Browse files Browse the repository at this point in the history
…n-cli

CLI: Instruct the correct auto-migration command
  • Loading branch information
ndelangen committed Mar 20, 2024
2 parents adf4d6a + a2582ba commit 1726622
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 16 deletions.
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
@@ -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
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
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

0 comments on commit 1726622

Please sign in to comment.