aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-06 10:26:39 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-06 10:58:36 +0200
commita3b5e78af3696f807e54bc4b11e559bbd9b6ba1e (patch)
tree037c42e9a7a637fba9be5d52800afba402eb9df2
parent5c145fe7ab6c1e975f5d43391316e8db9ca31974 (diff)
downloadPeerTube-a3b5e78af3696f807e54bc4b11e559bbd9b6ba1e.tar.gz
PeerTube-a3b5e78af3696f807e54bc4b11e559bbd9b6ba1e.tar.zst
PeerTube-a3b5e78af3696f807e54bc4b11e559bbd9b6ba1e.zip
Analyze embed too with bundlewatch
-rw-r--r--.github/workflows/bundlewatch.yml5
-rw-r--r--client/webpack/webpack.video-embed.js12
-rw-r--r--package.json8
-rwxr-xr-xscripts/build/client.sh5
-rwxr-xr-xscripts/build/embed.sh3
-rwxr-xr-xscripts/client-report.sh4
6 files changed, 27 insertions, 10 deletions
diff --git a/.github/workflows/bundlewatch.yml b/.github/workflows/bundlewatch.yml
index 312bf6e64..2ca854509 100644
--- a/.github/workflows/bundlewatch.yml
+++ b/.github/workflows/bundlewatch.yml
@@ -9,9 +9,12 @@ on:
9 9
10jobs: 10jobs:
11 11
12 test: 12 bundlewatch:
13 runs-on: ubuntu-latest 13 runs-on: ubuntu-latest
14 14
15 env:
16 CI_BRANCH_BASE: develop
17
15 steps: 18 steps:
16 - uses: actions/checkout@v2 19 - uses: actions/checkout@v2
17 20
diff --git a/client/webpack/webpack.video-embed.js b/client/webpack/webpack.video-embed.js
index 252040bb7..e7671d3ea 100644
--- a/client/webpack/webpack.video-embed.js
+++ b/client/webpack/webpack.video-embed.js
@@ -33,9 +33,13 @@ module.exports = function () {
33 33
34 output: { 34 output: {
35 path: helpers.root('dist/standalone/videos'), 35 path: helpers.root('dist/standalone/videos'),
36 filename: '[name].[hash].bundle.js', 36
37 filename: process.env.ANALYZE_BUNDLE === 'true'
38 ? '[name].bundle.js'
39 : '[name].[hash].bundle.js',
40
37 sourceMapFilename: '[file].map', 41 sourceMapFilename: '[file].map',
38 chunkFilename: '[id].chunk.js', 42 chunkFilename: '[id].[hash].chunk.js',
39 publicPath: '/client/standalone/videos/' 43 publicPath: '/client/standalone/videos/'
40 }, 44 },
41 45
@@ -113,7 +117,9 @@ module.exports = function () {
113 117
114 plugins: [ 118 plugins: [
115 new ExtractTextPlugin({ 119 new ExtractTextPlugin({
116 filename: '[name].[hash].css' 120 filename: process.env.ANALYZE_BUNDLE === 'true'
121 ? '[name].css'
122 : '[name].[hash].css'
117 }), 123 }),
118 124
119 new PurifyCSSPlugin({ 125 new PurifyCSSPlugin({
diff --git a/package.json b/package.json
index aee13e79f..4e4e58878 100644
--- a/package.json
+++ b/package.json
@@ -224,6 +224,14 @@
224 { 224 {
225 "path": "client/dist/en-US/*-es2015.js", 225 "path": "client/dist/en-US/*-es2015.js",
226 "maxSize": "1mb" 226 "maxSize": "1mb"
227 },
228 {
229 "path": "client/dist/standalone/videos/video-embed.bundle.js",
230 "maxSize": "1mb"
231 },
232 {
233 "path": "client/dist/standalone/videos/video-embed.css",
234 "maxSize": "1mb"
227 } 235 }
228 ] 236 ]
229 } 237 }
diff --git a/scripts/build/client.sh b/scripts/build/client.sh
index 254ca4364..878de60df 100755
--- a/scripts/build/client.sh
+++ b/scripts/build/client.sh
@@ -33,6 +33,7 @@ pre_build_hook
33additionalParams="" 33additionalParams=""
34if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then 34if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
35 additionalParams="--namedChunks=true --outputHashing=none" 35 additionalParams="--namedChunks=true --outputHashing=none"
36 export ANALYZE_BUNDLE=true
36fi 37fi
37 38
38 39
@@ -154,9 +155,7 @@ if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); t
154 done 155 done
155fi 156fi
156 157
157if [ ! -z ${1+x} ] || [ "$1" == "--analyze-bundle" ]; then 158cd ../ && npm run build:embed && cd client/
158 cd ../ && npm run build:embed && cd client/
159fi
160 159
161# Copy runtime locales 160# Copy runtime locales
162cp -r "./src/locale" "./dist/locale" 161cp -r "./src/locale" "./dist/locale"
diff --git a/scripts/build/embed.sh b/scripts/build/embed.sh
index 4be2afc25..3fcfc6ba2 100755
--- a/scripts/build/embed.sh
+++ b/scripts/build/embed.sh
@@ -4,4 +4,5 @@ set -eu
4 4
5cd client 5cd client
6 6
7NODE_ENV=production npm run webpack -- --config webpack/webpack.video-embed.js --mode production --json > "./dist/embed-stats.json" 7mkdir -p ./dist/standalone/videos/
8NODE_ENV=production npm run webpack -- --config webpack/webpack.video-embed.js --mode production --json > "./dist/standalone/videos/embed-stats.json"
diff --git a/scripts/client-report.sh b/scripts/client-report.sh
index 76609686b..f280fad20 100755
--- a/scripts/client-report.sh
+++ b/scripts/client-report.sh
@@ -2,8 +2,8 @@
2 2
3set -eu 3set -eu
4 4
5gawk -i inplace 'BEGIN { found=0 } { if (found || $0 ~ /^{/) { found=1; print }}' ./client/dist/embed-stats.json 5gawk -i inplace 'BEGIN { found=0 } { if (found || $0 ~ /^{/) { found=1; print }}' ./client/dist/standalone/videos/embed-stats.json
6 6
7npm run concurrently -- -k \ 7npm run concurrently -- -k \
8 "cd client && npm run webpack-bundle-analyzer -- -p 8888 ./dist/en-US/stats-es2015.json" \ 8 "cd client && npm run webpack-bundle-analyzer -- -p 8888 ./dist/en-US/stats-es2015.json" \
9 "cd client && npm run webpack-bundle-analyzer -- -p 8889 ./dist/embed-stats.json" 9 "cd client && npm run webpack-bundle-analyzer -- -p 8889 ./dist/standalone/videos/embed-stats.json"