You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user, I want to create new story files and trigger the generation from the manager UI.
In this feature request, we want to implement the backend side to provide a server channel listener, which creates a new story file and emits an event to notify about the success/failure of the operation.
// Just a rough example of the structure of the serverChannel API implementation.// It is intended as an indication and not as a given.interfaceData{// The filepath of the component for which the Story should be generated forfilepath: string;// The name of the exported componentcomponentExportName: string;// is default exportdefault: boolean}exportconstexperimental_serverChannel=async(channel: Channel,options: Options)=>{channel.on(CREATE_STORYFILE,async(data: Data)=>{// Create a new Story file// Send an event via server channel to the browser to notify about the success/failure of the operation});returnchannel;};
Requirements
In TypeScript projects, we want to create the following skeleton:
//If default exportimport$$ComponentName$$from'<path-to-component>';//If named export// import { $$ComponentName$$ } from '<path-to-component>';importtype{Meta,StoryObj}from'@storybook/<your-framework>';constmeta={component: $$ComponentName$$}satisfiesMeta<typeof$$ComponentName$$>exportdefaultmeta;typeStory=StoryObj<typeofmeta>;exportconstDefault: Story={}
In JavaScript projects, we want to create the following skeleton:
//If default exportimport$$ComponentName$$from'<path-to-component>';//If named export// import { $$ComponentName$$ } from '<path-to-component>';constmeta={component: $$ComponentName$$}exportdefaultmeta;exportconstDefault={}
If a story file already exists, we have to consider two things: If the existing story file already defines stories for the exported component for which we want to create a new story file, we will throw an error. If there is an existing story file, but the stories are written for another exported component, we create another file, following a naming schema like this: <path-to-component-folder>/<filename-without-extension>.<name-of-the-exported-component>.stories.<file-extension-of-the-component>. If a story file doesn't exist, we create one by applying the following naming schema: <path-to-component-folder>/<filename-without-extension>.stories.<file-extension-of-the-component>
valentinpalkovic
changed the title
Create a server channel API to create new story files triggered by the manager UI
[Project: SfC]: Create a server channel API to create new story files triggered by the manager UI
Mar 27, 2024
valentinpalkovic
changed the title
[Project: SfC]: Create a server channel API to create new story files triggered by the manager UI
[Project SfC]: Create a server channel API to create new story files triggered by the manager UI
Mar 27, 2024
As a user, I want to create new story files and trigger the generation from the manager UI.
In this feature request, we want to implement the backend side to provide a server channel listener, which creates a new story file and emits an event to notify about the success/failure of the operation.
Requirements
<path-to-component-folder>/<filename-without-extension>.<name-of-the-exported-component>.stories.<file-extension-of-the-component>
. If a story file doesn't exist, we create one by applying the following naming schema:<path-to-component-folder>/<filename-without-extension>.stories.<file-extension-of-the-component>
Abstract
Possible further encapsulated increments
The text was updated successfully, but these errors were encountered: