chrisvxd / story2sketch

Convert Storybook into Sketch symbols 💎
Other
402 stars 32 forks source link

Support Storybook v5 #91

Closed gabriel-kohen-by closed 3 years ago

gabriel-kohen-by commented 4 years ago

It seems like the latest supported is v4. Most new updates to storybook are done to v5

njradford commented 4 years ago

@chrisvxd - Storybook v4 to v5 seemed to be a less severe jump than 3 to 4. Do you have an idea of what aspects of story2sketch would break in an upgrade to 5?

(Awesome project by the way.)

FarisSum commented 4 years ago

Hi @gabriel-kohen-jdas I was able to export a JSON, even with Storybook 6.0 alpha.

However, when importing into sketch, all I get is a "Stories" layer with nothing inside.

What do you think could be the issue?

jakub-bujakowski commented 4 years ago

Any progress with this issue? I'm using Storybook 5 and can generate the json file, but Sketch throws and error that layers couldn't be imported :/

jrwpatterson commented 4 years ago

Are there any updates to this, I would hate to have to download storybook for this software?

jrwpatterson commented 4 years ago

Partly because I can't even find the documentation for v4.x.x

jrwpatterson commented 4 years ago

@jakub-bujakowski did you find an issue as I have the same problem

FarisSum commented 4 years ago

@jrwpatterson @jakub-bujakowski @njradford @gabriel-kohen-jdas

The below works for me in 6.0 alpha actually:

  1. npm run build-storybook
  2. npm run story2sketch (looks to the index.html INPUT that's generated in step 1) **
  3. The OUTPUT is a JSON file **

** story2sketch.config.js is required, where the INPUT and OUTPUT directories are specified.

Make sure the above commands work in your package.json scripts: Script 1: https://storybook.js.org/docs/basics/exporting-storybook/ Script 2: "story2sketch": "story2sketch "

merryt commented 4 years ago

~@FarisSum Would you mind sharing your story2sketch.config.js?~

I was able to duplicate @FarisSum solution with the following config in 6.0.0-beta.0 but you do need to build storybook first, then run against the built version

module.exports = { output: "dist/great-ui.asketch.json", stories: "all", input: "storybook-static/iframe.html" };

Although this does "work" I then get the errors from #59 ... could be related, could be just me

FarisSum commented 4 years ago

@merryt

Instead of using stories: "all", try utilizing the layoutBy + specify the individual stories in story2sketch.config.js:

...
layoutBy: 'group',
stories: [
    {
      group: 'Buttons',
      stories: [
        {
          name: 'Large Button',
        }
        {
          name: 'Small Button',
        }
      ]
    }
]
...

You can also try groupBy, which will create multiple JSON files.

Perhaps you will find if any particular story it the root cause of the layer errors.

Curious what you get...

jrwpatterson commented 4 years ago

@merryt yup thats my issue the #59

merryt commented 4 years ago

I was able to get it to work by rolling sketch back to v63.1 , YMMV, but my issue was caused by https://github.com/html-sketchapp/html-sketchapp/issues/191 not #59

Ellzer commented 4 years ago

Any update on this ?

itsderek23 commented 3 years ago

I was able to get this running with Sketch v69.2 and Storybook v6 by using the updated asketch2sketch plugin that is available in html-sketchapp v4.4.1. Without this update, no layers could be imported. For background on this fix, see https://github.com/html-sketchapp/html-sketchapp/issues/196.

My commands:

yarn run build-storybook
yarn run story2sketch --input storybook-static/iframe.html --output stories.asketch.json

I did get a remainingTimeoutError: Navigation Timeout Exceeded: 30000ms exceeded error with the following, but I didn't debug futher (maybe it goes away if I increase the timeout) and decided to just use the built version:

yarn run story2sketch --url http://localhost:6006/iframe.html --output stories.asketch.json

Screenshot:

image

chrisvxd commented 3 years ago

Closed by #103, thanks again @itsderek23!

chrisvxd commented 3 years ago

Landed officially in v1.7.1