Skip to content

Commit

Permalink
feat: added hasDifferences
Browse files Browse the repository at this point in the history
  • Loading branch information
nejcm committed Sep 30, 2022
1 parent c837e68 commit d3002fe
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ Action for reporting bundle size difference

## Inputs

`paths` - [**Required**] Paths to bundle size json files. Comma separated list.
**paths** - [Required] Paths to bundle size json files. Comma separated list.

`onlyDiff` - Report only differences. Default `"true"`.
**onlyDiff** - Report only differences. Default `"true"`.

## Outputs

`summary` - Table of bundle size differences in markdown format.
**summary** - `string` Table of bundle size differences in markdown format.

`reports` - Object holding all file/bundle reports.
**reports** - `object` All file/bundle reports.

**hasDifferences** - `boolean` Did any bundle size change

## Usage

Expand Down
5 changes: 3 additions & 2 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bundle-size-reporter-action",
"version": "1.2.6",
"version": "1.2.7",
"description": "Bundle size reporter",
"main": "dist/index.js",
"keywords": [
Expand Down
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,20 @@ export const run = async (): Promise<void> => {
const onlyDiff = toBoolean(getInput('onlyDiff') || 'false');
try {
if (!paths || paths.length === 0) throw new Error('Missing paths input!');
const { reports, summary = '' } = await getBundleSizeDiff(paths, onlyDiff);
const {
reports,
summary = '',
hasDifferences,
} = await getBundleSizeDiff(paths, onlyDiff);
setOutput('reports', reports);
setOutput('summary', summary);
setOutput('hasDifferences', hasDifferences);
info(`Reports:\n${JSON.stringify(reports)}`);
info(`Summary:\n${summary}`);
info(`Has differences:\n${hasDifferences}`);
info(`Bundle size action completed.`);
} catch (error: any) {
setFailed(error.message || error);
setOutput('summary', '');
}
};

Expand Down

0 comments on commit d3002fe

Please sign in to comment.