-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate @storybook/preact to Typescript (#7527)
Migrate @storybook/preact to Typescript Co-authored-by: Norbert de Langen <[email protected]>
- Loading branch information
Showing
15 changed files
with
89 additions
and
31 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
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
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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,24 @@ | ||
/* eslint-disable prefer-destructuring */ | ||
import { start } from '@storybook/core/client'; | ||
|
||
import './globals'; | ||
import render from './render'; | ||
import { ClientApi } from './types'; | ||
|
||
const framework = 'preact'; | ||
const api = start(render); | ||
|
||
export const storiesOf: ClientApi['storiesOf'] = (kind, m) => { | ||
return (api.clientApi.storiesOf(kind, m) as ReturnType<ClientApi['storiesOf']>).addParameters({ | ||
framework, | ||
}); | ||
}; | ||
|
||
export const configure: ClientApi['configure'] = (...args) => api.configure(...args, framework); | ||
export const addDecorator: ClientApi['addDecorator'] = api.clientApi.addDecorator; | ||
export const addParameters: ClientApi['addParameters'] = api.clientApi.addParameters; | ||
export const clearDecorators: ClientApi['clearDecorators'] = api.clientApi.clearDecorators; | ||
export const setAddon: ClientApi['setAddon'] = api.clientApi.setAddon; | ||
export const forceReRender: ClientApi['forceReRender'] = api.forceReRender; | ||
export const getStorybook: ClientApi['getStorybook'] = api.clientApi.getStorybook; | ||
export const raw: ClientApi['raw'] = api.clientApi.raw; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { StoryFn, ClientStoryApi, Loadable } from '@storybook/addons'; | ||
|
||
export type StoryFnPreactReturnType = string | Node; | ||
|
||
export interface ShowErrorArgs { | ||
title: string; | ||
description: string; | ||
} | ||
|
||
export interface RenderMainArgs { | ||
storyFn: () => StoryFn<StoryFnPreactReturnType>; | ||
selectedKind: string; | ||
selectedStory: string; | ||
showMain: () => void; | ||
showError: (args: ShowErrorArgs) => void; | ||
forceRender: boolean; | ||
} | ||
|
||
export interface IStorybookStory { | ||
name: string; | ||
render: () => any; | ||
} | ||
|
||
export interface IStorybookSection { | ||
kind: string; | ||
stories: IStorybookStory[]; | ||
} | ||
|
||
export interface ClientApi extends ClientStoryApi<StoryFnPreactReturnType> { | ||
setAddon(addon: any): void; | ||
configure(loader: Loadable, module: NodeModule): void; | ||
getStorybook(): IStorybookSection[]; | ||
clearDecorators(): void; | ||
forceReRender(): void; | ||
raw: () => any; // todo add type | ||
load: (...args: any[]) => void; | ||
} |
File renamed without changes.
4 changes: 3 additions & 1 deletion
4
...act/src/server/framework-preset-preact.js → ...act/src/server/framework-preset-preact.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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
app/preact/src/server/options.js → app/preact/src/server/options.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare module '@storybook/core/*'; | ||
declare module 'global'; |
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,14 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"types": ["webpack-env"], | ||
"resolveJsonModule": true | ||
}, | ||
"include": [ | ||
"src/**/*" | ||
], | ||
"exclude": [ | ||
"src/**/*.test.*" | ||
] | ||
} |
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 |
---|---|---|
@@ -1 +1 @@ | ||
{"version":"5.2.0-beta.18","info":{"plain":"### Bug Fixes\n\n* Addon-docs: Ensure getNotes/getInfo return string ([#7597](https://github.com/storybookjs/storybook/pull/7597))\n* React/Angular/HTML/Vue: Fix typings for `configure` ([#7598](https://github.com/storybookjs/storybook/pull/7598))\n\n### Maintenance\n\n* Typescript: Migrate Vue ([#7578](https://github.com/storybookjs/storybook/pull/7578))\n\n### Dependency Upgrades\n\n* Upgrade corejs-upgrade-webpack-plugin lazy-universal-dotenv ([#7592](https://github.com/storybookjs/storybook/pull/7592))"}} | ||
{"version":"5.2.0-beta.18","info":{"plain":"### Bug Fixes\n\n* Addon-docs: Ensure getNotes/getInfo return string ([#7597](https://github.com/storybookjs/storybook/pull/7597))\n* React/Angular/HTML/Vue: Fix typings for `configure` ([#7598](https://github.com/storybookjs/storybook/pull/7598))\n\n### Maintenance\n\n* Typescript: Migrate Vue ([#7578](https://github.com/storybookjs/storybook/pull/7578))\n\n### Dependency Upgrades\n\n* Upgrade corejs-upgrade-webpack-plugin lazy-universal-dotenv ([#7592](https://github.com/storybookjs/storybook/pull/7592))"}} |
715a2f5
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 aliased the URL https://monorepo-e65n7km1z.now.sh to the following aliases: