Skip to content

A codemod that replaces Storybook Info Addon's deprecated `withInfo` decorator with `info` parameter.

Notifications You must be signed in to change notification settings

zaki-yama-labs/codemod-storybook-addon-info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Codemod for Storybook Info Addon

A codemod that replaces Storybook Info Addon's deprecated withInfo() decorator with info parameter.

// before
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { withInfo } from '@storybook/addon-info';

import Button from './Button';

storiesOf('Button', module)
  .add('Default', withInfo('Default button')(() => (
    <Button label="The Button" onClick={action('click')} />
  )));
// after
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';

import Button from './Button';

storiesOf('Button', module)
  .add('Default', () => (
    <Button label="The Button" onClick={action('click')} />
  ), {
  info: 'Default button'
});

NOTE: It doesn't replace addWithInfo API with withInfo. You can use the official codemod here: https://github.com/storybookjs/storybook/tree/next/lib/codemod

Usage

$ npm install
$ npx jscodeshift -t transformer.js <path to your stories>

About

A codemod that replaces Storybook Info Addon's deprecated `withInfo` decorator with `info` parameter.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published