Add size-limit

This commit is contained in:
Lim Chee Aun 2024-09-09 20:54:55 +08:00
parent 8618deec29
commit 7330370413
3 changed files with 1136 additions and 11 deletions

20
.github/workflows/size-limit.yml vendored Normal file
View file

@ -0,0 +1,20 @@
name: Size limit
on:
pull_request:
branches:
- main
- production
permissions:
pull-requests: write
jobs:
size:
runs-on: ubuntu-latest
env:
CI_JOB_NUMBER: 1
steps:
- uses: actions/checkout@v4
- uses: andresz1/size-limit-action@v1.8.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

1111
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -13,7 +13,8 @@
"messages:extract:clean": "lingui extract --locale en --clean",
"messages:compile": "lingui compile",
"fetch-i18n-volunteers": "env $(cat .env.local | grep -v \"#\" | xargs) node scripts/fetch-i18n-volunteers.js",
"readme:i18n-volunteers": "node scripts/update-i18n-volunteers-readme.js"
"readme:i18n-volunteers": "node scripts/update-i18n-volunteers-readme.js",
"size": "npm run build && size-limit"
},
"dependencies": {
"@formatjs/intl-localematcher": "~0.5.4",
@ -61,6 +62,7 @@
"@lingui/cli": "~4.11.4",
"@lingui/vite-plugin": "~4.11.4",
"@preact/preset-vite": "~2.9.0",
"@size-limit/preset-app": "~11.1.5",
"babel-plugin-macros": "~3.1.0",
"postcss": "~8.4.45",
"postcss-dark-theme-class": "~1.3.0",
@ -95,5 +97,17 @@
"browserslist": [
"defaults",
"android >= 4"
],
"size-limit": [
{
"path": [
"dist/assets/*.js",
"dist/assets/icons/*.js"
],
"limit": "500 kB",
"running": false,
"gzip": false,
"brotli": true
}
]
}