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
migrate tool ignores parser #8091
Comments
@jdelStrother I'm a little confused. Is the option getting ignored, or getting recognized and then failing? It looks to me like it's getting passed properly in the code--I haven't set up a repro yet. Thanks! |
@shilman it's getting ignored. cli/bin/generate.js does pass the migrate parameter through to cli/lib/migrate.js, but that then just ignores it storybook/lib/cli/lib/migrate.js Line 3 in dfe9eb7
|
Something like this would fix the parser option getting ignored - import { listCodemods, runCodemod } from '@storybook/codemod';
- export async function migrate(migration, { configDir, glob, dryRun, list, rename, logger }) {
+ export async function migrate(migration, { configDir, glob, dryRun, list, rename, logger, parser }) {
if (list) {
listCodemods().forEach(key => logger.log(key));
} else if (migration) {
- await runCodemod(migration, { configDir, glob, dryRun, logger, rename });
+ await runCodemod(migration, { configDir, glob, dryRun, logger, rename, parser });
} else {
throw new Error('Migrate: please specify a migration name or --list');
}
} but that then fails in new and interesting ways inside the codemod - eg
|
There's another way you can run the Eg: This should bypass the problem of the |
@mbylstra somebody told me that it’s actually prettier that’s falling on TSX and not the codemod itself. And that if you comment out the prettier invocation in the package dist it will succeed. I’m on vacation this week so i haven’t had time to investigate. But if it’s easy for you to verify that, it would help give an extra data point for a proper fix |
Yes, thanks - I also found that. But then I ran into further problems with the transform when it's run in tsx mode: I opened an issue about this: #9669 |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Fixed in #12453 and released in 6.0. Closing! |
Describe the bug
When running
sb migrate
with a parser argument (egsb migrate --parser=flow storiesof-to-csf --glob 'components/stories/*.js'
), the parser is ignored.To Reproduce
Steps to reproduce the behavior:
sb migrate --parser=flow storiesof-to-csf --glob 'components/stories/*.js'
Expected behavior
The migrate tool converts my stories to CSF format
Screenshots
Failure due to babel parser not being able to parse flow types:
Additional context
The parser option is passed here -
storybook/lib/cli/bin/generate.js
Line 68 in dfe9eb7
storybook/lib/cli/lib/migrate.js
Line 3 in dfe9eb7
I tried to naively fix it by passing the parserOption through to
runCodeMod
, but it dies at the prettier stage:The text was updated successfully, but these errors were encountered: