Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add information about React-styleguidist #921

Closed
wants to merge 1 commit into from

Conversation

just-boris
Copy link
Contributor

Since I have checked PR #738 about React-Storybook integration and left some comment about that, I continued my search and have found another option: React-styleguidist.

This tool uses a bit different approach, but it fits better in the Create React App convention-based way.

  • All your components will be picked up by some glob expression, like this './src/components/**/!(*.test).js'
  • Components definitions will be analyzed to create API documentation based on PropTypes. (Powered by react-docgen)
  • You can add Readme.md for every folder with component, where you can write some documentation about it. And (I really like that part) all code snippets will be compiled and executed. So your documentation is still usable as typical Markdown files, but then you can run styleguide builder to see them in action.

I tried to create an integration between Create React App and React Styleguidist as easy as possible, so it worth trying, any feedback will be appreciated.

Also, there is one more similar tool – Carte-Blanche, but it is provided as Webpack plugin, but as far as Webpack config is not available here for direct changes, it was not possible to test it.

@marvinhagemeister
Copy link

We are currently using react-styleguidist at work and are loving it for the simplicity. It is also much more approachable for our ux designers. One thing to watch out for though is performance. Since it includes in-browser babel compiling and codemirror (web code editor) the bundle size is huge (~6mb). That takes a toll on loading time unfortunately

@sapegin
Copy link
Contributor

sapegin commented Nov 3, 2016

@marvinhagemeister Thanks, I’m happy to hear that you like it! I think you’ll be glad to know that the next version will have much smaller bundle: we’ve replaced babel-standalone with buble (small and fast ES6+JSX transpiler) and CrodeMirror is loaded on demand.

@gaearon
Copy link
Contributor

gaearon commented Nov 20, 2016

I would like to see Storybook and Styleguidist be subsections in a larger section called "Working on Components in Isolation". Its intro should explain the problem and mention there are multiple tools that do this. If you restructure it this way I'd be happy to merge it.

Copy link
Contributor

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs restructuring

@just-boris
Copy link
Contributor Author

Well, will pick this up and update by the end of this week.

npm install react-app-styleguidist --save-dev
```

Then add `styleguide` section into your package.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be inside scripts, not on the top level.

@just-boris
Copy link
Contributor Author

just-boris commented Dec 1, 2016

Synchronized my changes with the latest version in the master. However, now I doubt that we should merge it because it just makes README file more and more overwhelming.

Anyway, I have updated the content, and it is kinda ready to merge.

@gaearon
Copy link
Contributor

gaearon commented Feb 11, 2017

After adding the dependency, I got a peer dependency warning: Incorrect peer dependency "react-scripts@^0.6.1".

Ignoring it, I followed the instructions to run the styleguide server. It was silent for a while (I wasn't sure if it was hanging), and after 10 seconds it printed:

> styleguidist server ./src/App.js

webpack built a028b9923373b2313d45 in 9289ms

There is no indication of which URL I should open, or that it was building the project. It turned out that it was running at 3000—same as CRA default port—which is a little bit confusing from integration point of view.

Finally, after opening it in the browser, this is all I see:

screen shot 2017-02-11 at 23 24 52

It's weird because the component doesn't seem to be there.

All in all, I'd be happy to include this, but the project doesn't seem to get the small (but important) details right yet.

@sapegin
Copy link
Contributor

sapegin commented Feb 12, 2017

Hi! Dan, thanks for your feedback! How can we improve it?

We’re testing a new version that should work with CRA out of the box.

Ignoring it, I followed the instructions to run the styleguide server. It was silent for a while (I wasn't sure if it was hanging), and after 10 seconds it printed:

This shouldn’t be a problem.

It turned out that it was running at 3000—same as CRA default port—which is a little bit confusing from integration point of view.

This is easy to change.

It's weird because the component doesn't seem to be there.

  1. You need to have some documentation that Styleguidist can show.

  2. There’s no point in showing App component, the default glob for components is now src/components/**/*.js.

I think it’s better to close this PR and I’ll send a new one as soon as we release a final version. Probably with steps similar to the new official installation guide

@gaearon
Copy link
Contributor

gaearon commented Feb 12, 2017

Sounds good! I'm happy to get the PR in (sorry I haven't been responsive, but I was busy with React itself, and you might have noticed most other PRs were also neglected at the time). But we need to make sure that the first impression is pleasant and not confusing. I think storybook does it well with friendly console messages and generally predictable behavior.

@sapegin
Copy link
Contributor

sapegin commented Feb 12, 2017

Awesome!

By the way do you know any open source projects I can use to test CRA integration?

@gaearon
Copy link
Contributor

gaearon commented Feb 12, 2017

These are two small ones: http://andrewhfarmer.com/sample-apps-create-react-app/

You can also search for react-scripts in package.json on GH.

@gaearon
Copy link
Contributor

gaearon commented Feb 24, 2017

I think it’s better to close this PR and I’ll send a new one as soon as we release a final version.

Let's do that. 👍

@gaearon gaearon closed this Feb 24, 2017
@sapegin sapegin mentioned this pull request Apr 28, 2017
@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants