reg-viz / storycap

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

Run cli from node JS #26

Open alexeybondarenko opened 6 years ago

alexeybondarenko commented 6 years ago

@tsuyoshiwada I'm working on the project, that has several themes and I have to capture some of these themes. I've written the addon that adds variants to the Storybook Pannel and they can be configurable in storybook config.

Now, I'm looking for the way to run capture phase multiple times, with changes in the storybook instance. Looks like this can be done if I would be able to run addon cli from NODE JS script, that will allow me to run capturing manually.

What do you think about this?

alexeybondarenko commented 6 years ago

So I propose to extract the runner from the addon to be able to use it in the node js script.

e.g.

new screenshotInstance = new ScreenshotStorybook(channel)

screenshotInstance.capture({ /**..some capture options **/ })
screenshotInstance.capture({ /**..another capture options **/ })
wadackel commented 6 years ago

Hi @alexeybondarenko I appreciate the attractive proposal! I agree that it will become operable from a script.

I think that I will also consider the API with reference to what you suggested :smiley:

alexeybondarenko commented 6 years ago

@tsuyoshiwada I think I can make the PR with these changes If you agree in general with this feature 😄

wadackel commented 6 years ago

@alexeybondarenko Thanks :+1: !!

The other day, I changed the code base greatly. Please contact us whenever you need help. :smile:

alexeybondarenko commented 6 years ago

@tsuyoshiwada I have troubles with that. Probably, you can help me to create the example?

wadackel commented 6 years ago

@alexeybondarenko

of course :muscle: !! Specifically, what kind of help do I need?