Skip to content

Commit

Permalink
add bundle size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
signed-long committed Jul 11, 2024
1 parent 8637b3b commit 5c1bb85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:

- run: bun install --frozen-lockfile
- run: bun run build
- run: ./check-bundle-size.sh

- name: Upload built project
uses: actions/upload-artifact@v4
Expand Down
13 changes: 13 additions & 0 deletions check-bundle-size.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
set -e

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
cd $DIR

BUNDLE_SIZE=$(du -sk dist | cut -f1)
echo "Bundle size is $BUNDLE_SIZE K"

if [ $BUNDLE_SIZE -gt 1000 ]; then
echo "Exceeded bundle size limit!"
exit 1
fi

0 comments on commit 5c1bb85

Please sign in to comment.