Closed drik98 closed 1 year ago
@drik98 i'm confused. is something actually broken?
what's going on is that we introduced a feature in 6.4 called automigrations. when you upgrade, it checks for some common configuration changes that needs to be fixed. if it finds something, it will ask you if you want to make the change. if it doesn't prompt you, it means that it didn't find anything that needs changing.
It just stops with this step. No prompt or anything. No error message. No cvs changes, everything gets reset.
Note that npx storybook init
fails as well at the same point if I remove everything storybook related. ( Just a few days ago I was still working with 6.4.22)
@drik98 I see, thanks for the clarification. Do you a have a reproduction repo you can share? If not, can you create one? See how to create a repro.
Alternatively, perhaps you could go into node_modules/@storybook/cli/dist/cjs/automigrate/fixes/builder-vite.js
and add some console.log
settings to see exactly where it's hanging?
Hello @shilman,
I am not able to create a repro as it instantly works when selecting vue2 as a preset.
But I was just able to to debug the builder-vite.js
file as you said. run
and prompt
are never executed.
The following happens in check
:
const builder = main.getFieldValue(['core', 'builder']);
// builder --> undefined
const builderName = typeof builder === 'string' ? builder : builder === null || builder === void 0 ? void 0 : builder.name;
// builderName --> undefined
if (builderName !== 'storybook-builder-vite') {
return null;
}
// as builderName is undefined" this evaluates to true and the function returns null. That seems to be where the upgrade process just stops.
Upon further investigation it seems in node_modules/@storybook/cli/dist/cjs/automigrate/index.js
it just skips the check so that should not be why the upgrade process just stops.
Just found out about the --skip-check
flag. The issue seems to be unrelated to vite or any checks. It just does not want to upgrade the storybook version it seems.
@IanVS is this related to the vite automigration?
@yannbf @drik98 I think it's finished. It loops through all the automigrations and builderVite
is the last automigration. The code @drik98 has highlighted above returns null
, meaning that there is nothing left to do, which is consistent with the fact that the project is not using vite.
I guess the question is why doesn't the process exit after that?
@yannbf I know you were going to change the logging behavior of automigrate
. Perhaps you could add a โ
done
at the end?
Yeah, a "Done" would probably be a good addition even though there seems to be nothing wrong with automigrate (or vite, I think).
The problem seems to lie somewhere else. When checking the code of the upgrade script the "automigrate" step seems to be the last IIRC. Still none of the @storybook/*
dependencies seem to have been upgraded at this point (or later).
I am just so confused as to why nothing happens with no error or termination message.
Where and when exactly do the @storybook/*
dependencies get updated? If you point me to the correct file maybe I can debug it and find the error.
Where and when exactly do the
@storybook/*
dependencies get updated? If you point me to the correct file maybe I can debug it and find the error.
I really appreciate your help!
No need to thank me. I greatly appreciate your work with storybook. It really makes developing and documenting much easier!
So I managed to install version 6.5.4 and successfully build it. I could not do it with the "cli" but I think the problem lies with my machine.. What I found out is the command you linked above evaluates to
npx npm-check-updates@latest /storybook/ --upgrade --target latest
because flags
contains [ '--upgrade', '--target', 'latest' ]
.
Now the ncu command logs the following:
,,npx: Installierte 259 in 6.658s
Unexpected token '.'
As you can maybe see above (issue description )that already happened from the beginning. But It also happens when I run the command on its own. So the problem does not lie with storybook but with either ncu or me.
I did some googling and it seems to be a problem with npm itself (or perhaps in combination with fnm/nvm).
I installed npm-check-updates globally using yarn (normally not using yarn) and executed the command without npx
npm-check-updates /storybook/ --upgrade --target latest
and voila it works.
The weird part for me is that npm-check-updates apparently encounters some kind of error ("Unexpected token '.'") but doesn't seem to throw an error after it, which then results in Storybook not being able to throw an error.
Weโre cleaning house! Storybook has changed a lot since this issue was created and we donโt know if itโs still valid. Please open a new issue referencing this one if:
Describe the bug I am currently on version 6.4.22 of storybook. When trying to run
npx sb@latest upgrade
it tries to upgrade as usual but it suddenly stops without any further message at the step๐ checking 'builder-vite'
.Note that I do not use the vite builder. Is this a breaking change? Do we have to move to vite in order to use newer versions of storybook?
To Reproduce Please create a reproduction by running
npx sb@next repro
and following the instructions. Read our documentation to learn more about creating reproductions. Paste your repository and deployed reproduction here. We prioritize issues with reproductions over those without.Currently no time for that. Sorry.
System Please paste the results of
npx sb@next info
here.Additional context Here is the complete log: