Test bundlewatch

pull/3040/head
Chocobozzz 2020-08-05 16:44:48 +02:00 committed by Chocobozzz
parent c7a53f6121
commit d632a14729
3 changed files with 56 additions and 2 deletions

40
.github/workflows/bundlewatch.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: "Bundlewatch Github Action"
on:
push:
branches:
- develop
pull_request:
types: [synchronize, opened]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Cache Node.js modules
uses: actions/cache@v2
with:
path: |
**/node_modules
~/fixtures
key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install dependencies
run: yarn install --frozen-lockfile
- uses: jackyef/bundlewatch-gh-action@master
with:
build-script: npm run build -- --analyze-bundle
bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

View File

@ -218,5 +218,13 @@
"sasslintConfig": "client/.sass-lint.yml",
"_moduleAliases": {
"@server": "dist/server"
},
"bundlewatch" : {
"files": [
{
"path": "client/dist/en-US/*-es2015.js",
"maxSize": "1mb"
}
]
}
}

View File

@ -30,15 +30,21 @@ rm -rf ./dist ./compiled
pre_build_hook
additionalParams=""
if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
additionalParams="--namedChunks=true --outputHashing=none"
fi
defaultLanguage="en-US"
npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json
npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json $additionalParams
mv "./dist/$defaultLanguage/assets" "./dist"
mv "./dist/$defaultLanguage/manifest.webmanifest" "./dist/manifest.webmanifest"
post_build_hook
# Don't build other languages if --light arg is provided
if [ -z ${1+x} ] || [ "$1" != "--light" ]; then
if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); then
if [ ! -z ${1+x} ] && [ "$1" == "--light-hu" ]; then
languages=(["hu"]="hu-HU")
elif [ ! -z ${1+x} ] && [ "$1" == "--light-ar" ]; then