-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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 addon storyshots to TS #7674
Conversation
This pull request is automatically deployed with Now. Latest deployment for this branch: https://monorepo-git-ts-migration-addon-storyshots.storybook.now.sh |
6cbddb0
to
a489be9
Compare
a489be9
to
68c97ad
Compare
@shilman @ndelangen should all stories from storyshots-core be migrated to TS? kept to JS? Duplicated to TS? |
c28cccb
to
9fef497
Compare
addons/storyshots/storyshots-core/src/frameworks/react-native/loader.ts
Outdated
Show resolved
Hide resolved
storyKindRegex?: RegExp | string; | ||
storyNameRegex?: RegExp | string; | ||
framework?: SupportedFramework; | ||
test?: (story: any, context: any, renderTree: RenderTree, options?: any) => any; |
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.
@ndelangen @kroeder are there already existing types somewhere for story
and context
?
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, in lib/addons
@@ -26,6 +26,9 @@ | |||
}, | |||
"dependencies": { | |||
"@storybook/addons": "5.2.0-beta.22", | |||
"@types/glob": "^7.1.1", | |||
"@types/jest": "^24.0.16", | |||
"@types/jest-specific-snapshot": "^0.5.3", |
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.
@emilio-martinez @kroeder @ndelangen what's the best practice about @types
in SB codebase? I added them in dependencies
because some of the types I exported in this addon are based on jest
(and other libs) ones. So if a SB user want to use SB type it should install @types/jest
too... 🤷♂
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.
We'll talk about this later today, but I think the preliminary agreement is to add the types of a regular dependency also as a regular dependency.
@@ -42,7 +44,9 @@ function load(options) { | |||
}; | |||
} | |||
|
|||
export default { | |||
const angularLoader: Loader = { |
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's the way I found to have type-check according to Loader
class, if anyone has a better proposition?
…don-storyshots Also improve a bit the typings
… be migrated to TS
Make react native folder name and so loader name consistent with others and also with storyshot "framework" option (that support 'react-native' string)
… storyshots options
…ligned with puppeteer attributes anymore
Framework name should match the one used in framework loader (in this case React Native loader: https://github.com/storybookjs/storybook/pull/7674/files#diff-d72af9277db9c8a6cb1b3595750de8c4R9)
`puppeteer-core` package is a version of `puppeteer` that doesn't download Chromium by default. It looks like chromium is not directly used here as it was only a `peerDependencies` or an `optionalDependencies`. So I moved to `puppeteer-core` to be able to compile TS sources of this addon without downloading Chromium at every `yarn install`
42d45a0
to
aad29ed
Compare
* [@storybook/addon-storyshots] remove typings as they're now provided by the package directly TS migrate of the package was done in storybookjs/storybook#7674 * [@storybook/addon-storyshots-puppeteer] remove typings as they're now provided by the package directly TS migrate of the package was done in storybookjs/storybook#7674
What I did
@storybook/addon-storyshots
and@storybook/addon-storyshots-puppeteer
to TypeScriptTracking Issue: #5030