Repository: styleguidist/react-styleguidist
Pull request #934 (2018-04-11 10:15:54)

bin: Don't report 'On your network' on localhost
When explicitly setting the serverHost to 127.0.0.1 or localhost,
urls.lanUrlForTerminal is undefined. It makes no sense to print out
undefined, therefore only show the 'On your network' line when it's
defined.


Patch:
diff --git a/bin/styleguidist.js b/bin/styleguidist.js
index bcaef322..3d998ab1 100755
--- a/bin/styleguidist.js
+++ b/bin/styleguidist.js
@@ -195,7 +195,9 @@ function printServerInstructions(config, options) {
 	console.log(`You can now view your style guide in the browser:`);
 	console.log();
 	console.log(`  ${chalk.bold('Local:')}            ${urls.localUrlForTerminal}`);
-	console.log(`  ${chalk.bold('On your network:')}  ${urls.lanUrlForTerminal}`);
+	if (urls.lanUrlForTerminal) {
+		console.log(`  ${chalk.bold('On your network:')}  ${urls.lanUrlForTerminal}`);
+	}
 	console.log();
 }
 
diff --git a/docs/Configuration.md b/docs/Configuration.md
index c0f9974c..73295f25 100644
--- a/docs/Configuration.md
+++ b/docs/Configuration.md
@@ -664,7 +664,7 @@ module.exports = {
 
 > **Note:** `entry`, `externals`, `output`, `watch`, and `stats` options will be ignored. For production builds, `devtool` will also be ignored.
 
-> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist.
+> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `MiniHtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist.
 
 > **Note:** Run style guide in verbose mode to see the actual webpack config used by Styleguidist: `npx styleguidist server --verbose`.
 
diff --git a/docs/Webpack.md b/docs/Webpack.md
index 468ddc1e..52873cbe 100644
--- a/docs/Webpack.md
+++ b/docs/Webpack.md
@@ -43,7 +43,7 @@ module.exports = {
 
 > **Note:** `entry`, `externals`, `output`, `watch`, and `stats` options will be ignored. For production builds, `devtool` will also be ignored.
 
-> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist.
+> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `MiniHtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist.
 
 > **Note:** If your loaders don’t work with Styleguidist try to make `include` and `exclude` absolute paths.
 
@@ -81,7 +81,7 @@ module.exports = {
 
 > **Note:** `entry`, `externals`, `output`, `watch`, and `stats` options will be ignored. For production builds, `devtool` will also be ignored.
 
-> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist.
+> **Note:** `CommonsChunkPlugins`, `HtmlWebpackPlugin`, `MiniHtmlWebpackPlugin`, `UglifyJsPlugin`, `HotModuleReplacementPlugin` plugins will be ignored because Styleguidist already includes them or they may break Styleguidist.
 
 ## Create React App
 
diff --git a/examples/react-native/README.md b/examples/react-native/README.md
index 66f1fd2a..8c17e088 100644
--- a/examples/react-native/README.md
+++ b/examples/react-native/README.md
@@ -24,7 +24,7 @@ npm run start
 
 Then open [http://localhost:6060](http://localhost:6060) in your browser.
 
-## Add Styleguidist to an exsisting react-native project
+## Add Styleguidist to an existing react-native project
 
 A collection of dev-dependencies related to webpack are required to get `react-native` and `react-styleguidist` running on a browser. `babel-preset-react-native` reflects the bundle server that normally serves to react-native apps to the simulators and/or devices.
 
@@ -36,7 +36,7 @@ Add and configure `styleguide.config.js` to the root of your `react-native` proj
 
 ## Common Caveats
 
-[react-native-web](https://github.com/necolas/react-native-web) does not support everything, components requiring DeviceInfo is a common breaking point for example. Configuring components or selections in your `styleguide.config.js` to only select ui components is recomended. A good rule of thumb is to expect an approximate visual representation with code examples and props documentation.
+[react-native-web](https://github.com/necolas/react-native-web) does not support everything, components requiring DeviceInfo is a common breaking point for example. Configuring components or selections in your `styleguide.config.js` to only select ui components is recommended. A good rule of thumb is to expect an approximate visual representation with code examples and props documentation.
 
 [react-native-vector-icons](https://oblador.github.io/react-native-vector-icons/) (or any other dependency using external assets) can be solved by adding a custom template to `styleguide.config.js`
 
@@ -259,6 +259,6 @@ There are a few steps you may want to take to troubleshoot these kinds of errors
 
 ### QR Code does not scan
 
-If you're not able to scan the QR code, make sure your phone's camera is focusing correctly, and also make sure that the contrast on the two colors in your terminal is high enough. For example, WebStorm's default themes may [not have enough contrast](https://github.com/react-community/create-react-native-app/issues/49) for terminal QR codes to be scannable with the system barcode scanners that the Expo app uses.
+If you're not able to scan the QR code, make sure your phone's camera is focusing correctly, and also make sure that the contrast between the two colors in your terminal is high enough. For example, WebStorm's default themes may [not have enough contrast](https://github.com/react-community/create-react-native-app/issues/49) for terminal QR codes to be scannable with the system barcode scanners that the Expo app uses.
 
 If this causes problems for you, you may want to try changing your terminal's color theme to have more contrast, or running Create React Native App from a different terminal. You can also manually enter the URL printed by the packager script in the Expo app's search bar to load it manually.
diff --git a/scripts/utils/mergeWebpackConfig.js b/scripts/utils/mergeWebpackConfig.js
index 641f0850..46fcfb8b 100644
--- a/scripts/utils/mergeWebpackConfig.js
+++ b/scripts/utils/mergeWebpackConfig.js
@@ -12,6 +12,7 @@ const IGNORE_SECTIONS_ENV = {
 
 const IGNORE_PLUGINS = [
 	'CommonsChunkPlugins',
+	'MiniHtmlWebpackPlugin',
 	'HtmlWebpackPlugin',
 	'OccurrenceOrderPlugin',
 	'DedupePlugin',


Test patch:
diff --git a/scripts/utils/__tests__/mergeWebpackConfig.spec.js b/scripts/utils/__tests__/mergeWebpackConfig.spec.js
index d66d4cc3..95fc6953 100644
--- a/scripts/utils/__tests__/mergeWebpackConfig.spec.js
+++ b/scripts/utils/__tests__/mergeWebpackConfig.spec.js
@@ -2,6 +2,7 @@ import mergeWebpackConfig from '../mergeWebpackConfig';
 
 class UglifyJsPlugin {}
 class MyPlugin {}
+class MiniHtmlWebpackPlugin {}
 
 it('should merge two objects', () => {
 	const result = mergeWebpackConfig({ a: 0, b: 0 }, { b: 1 });
@@ -26,15 +27,18 @@ it('should ignore certain sections', () => {
 });
 
 it('should ignore certain Webpack plugins', () => {
+	const baseInstance = new UglifyJsPlugin();
+	const userInstance = new UglifyJsPlugin();
 	const result = mergeWebpackConfig(
 		{
-			plugins: [new UglifyJsPlugin()],
+			plugins: [baseInstance],
 		},
 		{
-			plugins: [new UglifyJsPlugin(), new MyPlugin()],
+			plugins: [userInstance, new MyPlugin(), new MiniHtmlWebpackPlugin()],
 		}
 	);
 	expect(result.plugins).toHaveLength(2);
+	expect(result.plugins[0]).toBe(baseInstance);
 	expect(result.plugins[0].constructor.name).toBe('UglifyJsPlugin');
 	expect(result.plugins[1].constructor.name).toBe('MyPlugin');
 });