diff options
author | Chocobozzz <me@florianbigard.com> | 2020-08-05 16:44:48 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-08-06 09:42:33 +0200 |
commit | d632a147293b36e46549a3ead754ef52d8fea735 (patch) | |
tree | fb7124216a69b4b4a40e52b26eba964403c910d2 | |
parent | c7a53f61212126fcad1b503003804a7468766a7f (diff) | |
download | PeerTube-d632a147293b36e46549a3ead754ef52d8fea735.tar.gz PeerTube-d632a147293b36e46549a3ead754ef52d8fea735.tar.zst PeerTube-d632a147293b36e46549a3ead754ef52d8fea735.zip |
Test bundlewatch
-rw-r--r-- | .github/workflows/bundlewatch.yml | 40 | ||||
-rw-r--r-- | package.json | 8 | ||||
-rwxr-xr-x | scripts/build/client.sh | 10 |
3 files changed, 56 insertions, 2 deletions
diff --git a/.github/workflows/bundlewatch.yml b/.github/workflows/bundlewatch.yml new file mode 100644 index 000000000..94536c74e --- /dev/null +++ b/.github/workflows/bundlewatch.yml | |||
@@ -0,0 +1,40 @@ | |||
1 | name: "Bundlewatch Github Action" | ||
2 | |||
3 | on: | ||
4 | push: | ||
5 | branches: | ||
6 | - develop | ||
7 | pull_request: | ||
8 | types: [synchronize, opened] | ||
9 | |||
10 | jobs: | ||
11 | |||
12 | test: | ||
13 | runs-on: ubuntu-latest | ||
14 | |||
15 | steps: | ||
16 | - uses: actions/checkout@v2 | ||
17 | |||
18 | - name: Use Node.js | ||
19 | uses: actions/setup-node@v1 | ||
20 | with: | ||
21 | node-version: '12.x' | ||
22 | |||
23 | - name: Cache Node.js modules | ||
24 | uses: actions/cache@v2 | ||
25 | with: | ||
26 | path: | | ||
27 | **/node_modules | ||
28 | ~/fixtures | ||
29 | key: ${{ runner.OS }}-node-${{ hashFiles('**/yarn.lock') }} | ||
30 | restore-keys: | | ||
31 | ${{ runner.OS }}-node- | ||
32 | ${{ runner.OS }}- | ||
33 | |||
34 | - name: Install dependencies | ||
35 | run: yarn install --frozen-lockfile | ||
36 | |||
37 | - uses: jackyef/bundlewatch-gh-action@master | ||
38 | with: | ||
39 | build-script: npm run build -- --analyze-bundle | ||
40 | bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }} | ||
diff --git a/package.json b/package.json index c579030f5..aee13e79f 100644 --- a/package.json +++ b/package.json | |||
@@ -218,5 +218,13 @@ | |||
218 | "sasslintConfig": "client/.sass-lint.yml", | 218 | "sasslintConfig": "client/.sass-lint.yml", |
219 | "_moduleAliases": { | 219 | "_moduleAliases": { |
220 | "@server": "dist/server" | 220 | "@server": "dist/server" |
221 | }, | ||
222 | "bundlewatch" : { | ||
223 | "files": [ | ||
224 | { | ||
225 | "path": "client/dist/en-US/*-es2015.js", | ||
226 | "maxSize": "1mb" | ||
227 | } | ||
228 | ] | ||
221 | } | 229 | } |
222 | } | 230 | } |
diff --git a/scripts/build/client.sh b/scripts/build/client.sh index a9eceebf9..75da6765c 100755 --- a/scripts/build/client.sh +++ b/scripts/build/client.sh | |||
@@ -30,15 +30,21 @@ rm -rf ./dist ./compiled | |||
30 | 30 | ||
31 | pre_build_hook | 31 | pre_build_hook |
32 | 32 | ||
33 | additionalParams="" | ||
34 | if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then | ||
35 | additionalParams="--namedChunks=true --outputHashing=none" | ||
36 | fi | ||
37 | |||
38 | |||
33 | defaultLanguage="en-US" | 39 | defaultLanguage="en-US" |
34 | npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json | 40 | npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json $additionalParams |
35 | mv "./dist/$defaultLanguage/assets" "./dist" | 41 | mv "./dist/$defaultLanguage/assets" "./dist" |
36 | mv "./dist/$defaultLanguage/manifest.webmanifest" "./dist/manifest.webmanifest" | 42 | mv "./dist/$defaultLanguage/manifest.webmanifest" "./dist/manifest.webmanifest" |
37 | 43 | ||
38 | post_build_hook | 44 | post_build_hook |
39 | 45 | ||
40 | # Don't build other languages if --light arg is provided | 46 | # Don't build other languages if --light arg is provided |
41 | if [ -z ${1+x} ] || [ "$1" != "--light" ]; then | 47 | if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); then |
42 | if [ ! -z ${1+x} ] && [ "$1" == "--light-hu" ]; then | 48 | if [ ! -z ${1+x} ] && [ "$1" == "--light-hu" ]; then |
43 | languages=(["hu"]="hu-HU") | 49 | languages=(["hu"]="hu-HU") |
44 | elif [ ! -z ${1+x} ] && [ "$1" == "--light-ar" ]; then | 50 | elif [ ! -z ${1+x} ] && [ "$1" == "--light-ar" ]; then |