-
Notifications
You must be signed in to change notification settings - Fork 15
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
chore(deps): update storybook to v6 #1638
Conversation
Bumps [@storybook/react](https://github.com/storybookjs/storybook/tree/HEAD/app/react) from 5.3.18 to 6.0.26. - [Release notes](https://github.com/storybookjs/storybook/releases) - [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md) - [Commits](https://github.com/storybookjs/storybook/commits/v6.0.26/app/react) Signed-off-by: dependabot-preview[bot] <[email protected]>
🥇 |
f9a4136
to
b5d4a90
Compare
baef09f
to
c88fbd5
Compare
@denieler not sure about an addon, but I think it's possible. However, I think that the current version is OK before we find a stable solution for customizing the sidebar. I'd do it within another story. |
I think we can't deploy it like this to picasso.toptal.net. It can confuse other devs, who are using Picasso site every day |
This sounds a bit scary to merge all screenshot images updated 😨 |
@denieler Getting rid of custom body styles is an advantage that worth it. We should assume that no component code has been touched (except types) meaning the components are the same. It took me 10 minutes to check all the screenshots. |
.storybook/components/PicassoBook/components/PropsTable/PropTypeTableCell.tsx
Show resolved
Hide resolved
@@ -23,8 +23,8 @@ export interface PropDocumentationMap { | |||
} | |||
|
|||
export interface Documentable { | |||
displayName: string | |||
__docgenInfo: any | |||
displayName?: string |
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.
why do we need this change?
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.
When using forwardRef
it returns ForwardRefExoticComponent
. In ForwardRefExoticComponent
displayName
is an optional string. Indicator
is a good example of such a component. So. when passing Indicator
to addComponentDocs
there is a TS error saying that displayName
should be string
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.
why this issue came up only now?
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.
It happened after TS upgrade
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.
probably not TS upgrade but rather react types?
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.
Not sure. I think the react types are the same. A lot of TS issues were ignored before the update.
20673fe
to
e935208
Compare
@denieler committed the fix |
🥇 |
@toptal-bot run package:alpha-release |
1 similar comment
@toptal-bot run package:alpha-release |
@toptal-bot run package:alpha-release |
@toptal-bot run package:alpha-release |
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.
I like it, much faster than SP5, do we have some problems to discuss before merge on which I could concentrate?
// we have left here 10px margin for visual tests | ||
// to make prettier screenshots and to avoid hiding | ||
// box shadows from the captured screenshots for some components | ||
document.body.style = 'padding: 0; margin: 10px !important;' |
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.
Do we need this padding? Or something changed in SB6?
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.
SB6 adds padding by default, so I've removed it
@@ -133,5 +130,8 @@ | |||
"lodash": "^4.17.12", | |||
"**/marksy/marked": "^0.6.0", | |||
"**/npx/npm": "^5.7.1" | |||
}, | |||
"dependencies": { | |||
"@storybook/react": "^6.0.27" |
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.
Should it also be in dev dependencies?
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.
yes
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.
but actually for root package json it doesn't really matter
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.
Interesting, how react is used during dev?
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.
@OleksandrNechai Storybook needs react to render the JSX
@toptal-bot run package:alpha-release |
@toptal-bot run package:alpha-release |
Your alpha package is ready 🎉 |
@toptal-bot run package:alpha-release |
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.
I'm still afraid of typescript related changes, let me try it out locally carefully to make sure nothing is broken
@teimurjan consider going one step forward diff --git a/tsconfig.build.json b/tsconfig.build.json
index 62335ffc..b7a57514 100644
--- a/tsconfig.build.json
+++ b/tsconfig.build.json
@@ -1,13 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
- "outDir": "dist-package",
- "paths": {
- "*": ["@types/*"],
- "~/*": ["./*"],
- "@toptal/picasso/*": ["node_modules/@toptal/picasso/src/*"],
- "@toptal/*": ["node_modules/@toptal/*/src"]
- }
+ "outDir": "dist-package"
},
"exclude": [
"**/*.example.jsx",
diff --git a/tsconfig.json b/tsconfig.json
index 8d3df2e4..688ffca6 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -16,20 +16,13 @@
"baseUrl": ".",
"typeRoots": ["node_modules/@types", "@types"],
"paths": {
- "@toptal/*": ["packages/*/src"],
- "@topkit/analytics-charts": ["packages/topkit-analytics-charts/src"],
- "@topkit/analytics-charts/*": ["packages/topkit-analytics-charts/src/*"],
- "@toptal/picasso/*": ["packages/picasso/src/*"],
- "@toptal/picasso-lab/*": ["packages/picasso-lab/src/*"],
- "@toptal/picasso-shared/*": ["packages/shared/src/*"],
- "@toptal/picasso-shared": ["packages/shared/src"],
- "@toptal/picasso-forms/*": ["packages/picasso-forms/src/*"],
- "@toptal/picasso-charts/*": ["packages/picasso-charts/src/*"],
"*": ["@types/*"],
- "~/*": ["./*"]
+ "~/*": ["./*"],
+ "@toptal/picasso/*": ["node_modules/@toptal/picasso/src/*"],
+ "@toptal/*": ["node_modules/@toptal/*/src"]
},
"types": ["node", "jest", "@testing-library/jest-dom"]
},
- "include": ["packages/*/src"],
+ "include": ["packages/*/src", "./cypress/integration", "./node_modules/cypress"],
"exclude": ["packages/*/dist-package"]
} |
` | ||
} | ||
|
||
const withSavingInitialPath = (cb, api) => { |
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.
Usually, we don't use abbreviations
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.
Instead of the callback, maybe it makes sense to return Promise?
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.
Not possible. The callback is used not as an end function, but it's called in between the steps. It'll be removed once storybookjs/storybook#12980 is merged.
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.
Well, I myself also have positive impressions from what I have seen so far. Works fast, looks beautiful 👍
Code is clean 👍 although I am not sure about exactly what each line does.
Tested
- locally
- deployment
- a few packages randomly
I could not see the content of the package (Explore tab) https://www.npmjs.com/package/@toptal/picasso/v/4.109.8-alpha-update-storybook-to-v6.1952
I could not make these packages work in code sandbox https://codesandbox.io/s/jovial-meninsky-n7c52?file=/package.json
I am now not sure if we have not broken package deployment here.
@toptal-bot run all |
🎉 Last commit is successfully deployed 🎉 Demo is available on: Your davinci-bot 🚀 |
@@ -27,8 +27,9 @@ | |||
"@toptal/picasso-charts/*": ["packages/picasso-charts/src/*"], | |||
"*": ["@types/*"], | |||
"~/*": ["./*"] | |||
} | |||
}, | |||
"types": ["node", "jest", "@testing-library/jest-dom", "cypress"] |
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.
I doubt it 😄 https://www.staging-typescript.org/tsconfig#types
By default all visible ”@types” packages are included in your compilation. Packages in node_modules/@types of any enclosing folder are considered visible. For example, that means packages within ./node_modules/@types/, ../node_modules/@types/, ../../node_modules/@types/, and so on.
If types is specified, only packages listed will be included in the global scope
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.
There is an error when not using types
:
cypress/integration/ModalAndTooltip.spec.ts:17:5 - error TS2304: Cannot find name 'cy'.
17 cy.get('[data-testid="datepicker"]').should('have.value', '11-03-2020')
Previously the problem was solved by adding "./node_modules/cypress" to include
. In this case expect
function in Jest tests is considered like expect
from cypress
.
Property 'toMatchSnapshot' does not exist on type 'Assertion'.ts(2339)
That's why the types
are required.
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, except types
fields which I doubt about
* chore(deps-dev): bump @storybook/react from 5.3.18 to 6.0.26 Bumps [@storybook/react](https://github.com/storybookjs/storybook/tree/HEAD/app/react) from 5.3.18 to 6.0.26. - [Release notes](https://github.com/storybookjs/storybook/releases) - [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md) - [Commits](https://github.com/storybookjs/storybook/commits/v6.0.26/app/react) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: migrate storybook to v6 * chore: add node types to tsconfig * chore: get rid of tsconfig.build paths * chore: fix menu expander * chore: fix storybook links * chore: update snapshots Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
* chore(deps-dev): bump @storybook/react from 5.3.18 to 6.0.26 Bumps [@storybook/react](https://github.com/storybookjs/storybook/tree/HEAD/app/react) from 5.3.18 to 6.0.26. - [Release notes](https://github.com/storybookjs/storybook/releases) - [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md) - [Commits](https://github.com/storybookjs/storybook/commits/v6.0.26/app/react) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: migrate storybook to v6 * chore: add node types to tsconfig * chore: get rid of tsconfig.build paths * chore: fix menu expander * chore: fix storybook links * chore: update snapshots Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
* chore(deps-dev): bump @storybook/react from 5.3.18 to 6.0.26 Bumps [@storybook/react](https://github.com/storybookjs/storybook/tree/HEAD/app/react) from 5.3.18 to 6.0.26. - [Release notes](https://github.com/storybookjs/storybook/releases) - [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md) - [Commits](https://github.com/storybookjs/storybook/commits/v6.0.26/app/react) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: migrate storybook to v6 * chore: add node types to tsconfig * chore: get rid of tsconfig.build paths * chore: fix menu expander * chore: fix storybook links * chore: update snapshots Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
* chore(deps-dev): bump @storybook/react from 5.3.18 to 6.0.26 Bumps [@storybook/react](https://github.com/storybookjs/storybook/tree/HEAD/app/react) from 5.3.18 to 6.0.26. - [Release notes](https://github.com/storybookjs/storybook/releases) - [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md) - [Commits](https://github.com/storybookjs/storybook/commits/v6.0.26/app/react) Signed-off-by: dependabot-preview[bot] <[email protected]> * chore: migrate storybook to v6 * chore: add node types to tsconfig * chore: get rid of tsconfig.build paths * chore: fix menu expander * chore: fix storybook links * chore: update snapshots Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
FX-1154
Closes #1597
Description
Updating Storybook from v5 to v6 is a pretty big thing. It includes some breaking changes. In terms of this PR, all the breaking changes are taken into account:
core-js
library.main.js
file.Problems
Investigation
Reason: The problem was caused by the conflict of the new story layout and our own body styles. In
v5
there was no padding for layout at all, so there was no conflict. Inv6
there is a default padding equals to1rem
. It can be avoided by usingexport const parameters = { layout: 'padded' }
inpreview.js
file. However, when we run visual testing we don't use Storybook'sindex.html
with all the stories. We use theiframe.html
with the only story in it. The body inside this iframe has the padding I've mentioned above. So the trouble is layout styles are controlled wheniframe.html
is used inside theindex.html
. When it's rendered separately the default style is used.Solution: We apply our own styles because of the better look of the image snapshots. However, now these styles are applied by default in Storybook (the only difference is: we use
margin: 10px
and Storybook usespadding: 1rem
). So I got rid of our own styles and made the layout property to bepadded
in the parameters. It affected all the images snapshots but I manually compared every diff and can claim that nothing is broken.How to test
Screenshots
Review
js/jsx
file intots/tsx
in your PRprops
in component with documentationexamples
for componentyarn test
yarn test:visual
. If not - check the documentation how to fix visual testsPR commands
List of available commands:
@toptal-bot run all
- Run whole pipeline@toptal-bot run danger
- Danger checks@toptal-bot run lint
- Run linter@toptal-bot run test
- Run jest@toptal-bot run build
- Check build@toptal-bot run test:visual
or@toptal-bot run visual
- Run visual tests@toptal-bot run deploy:documentation
- Deploy documentation@toptal-bot run package:alpha-release
- Release alpha version