Skip to content

Commit

Permalink
v3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benelan committed Mar 1, 2022
1 parent 24fb73d commit 5c183ca
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 36 deletions.
14 changes: 7 additions & 7 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line98">line 98</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line96">line 96</a>
</li></ul></dd>


Expand Down Expand Up @@ -701,7 +701,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line145">line 145</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line143">line 143</a>
</li></ul></dd>


Expand Down Expand Up @@ -863,7 +863,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line52">line 52</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line50">line 50</a>
</li></ul></dd>


Expand Down Expand Up @@ -1025,7 +1025,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line126">line 126</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line124">line 124</a>
</li></ul></dd>


Expand Down Expand Up @@ -1187,7 +1187,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line107">line 107</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line105">line 105</a>
</li></ul></dd>


Expand Down Expand Up @@ -1372,7 +1372,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line209">line 209</a>
<a href="index.js.html">index.js</a>, <a href="index.js.html#line207">line 207</a>
</li></ul></dd>


Expand Down Expand Up @@ -1882,7 +1882,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Feb 28 2022 09:55:36 GMT-0800 (Pacific Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Mar 01 2022 10:27:05 GMT-0800 (Pacific Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
29 changes: 14 additions & 15 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,19 @@ <h2>Using the CLI</h2>
<pre class="prettyprint source lang-bash"><code>build-sizes build
</code></pre>
<p>And the output to the console is:</p>
<pre class="prettyprint source"><code>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<pre class="prettyprint source"><code>-----------------------------
|> Application Build Sizes &lt;|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build
--> file count: 419
--> size: 27.73 MB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main JS bundle
--> name: main.6e924e92.js
--> size: 1.70 MB
--> gzip size: 462.92 KB
--> brotli size: 375.26 KB
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----------------------------
Build
--> file count: 419
--> size: 27.73 MB
-----------------------------
Main JS bundle
--> name: main.6e924e92.js
--> size: 1.70 MB
--> gzip size: 462.92 KB
--> brotli size: 375.26 KB
-----------------------------
</code></pre>
<p>There are also options that you can provide with flags. For example, you can specify a filetype for the largest bundle size (default is &quot;js&quot;):</p>
<pre class="prettyprint source lang-bash"><code>build-sizes build --filetype=css
Expand All @@ -90,7 +89,7 @@ <h3>Arguments</h3>
<li>Path to the build directory</li>
</ul>
<h3>Options</h3>
<p><strong>-b, --binary [boolean]</strong></p>
<p><strong>-b, --binary [boolean]</strong></p>
<ul>
<li>Convert bytes to human readable format in base 2 instead of base 10</li>
</ul>
Expand Down Expand Up @@ -212,7 +211,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Feb 28 2022 09:55:36 GMT-0800 (Pacific Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Mar 01 2022 10:27:05 GMT-0800 (Pacific Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
22 changes: 11 additions & 11 deletions docs/index.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,16 @@ <h1 class="page-title">Source: index.js</h1>
* @returns {string} human readable file size with units
*/
const formatBytes = (bytes, decimals = 2, binary = false) => {
// I prefer human readable sizes.
// Don't like it? byte me!
try {
if (!bytes) return "0 B";
const k = binary ? 1024 : 1000;
const n = binary ? [~~(Math.log10(bytes) / 3)] : ~~(Math.log2(bytes) / 10);
return (
(bytes / Math.pow(k, n)).toFixed(decimals) +
" " +
("KMGTPEZY"[n - 1] || "") +
"B"
const n = Math.floor(
binary ? Math.log10(bytes) / 3 : Math.log2(bytes) / 10
);
// I prefer human readable sizes, don't like it? byte me!
return `${(bytes / Math.pow(k, n)).toFixed(decimals)} ${
"KMGTPEZY"[n - 1] || ""
}B`;
} catch (err) {
help(
err,
Expand Down Expand Up @@ -295,7 +293,9 @@ <h1 class="page-title">Source: index.js</h1>
*/
function help(...messages) {
messages &amp;&amp; console.error(...messages);
console.error("\nAdd the -h or --help flag for usage information.");
console.error(
"\nAdd the -h or --help flag for usage information when on the CLI.\n\nCheck out the documentation for the exported functions:\nhttps://benelan.github.io/build-sizes/global.html\n"
);
process.exit(1);
}

Expand Down Expand Up @@ -333,7 +333,7 @@ <h1 class="page-title">Source: index.js</h1>
getFileSizeGzip,
getFileSizeBrotli,
filterFilesByType,
help
help,
};
</code></pre>
</article>
Expand All @@ -351,7 +351,7 @@ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.htm
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Mon Feb 28 2022 09:55:36 GMT-0800 (Pacific Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue Mar 01 2022 10:27:05 GMT-0800 (Pacific Standard Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-sizes",
"version": "3.1.0",
"version": "3.2.0",
"description": "A small script that provides build sizes to assist with optimization",
"homepage": "https://benelan.github.io/build-sizes",
"keywords": [
Expand Down

0 comments on commit 5c183ca

Please sign in to comment.