Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed Apr 28, 2024
1 parent 545e65f commit efada0a
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ If you have multiple meta files, you can specify them like this `"dist/meta1.jso
Name | Default | Description
-------|---------|------------
`metafiles` | - | A required comma-separated list of paths to [esbuild's meta file]([https://esbuild.github.io/api/#metafile]).
`name` | `${{ github.event.repository.name }}` | The name of your project. This will be used in the comment header.
`analyze_directory` | `.analyzer` | A path to working directory where bundle analysis are stored.
`budget_percent_increase_red` | `20` | If an out file size has increased more than this percent, display a "‼️" to draw extra attention to the change.
`show_details` | `true` | If `true`, a collapsed "details" section is rendered. It explains the details of the numbers provided and icons.
`skip_comment_if_empty` | `false` | If `true` and no out files have changed size, the generated comment will be an empty string.

## Action outputs

Expand Down
1 change: 0 additions & 1 deletion __tests__/no-base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ describe("examples w/o base analysis", () => {
metafiles: ["out/meta.json"],
name: "test",
showDetails: false,
skipCommentIfEmpty: false,
};

beforeEach(() => {
Expand Down
1 change: 0 additions & 1 deletion __tests__/with-base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ describe("examples w/ base analysis", () => {
metafiles,
name: "test",
showDetails: false,
skipCommentIfEmpty: false,
};

beforeEach(() => {
Expand Down
15 changes: 3 additions & 12 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
required: false
default: ${{ github.event.repository.name }}
description: |
The name of the project. This will be used in the comment header.
The name of your project. This will be used in the comment header.
metafiles:
required: true
description: |
Expand Down Expand Up @@ -35,7 +35,7 @@ inputs:
required: false
default: ".analyzer"
description: |
demo
A path to working directory where bundle analysis are stored.
budget_percent_increase_red:
required: false
default: 20
Expand All @@ -46,15 +46,7 @@ inputs:
required: false
default: true
description: |
This option renders a collapsed "details" section explaining some of the finer details of
the numbers provided and icons. If you feel like this is not necessary and you and/or those working on your project
understand the details, you can set this option to `false` and that section will not render.
skip_comment_if_empty:
required: false
default: true
description: |
When set to `true`, if no out files have changed size, the generated comment will be an
empty string.
If `true`, a collapsed "details" section is rendered. It explains the details of the numbers provided and icons.
runs:
using: composite
Expand All @@ -77,7 +69,6 @@ runs:
INPUT_ANALYZE_DIRECTORY: ${{ inputs.analyze_directory }}
INPUT_BUDGET_PERCENT_INCREASE_RED: ${{ inputs.budget_percent_increase_red }}
INPUT_SHOW_DETAILS: ${{ inputs.show_details }}
INPUT_SKIP_COMMENT_IF_EMPTY: ${{ inputs.skip_comment_if_empty }}
run: |
node ${{ github.action_path }}/dist/index.mjs
Expand Down
9 changes: 1 addition & 8 deletions dist/index.mjs

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions src/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,6 @@ This analysis was generated by [esbuild-bundle-analyzer](https://github.com/exoe
// consistently find the right comment to edit as more commits are pushed.
output += `<!-- __ESBUILD_BUNDLE_${input.name} -->`;

// if ignoreIfEmpty is true, set output to an empty string
if (!hasAnyChange && input.skipCommentIfEmpty) {
output = "";
}

// Log mostly for testing and debugging.
// This will show up in the github actions console.
console.dir({
Expand Down
3 changes: 0 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ function getOptions(): Options {
showDetails: ["true", "True", "TRUE"].includes(
getInput("show_details") || "true",
),
skipCommentIfEmpty: ["true", "True", "TRUE"].includes(
getInput("skip_comment_if_empty") || "false",
),
name,
analyzerDirectory: getInput("analyze_directory") || ".analyzer",
metafiles: rawMetafiles.split(","),
Expand Down
1 change: 0 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ export interface Options {
analyzerDirectory: string;
budgetPercentIncreaseRed: number;
showDetails: boolean;
skipCommentIfEmpty: boolean;
}

0 comments on commit efada0a

Please sign in to comment.