-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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: Improve Storybook packages version management #11342
Conversation
760a39b
to
d9976cf
Compare
0611769
to
75cfc53
Compare
"prepare": "node ../../scripts/prepare.js && node -r esm ./scripts/generate-sb-packages-versions.js", | ||
"test": "cd test && ./run_tests.sh", | ||
"test-yarn-2": "cd test && ./run_tests_yarn_2.sh", | ||
"postversion": "node -r esm ./scripts/generate-app-versions.js" | ||
"postversion": "node -r esm ./scripts/generate-sb-packages-versions.js" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shilman can you confirm that with these 2 lines, versions.json
will be recreated during the release process (after the version bump) and then committed to the repo?
…ckages The previous script was only extracting version for packages under `app` directory. Now, all `@storybook` packages are processed and save with their current version in the monorepo in `versions.json`. This file will be use to find out which version of the packages should be installed when running `sb init`.
Previously it used `devDep` of `package.json`. It was working but doing so all Storybook packages had to be added to `devDep`. Moreover, as `@storybook/react-native` was not part of the monorepo anymore it's version was stuck to `6.0.0-alpha.0` causing a download of `6.0.0-alpha.0` SB packages when running `yarn install`.
These deps were only there to help to find out which version should be installed when using the CLI. This is now done with a dedicated `versions.json` file not theya re not needed in `package.json` anymore. Bonus: it removes some `6.0.0-alpha.0` SB packages that were required by `"@storybook/react-native": "6.0.0-alpha.0"`
`@babel/plugin-transform-react-jsx` should be resolved in the context of `addon-docs` and not in the one of SB user projects (as it's done for the others loaders too). The goal of that is to ensure we are using a deps that is properly declared either as dep or peerDep
531b8cf
to
44348e8
Compare
…n 2 out of the box
CLI now generates project with `addon-essential` so it enable `addon-viewport` by default. I added a simple test to check that viewport is properly loaded: - Go to Welcome Story - Click on Viewport button in the toolbar - Select "Small Mobile" - Check that Welcome Story is still displayed
44348e8
to
3e13343
Compare
I discussed a bit with @shilman about mdx and tried to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @gaetanmaisse !!! 👏 👏 👏
@shilman can I merge this PR or should I wait as we are now in RC? |
What I did
♻️ Refactor script to extract and save versions of all SB packages:
The previous script was only extracting version for packages under
app
directory. Now, all@storybook
packages are processed and save with their current version in the monorepo inversions.json
. This file will be used to find out which version of the packages should be installed when runningsb init
.🆕 Use
versions.json
to get SB packages versions🗑️ Remove all Storybook packages listed as
devDeps
:These deps were only there to help to find out which version should be installed when using the CLI. This is now done with a dedicated
versions.json
file so they are not needed inpackage.json
anymore.Bonus: it removes some
6.0.0-alpha.0
SB packages that were required by"@storybook/react-native": "6.0.0-alpha.0"
➕ Add some dependencies to be able to run
addon-docs
with Yarn 2 out of the box:@storybook/addon-docs
is needed as a 1st level dep as we are importing things from@storybook/addon-docs/blocks
in mdx stories.@mdx-js/react
, SB won't deal with mdx file without adding this dep (so this is a temporary work-around). I need to discuss with you @shilman to deeply understand how mdx stories are working.🤖 CLI now generates projects with
addon-essential
so it enablesaddon-viewport
by default. I added a simple test to check that viewport is properly loaded:How to test