Skip to content

Commit d2c3d61

Browse files
Suraj PatelSuraj Patel
authored andcommitted
Adding usage of build comparison option in Read me file.
1 parent 4696440 commit d2c3d61

File tree

1 file changed

+38
-26
lines changed

1 file changed

+38
-26
lines changed

README.md

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
<div><sup><em>(for webpack)</em></sup></div>
66
</h1>
77

8-
<a href="https://travis-ci.org/stephencookdev/speed-measure-webpack-plugin"><img src="https://travis-ci.org/stephencookdev/speed-measure-webpack-plugin.svg?branch=master" /></a>
9-
<a href="https://npmjs.com/package/speed-measure-webpack-plugin"><img src="https://img.shields.io/npm/dw/speed-measure-webpack-plugin.svg" /></a>
10-
<a href="https://npmjs.com/package/speed-measure-webpack-plugin"><img src="https://img.shields.io/node/v/speed-measure-webpack-plugin.svg" /></a>
11-
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg" /></a>
8+
<a href="https://travis-ci.org/stephencookdev/speed-measure-webpack-plugin"><img src="https://travis-ci.org/stephencookdev/speed-measure-webpack-plugin.svg?branch=master" /></a>
9+
<a href="https://npmjs.com/package/speed-measure-webpack-plugin"><img src="https://img.shields.io/npm/dw/speed-measure-webpack-plugin.svg" /></a>
10+
<a href="https://npmjs.com/package/speed-measure-webpack-plugin"><img src="https://img.shields.io/node/v/speed-measure-webpack-plugin.svg" /></a>
11+
<a href="https://github.com/prettier/prettier"><img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg" /></a>
12+
1213
</div>
1314
<br>
1415

@@ -40,11 +41,8 @@ Change your webpack config from
4041

4142
```javascript
4243
const webpackConfig = {
43-
plugins: [
44-
new MyPlugin(),
45-
new MyOtherPlugin()
46-
]
47-
}
44+
plugins: [new MyPlugin(), new MyOtherPlugin()],
45+
};
4846
```
4947

5048
to
@@ -55,10 +53,7 @@ const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");
5553
const smp = new SpeedMeasurePlugin();
5654

5755
const webpackConfig = smp.wrap({
58-
plugins: [
59-
new MyPlugin(),
60-
new MyOtherPlugin()
61-
]
56+
plugins: [new MyPlugin(), new MyOtherPlugin()],
6257
});
6358
```
6459

@@ -90,18 +85,18 @@ Default: `"human"`
9085

9186
Determines in what format this plugin prints its measurements
9287

93-
* `"json"` - produces a JSON blob
94-
* `"human"` - produces a human readable output
95-
* `"humanVerbose"` - produces a more verbose version of the human readable output
96-
* If a function, it will call the function with the JSON blob, and output the response
88+
- `"json"` - produces a JSON blob
89+
- `"human"` - produces a human readable output
90+
- `"humanVerbose"` - produces a more verbose version of the human readable output
91+
- If a function, it will call the function with the JSON blob, and output the response
9792

9893
### `options.outputTarget`
9994

10095
Type: `String|Function`<br>
10196
Default: `console.log`
10297

103-
* If a string, it specifies the path to a file to output to.
104-
* If a function, it will call the function with the output as the first parameter
98+
- If a string, it specifies the path to a file to output to.
99+
- If a function, it will call the function with the output as the first parameter
105100

106101
### `options.pluginNames`
107102

@@ -116,14 +111,31 @@ takes an object of `pluginName: PluginConstructor`, e.g.
116111
const uglify = new UglifyJSPlugin();
117112
const smp = new SpeedMeasurePlugin({
118113
pluginNames: {
119-
customUglifyName: uglify
120-
}
114+
customUglifyName: uglify,
115+
},
121116
});
122117

123118
const webpackConfig = smp.wrap({
124-
plugins: [
125-
uglify
126-
]
119+
plugins: [uglify],
120+
});
121+
```
122+
123+
### `options.compareLoadersBuild`
124+
125+
Type: `Object`<br>
126+
Default: `{}`
127+
128+
This option gives you per loader module count, module time to execute, time comparison
129+
with previous build of each loader. It takes two input, one is the `filePath` which is
130+
filename where all build details will be written and second one is `commitBuildInfo` which
131+
is not mandatory but on basis of this flag, your `filePath file` gets git commited to your
132+
`current checkout branch` and will also push it to remote origin.
133+
`Note :- filePath option is mandatory, commitBuildInfo is not mandatory. But if you apply commitBuildInfo you should checkout the branch on your machine/server on which the filePath file should get committed before running your webpack build. Also the module count will only be visible when the outputFormat is 'humanVerbose'`,
134+
e.g.
135+
136+
```javascript
137+
const smp = new SpeedMeasurePlugin({
138+
compareLoadersBuild: { filePath: "./suraj.txt", commitBuildInfo: true },
127139
});
128140
```
129141

@@ -136,8 +148,8 @@ By default, SMP measures loaders in groups. If truthy, this plugin will give per
136148

137149
This flag is _experimental_. Some loaders will have inaccurate results:
138150

139-
* loaders using separate processes (e.g. `thread-loader`)
140-
* loaders emitting file output (e.g. `file-loader`)
151+
- loaders using separate processes (e.g. `thread-loader`)
152+
- loaders emitting file output (e.g. `file-loader`)
141153

142154
We will find solutions to these issues before removing the _(experimental)_ flag on this option.
143155

0 commit comments

Comments
 (0)