Skip to content

Commit

Permalink
v2.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
benelan committed Feb 19, 2022
1 parent afb18db commit 43fd01d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ Descriptions, parameters, and return values for the exported functions.

Gets sizes for an application's production build.

| Parameter | Description | Type |
| ---------------------- | ------------------------------------------ | -------- |
| buildPath `(required)` | path to the application's build directory | `string` |
| bundleFileType | type of the bundle files (default is `js`) | `string` |
| Parameter | Description | Type |
| --------------------------- | ------------------------------------------ | -------- |
| buildPath | path to the application's build directory | `string` |
| bundleFileType `(optional)` | type of the bundle files (default is `js`) | `string` |

The function returns a `Promise` which resolves an object with three properties.

Expand All @@ -125,11 +125,11 @@ The function returns a `Promise` which resolves an object with three properties.

Formats bytes to a human readable size.

| Parameter | Description | Type |
| ------------------ | ------------------------------------------------ | --------- |
| bytes `(required)` | bytes to format into human readable size | `number` |
| decimals | decimal precision for rounding (default is `2`) | `number` |
| binary | binary or decimal conversion (default is `true`) | `boolean` |
| Parameter | Description | Type |
| --------------------- | ------------------------------------------------ | --------- |
| bytes | bytes to format into human readable size | `number` |
| decimals `(optional)` | decimal precision for rounding (default is `2`) | `number` |
| binary `(optional)` | binary or decimal conversion (default is `true`) | `boolean` |

The function returns a human readable size with units (`string`).

Expand All @@ -139,9 +139,9 @@ The function returns a human readable size with units (`string`).

Gets all files in a directory (recursively).

| Parameter | Description | Type |
| -------------------------- | ------------------------------------------ | -------- |
| directoryPath `(required)` | path to the directory containing the files | `string` |
| Parameter | Description | Type |
| ------------- | ------------------------------------------ | -------- |
| directoryPath | path to the directory containing the files | `string` |

The function returns a `Promise` which resolves an array of objects with two properties.

Expand All @@ -156,10 +156,10 @@ The function returns a `Promise` which resolves an array of objects with two pro

Filters files by filetype.

| Parameter | Description | Type |
| ------------------ | ----------------------------------------------- | -------------------------------- |
| files `(required)` | files from the [`getFiles`](#getfiles) function | `{path: string, name: string}[]` |
| type `(required)` | file type, e.g. `"js"`, `"css"`, `"tsx"`, etc. | `string` |
| Parameter | Description | Type |
| ----------------- | ----------------------------------------------- | -------------------------------- |
| files | files from the [`getFiles`](#getfiles) function | `{path: string, name: string}[]` |
| type `(optional)` | file type, e.g. `js`, `css`, `tsx`, etc. | `string` |

The function returns the `files` filtered by type.

Expand All @@ -169,9 +169,9 @@ The function returns the `files` filtered by type.

Gets file sizes.

| Parameter | Description | Type |
| ------------------ | ----------------------------------------------- | -------------------------------- |
| files `(required)` | files from the [`getFiles`](#getfiles) function | `{path: string, name: string}[]` |
| Parameter | Description | Type |
| --------- | ----------------------------------------------- | -------------------------------- |
| files | files from the [`getFiles`](#getfiles) function | `{path: string, name: string}[]` |

The function returns a `Promise` which resolves an array of file sizes (`number[]`).

Expand Down
2 changes: 1 addition & 1 deletion bin/build-sizes.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const logHeader = (message) => {

if (!buildPath) {
throw new Error(
"Error: Invalid or missing arguments. The path to the production build directory is a required."
"Error: Invalid or missing arguments. The path to the build directory is required."
);
}

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const getFileSizes = async (files) =>
* Provides sizes for an application's production build
* @param {string} buildPath - path to the build directory
* @param {string} [bundleFileType="js"] - type of bundle files, e.g. "js", "css", "java", etc.
* @returns {Promise<{ mainBundleSize: number, buildSize:number, buildFileCount: number}>}
* @returns {Promise<{ mainBundleSize: number, buildSize: number, buildFileCount: number}>}
* - mainBundleSize - size in bytes of the largest bundle file by type
* - buildSize - size in bytes of all files in the build directory
* - buildFileCount - count of all files in the build directory
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.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "build-sizes",
"version": "2.2.0",
"description": "A small script that provides sizes of production builds to assist with optimization",
"version": "2.3.0",
"description": "A small script that provides build sizes to assist with optimization",
"keywords": [
"metrics",
"size",
Expand Down

0 comments on commit 43fd01d

Please sign in to comment.