reg-viz / storycap

A Storybook Addon, Save the screenshot image of your stories :camera: via puppeteer.
https://www.npmjs.com/package/storycap
MIT License
711 stars 89 forks source link

Feature Request: `skip` as a condition function #465

Open lacolaco opened 3 years ago

lacolaco commented 3 years ago

Proposal

Add another format of skip option to allow developers control of on/off capturing screenshot flexibly.

export const parameters = {
  screenshot: {
    skip: (story) => /deprecated/i.match(story.storyName),
  },
};
Quramy commented 3 years ago

@lacolaco Do you want to ignore some stories using stories name ?

Storycap CLI accepts --exclude and --include options.

  -i, --include                    Including stories name rule.                                    [array] [default: []]
  -e, --exclude                    Excluding stories name rule.                                    [array] [default: []]
storycap http://example.com/your-storybook --exclude "**/deprecated/**"
lacolaco commented 3 years ago

@Quramy Thanks for the information. That is enough to solve what I want to do. 👍

[array] [default: []]

It confused me what type that options will handle as valid value.