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

[Bug]: migrate with config-path yields unknown option error #26727

Closed
eric-blue opened this issue Apr 3, 2024 · 3 comments
Closed

[Bug]: migrate with config-path yields unknown option error #26727

eric-blue opened this issue Apr 3, 2024 · 3 comments

Comments

@eric-blue
Copy link
Contributor

eric-blue commented Apr 3, 2024

Describe the bug

attempting to run a migrate method (in this case find-implicit-spies) it fails with error: unknown option '--config-dir' while similar commands (such as storybook doctor -c config/storybook) work just fine

To Reproduce

npx storybook migrate find-implicit-spies --glob="**/*.stories.@(js|jsx|ts|tsx)" --config-dir config/storybook
npx storybook migrate find-implicit-spies --config-dir config/storybook --glob="**/*.stories.@(js|jsx|ts|tsx)"
npx storybook migrate --config-dir config/storybook find-implicit-spies config/storybook --glob="**/*.stories.@(js|jsx|ts|tsx)"

npx storybook migrate find-implicit-spies --glob="**/*.stories.@(js|jsx|ts|tsx)" --configDir config/storybook
npx storybook migrate find-implicit-spies --configDir config/storybook --glob="**/*.stories.@(js|jsx|ts|tsx)"
npx storybook migrate --configDir config/storybook find-implicit-spies config/storybook --glob="**/*.stories.@(js|jsx|ts|tsx)"

npx storybook migrate find-implicit-spies --glob="**/*.stories.@(js|jsx|ts|tsx)" -c config/storybook
npx storybook migrate find-implicit-spies -c config/storybook --glob="**/*.stories.@(js|jsx|ts|tsx)"
npx storybook migrate -c config/storybook find-implicit-spies config/storybook --glob="**/*.stories.@(js|jsx|ts|tsx)"

System

System:
    OS: macOS 14.2.1
    CPU: (10) arm64 Apple M2 Pro
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 21.7.1 - /opt/homebrew/bin/node
    npm: 10.5.0 - ~/ui-app-canvas/node_modules/.bin/npm
    pnpm: 9.0.0-beta.2 - /opt/homebrew/bin/pnpm <----- active
  Browsers:
    Safari: 17.2.1
  npmPackages:
    @storybook/addon-a11y: 8.0.5 => 8.0.5 
    @storybook/addon-actions: 8.0.5 => 8.0.5 
    @storybook/addon-essentials: 8.0.5 => 8.0.5 
    @storybook/addon-interactions: 8.0.5 => 8.0.5 
    @storybook/addon-links: 8.0.5 => 8.0.5 
    @storybook/react: 8.0.5 => 8.0.5 
    @storybook/react-webpack5: 8.0.5 => 8.0.5 
    @storybook/test: 8.0.5 => 8.0.5 
    eslint-plugin-storybook: 0.8.0 => 0.8.0 
    storybook: 8.0.5 => 8.0.5 
    storybook-addon-remix-react-router: 3.0.0 => 3.0.0 
    storybook-addon-rtl: 1.0.0 => 1.0.0

Additional context

export async function migrate(

@eric-blue
Copy link
Contributor Author

I am also most interested in running npx storybook@latest migrate mdx-to-csf --glob "src/**/*.stories.mdx" --config-dir config/storybook, and only mention this since it has a distinct path in migrate

if (migration === 'mdx-to-csf' && !dryRun) {
const packageManager = JsPackageManagerFactory.getPackageManager();
const [packageJson, storybookVersion] = await Promise.all([
packageManager.retrievePackageJson(),
getCoercedStorybookVersion(packageManager),
]);
const { configDir: inferredConfigDir, mainConfig: mainConfigPath } = getStorybookInfo(
packageJson,
userSpecifiedConfigDir
);
const configDir = userSpecifiedConfigDir || inferredConfigDir || '.storybook';
// GUARDS
if (!storybookVersion) {
throw new Error('Could not determine Storybook version');
}
if (!mainConfigPath) {
throw new Error('Could not determine main config path');
}
await runFixes({
fixes: [mdxToCSF],
configDir,
mainConfigPath,
packageManager,
storybookVersion,
beforeVersion: storybookVersion,
isUpgrade: false,
});
await addStorybookBlocksPackage();
}

@eric-blue
Copy link
Contributor Author

eric-blue commented Apr 3, 2024

#26721 -> #26672

@eric-blue
Copy link
Contributor Author

resolved with the above branch running a canary release:

npx storybook@0.0.0-pr-26721-sha-65e66987 migrate mdx-to-csf --glob "config/**/*.stories.mdx" --config-dir config/storybook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant