Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/transferwise/actions-next-bundle-analyzer
Github Action that analyses page bundle sizes from a Next.js build
https://github.com/transferwise/actions-next-bundle-analyzer
Last synced: 2 months ago
JSON representation
Github Action that analyses page bundle sizes from a Next.js build
- Host: GitHub
- URL: https://github.com/transferwise/actions-next-bundle-analyzer
- Owner: transferwise
- Created: 2021-06-29T08:19:24.000Z (over 3 years ago)
- Default Branch: v2
- Last Pushed: 2024-04-23T05:53:58.000Z (9 months ago)
- Last Synced: 2024-04-23T09:46:22.450Z (9 months ago)
- Language: TypeScript
- Size: 130 KB
- Stars: 26
- Watchers: 59
- Forks: 4
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# actions-next-bundle-analyzer
GitHub action that analyses the bundle sizes for each route in a Next.js build.
## Usage
Add the following step to a workflow which runs on a [pull_request](https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request) event, after the Next.js project has been built (i.e. after running `pnpm run build`).
```yml
- name: Analyze bundle sizes
uses: transferwise/actions-next-bundle-analyzer@v2
with:
# Optional, specifies where to look for .next folder. Defaults to cwd.
working-directory: ./apps/my-next-app
# Optional, configures commenting strategy around insignificant changes, defaults to `always`.
# Available options:
# always: Always comment on PRs, even if it's just to say there are no significant changes.
# skip-insignificant: Skip commenting on PRs if there are no signficant changes in page sizes.
comment-strategy: 'always'
# Optional, configures whether to create the bundle size summary issue, defaults to `true`.
# Available options:
# true
# false
create-issue: true
# Optional, defaults to `github.token`.
github-token: ${{ github.token }}
```### On a Pull Request
When the job runs on a pull request a comment will be added showing the bundle sizes of the branch and the difference against the default branch:
![image](https://user-images.githubusercontent.com/614392/123790589-69872e80-d8d6-11eb-9dec-0686e0bba760.png)
_Note: Difference to the default branch will only be shown once this action has run on a default branch commit._
### On the default branch
When the workflow runs on the default branch, it will create/update a GitHub Issue with the current bundle sizes.
![image](https://user-images.githubusercontent.com/52004409/156007377-3e6bbb4c-f721-4b42-a363-4559b2ea55df.png)
## Contributing
Compiled files must also be commited. After making changes to TypeScript files run
```
pnpm run build
```Add both the source files and the new compiled files to your pull request.