Skip to content

Releases: styleguidist/react-styleguidist

2.0.1

24 Feb 11:17
Compare
Choose a tag to compare
  • Fix Node 0.12 compatibility.
  • styleguidist build exits with an error code when build fails.

2.0.0

22 Feb 09:21
Compare
Choose a tag to compare

Here is a list of changes since 1.3.2 (changes since 2.0.0-rc6: fixed npm2 compatibility, removed rootDir, added assetsDir, no params are passed to components function).

Breaking changes

No default Webpack loaders for your project’s code

Now you need to explicitly specify all Webpack loaders for your project’s code in styleguide.config.js:

module.exports = {
    // ...
    updateWebpackConfig: function(webpackConfig, env) {
        var sourceDir = path.resolve(__dirname, 'src');  // Affect only your project’s files
        webpackConfig.module.loaders.push(
            // Babel (will use your project’s .babelrc)
            {
                test: /\.jsx?$/,
                include: sourceDir,
                loader: 'babel'
            },
            // Sass
            {
                test: /\.scss$/,
                include: sourceDir,
                loader: 'style!css!sass?precision=10'
            }
        );
        return webpackConfig;
    }
};

Your project’s .babelrc will not affect Styleguidist, only the loaders you define in styleguide.config.js.

When you run dev-server NODE_ENV is set to development so if you use React Transform hot module replacement it will be enabled for your components. Otherwise you need to set it up manually. When you build style guide NODE_ENV is set to production.

This change should reduce the number of conflicts between your code and Styleguidist’s.

Babel 6

Babel 6 is required now.

No rootDir config option

component option is now relative to config file location.

// 1.3.2
module.exports = {
  rootDir: './lib',
  components: './components/**/*.js',
  // ...
};

// 2.0.0
module.exports = {
  components: './lib/components/**/*.js',
  // ...
};

No params are passed to components function

Less magic, just use your own glob:

// 1.3.2
module.exports = {
  // ...
  components: function(config, glob) {
    return glob.sync(config.rootDir + '/components/**/*.js').filter(function(module) {
      return /\/[A-Z]\w*\.js$/.test(module);
    });
  }
};

// 2.0.0
var path = require('path');
var glob = require('glob');
module.exports = {
  // ...
  components: function() {
    return glob.sync(path.resolve(__dirname, 'lib/components/**/*.js')).filter(function(module) {
      return /\/[A-Z]\w*\.js$/.test(module);
    });
  }
};

Code examples without React playground

If you define a fenced code block with a language flag like this:

```javascript
import React from 'react';
```

it will be rendered as a regular Markdown code snippet:

import React from 'react';

New features

  • assetsDir config option. Serve this directory as static in dev-server, you can access any files at /.

Other changes

  • react-docgen updated to 2.7.0 that support flow proptypes (#79 by @codemix).

Fixes

  • Do not escape inline code blocks (#71).
  • Fallback to file name or folder name if component name can’t be detected in runtime (#84).
  • Styleguidist Babel loader should not read project’s .babelrc file.

2.0.0-rc6

18 Feb 21:50
Compare
Choose a tag to compare
2.0.0-rc6 Pre-release
Pre-release

Breaking changes

Render fenced blocks with language flag as regular Markdown code snippets.

If you define a fenced code block with a language flag like this:

```javascript
import React from 'react';
```

it will be rendered as a regular Markdown code snippet:

import React from 'react';

Fixes

  • Do not escape inline code blocks (#71).

2.0.0-rc5

17 Feb 11:01
Compare
Choose a tag to compare
2.0.0-rc5 Pre-release
Pre-release

Fix error about dog-names module which is used on the example page and shouldn’t be required when you install react-styleguidist.

2.0.0-rc4

17 Feb 10:28
Compare
Choose a tag to compare
2.0.0-rc4 Pre-release
Pre-release

Breaking changes

Now you need to explicitly specify all Webpack loaders for your project’s code in styleguide.config.js:

module.exports = {
    // ...
    updateWebpackConfig: function(webpackConfig, env) {
        var sourceDir = path.resolve(__dirname, 'src');
        webpackConfig.module.loaders.push(
            // Babel (will use your project’s .babelrc)
            {
                test: /\.jsx?$/,
                include: sourceDir,
                loader: 'babel'
            },
            // Sass
            {
                test: /\.scss$/,
                include: sourceDir,
                loader: 'style!css!sass?precision=10'
            }
        );
        return webpackConfig;
    }
};

Your project’s .babelrc will not affect Styleguidist, only the loaders you define in styleguide.config.js.

When you run dev-server NODE_ENV is set to development so if you use React Transform hot module replacement it will be enabled your components. Otherwise you need to set it up manually. When you build style guide NODE_ENV is set to production.

This is a big change so I’m looking forward for your feedback.

Other changes

  • Remove postcss to reduce possible conflicts with project’s code: postcss-loader would share plugins.
  • Fallback to file name or folder name if component name can’t be detected in runtime (#84).

2.0.0-rc3

08 Feb 13:26
Compare
Choose a tag to compare
2.0.0-rc3 Pre-release
Pre-release
  • Try to fix problem with unknown displayName (#74).

2.0.0-rc2

08 Feb 12:46
Compare
Choose a tag to compare
2.0.0-rc2 Pre-release
Pre-release
  • Move babel-preset-react-hmre and babel-standalone to dependencies.

2.0.0-rc

08 Feb 08:41
Compare
Choose a tag to compare
2.0.0-rc Pre-release
Pre-release

Breaking changes

Babel 6

(#81 by @oliverturner)

Custom Babel environment

  • Set NODE_ENV to development or production.
  • Set BABEL_ENV to styleguidist or production. Move hot reload config into styleguidist environment to prevent collisions with project’s Babel configuration (#58).

Other changes

  • react-docgen updated to 2.7.0 that support flow proptypes (#79 by @codemix).
  • Serve root directory as static in dev-server (so you can access any files inside the root directory).

Please try it and report any issues or ideas how to improve it.

1.3.2

08 Jan 08:30
Compare
Choose a tag to compare
  • Remove ExtractTextPlugin.
  • Fix typo in CSS.

1.3.1

16 Dec 14:12
Compare
Choose a tag to compare

Bug fixes by @lovelybooks:

  • Fix npm 2 support (#59, #66).
  • Fix layout for wiiide components (#67).