-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7674 from storybookjs/ts-migration/addon-storyshots
Migrate addon storyshots to TS
- Loading branch information
Showing
44 changed files
with
393 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s-core/src/Stories2SnapsConverter.test.js → ...s-core/src/Stories2SnapsConverter.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
addons/storyshots/storyshots-core/src/api/StoryshotsOptions.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { IOptions } from 'glob'; | ||
import { Stories2SnapsConverter } from '../Stories2SnapsConverter'; | ||
import { SupportedFramework } from '../frameworks'; | ||
import { RenderTree } from '../frameworks/Loader'; | ||
|
||
export interface StoryshotsOptions { | ||
asyncJest?: boolean; | ||
config?: (options: any) => void; | ||
integrityOptions?: IOptions | false; | ||
configPath?: string; | ||
suite?: string; | ||
storyKindRegex?: RegExp | string; | ||
storyNameRegex?: RegExp | string; | ||
framework?: SupportedFramework; | ||
test?: (story: any, context: any, renderTree: RenderTree, options?: any) => any; | ||
renderer?: Function; | ||
snapshotSerializers?: jest.SnapshotSerializerPlugin[]; | ||
/** | ||
* @Deprecated The functionality of this option is completely covered by snapshotSerializers which should be used instead. | ||
*/ | ||
serializer?: any; | ||
stories2snapsConverter?: Stories2SnapsConverter; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
addons/storyshots/storyshots-core/src/frameworks/Loader.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ClientApi } from '@storybook/client-api'; | ||
import { StoryshotsOptions } from '../api/StoryshotsOptions'; | ||
import { SupportedFramework } from './SupportedFramework'; | ||
|
||
export type RenderTree = (story: any, context?: any, options?: any) => any; | ||
|
||
export interface Loader { | ||
load: ( | ||
options: StoryshotsOptions | ||
) => { | ||
framework: SupportedFramework; | ||
renderTree: RenderTree; | ||
renderShallowTree: any; | ||
storybook: ClientApi; | ||
}; | ||
test: (options: StoryshotsOptions) => boolean; | ||
} |
9 changes: 9 additions & 0 deletions
9
addons/storyshots/storyshots-core/src/frameworks/SupportedFramework.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type SupportedFramework = | ||
| 'angular' | ||
| 'html' | ||
| 'preact' | ||
| 'react' | ||
| 'riot' | ||
| 'react-native' | ||
| 'svelte' | ||
| 'vue'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
38d8c4f
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.
Successfully deployed to following URLs: