Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Analyze embed too with bundlewatch

Chocobozzza3b5e78af369
diff --git a/.github/workflows/bundlewatch.yml b/.github/workflows/bundlewatch.yml
index 312bf6e64a..2ca8545091 100644
--- a/.github/workflows/bundlewatch.yml
+++ b/.github/workflows/bundlewatch.yml
@@ -9,9 +9,12 @@ on:
jobs:
- test:
+ bundlewatch:
runs-on: ubuntu-latest
+ env:
+ CI_BRANCH_BASE: develop
+
steps:
- uses: actions/checkout@v2
diff --git a/client/webpack/webpack.video-embed.js b/client/webpack/webpack.video-embed.js
index 252040bb7d..e7671d3ea1 100644
--- a/client/webpack/webpack.video-embed.js
+++ b/client/webpack/webpack.video-embed.js
@@ -33,9 +33,13 @@ module.exports = function () {
output: {
path: helpers.root('dist/standalone/videos'),
- filename: '[name].[hash].bundle.js',
+
+ filename: process.env.ANALYZE_BUNDLE === 'true'
+ ? '[name].bundle.js'
+ : '[name].[hash].bundle.js',
+
sourceMapFilename: '[file].map',
- chunkFilename: '[id].chunk.js',
+ chunkFilename: '[id].[hash].chunk.js',
publicPath: '/client/standalone/videos/'
},
@@ -113,7 +117,9 @@ module.exports = function () {
plugins: [
new ExtractTextPlugin({
- filename: '[name].[hash].css'
+ filename: process.env.ANALYZE_BUNDLE === 'true'
+ ? '[name].css'
+ : '[name].[hash].css'
}),
new PurifyCSSPlugin({
diff --git a/package.json b/package.json
index aee13e79ff..4e4e58878c 100644
--- a/package.json
+++ b/package.json
@@ -224,6 +224,14 @@
{
"path": "client/dist/en-US/*-es2015.js",
"maxSize": "1mb"
+ },
+ {
+ "path": "client/dist/standalone/videos/video-embed.bundle.js",
+ "maxSize": "1mb"
+ },
+ {
+ "path": "client/dist/standalone/videos/video-embed.css",
+ "maxSize": "1mb"
}
]
}
diff --git a/scripts/build/client.sh b/scripts/build/client.sh
index 254ca4364b..878de60df0 100755
--- a/scripts/build/client.sh
+++ b/scripts/build/client.sh
@@ -33,6 +33,7 @@ pre_build_hook
additionalParams=""
if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
additionalParams="--namedChunks=true --outputHashing=none"
+ export ANALYZE_BUNDLE=true
fi
@@ -154,9 +155,7 @@ if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); t
done
fi
-if [ ! -z ${1+x} ] || [ "$1" == "--analyze-bundle" ]; then
- cd ../ && npm run build:embed && cd client/
-fi
+cd ../ && npm run build:embed && cd client/
# Copy runtime locales
cp -r "./src/locale" "./dist/locale"
diff --git a/scripts/build/embed.sh b/scripts/build/embed.sh
index 4be2afc25d..3fcfc6ba2e 100755
--- a/scripts/build/embed.sh
+++ b/scripts/build/embed.sh
@@ -4,4 +4,5 @@ set -eu
cd client
-NODE_ENV=production npm run webpack -- --config webpack/webpack.video-embed.js --mode production --json > "./dist/embed-stats.json"
+mkdir -p ./dist/standalone/videos/
+NODE_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 76609686b9..f280fad202 100755
--- a/scripts/client-report.sh
+++ b/scripts/client-report.sh
@@ -2,8 +2,8 @@
set -eu
-gawk -i inplace 'BEGIN { found=0 } { if (found || $0 ~ /^{/) { found=1; print }}' ./client/dist/embed-stats.json
+gawk -i inplace 'BEGIN { found=0 } { if (found || $0 ~ /^{/) { found=1; print }}' ./client/dist/standalone/videos/embed-stats.json
npm run concurrently -- -k \
"cd client && npm run webpack-bundle-analyzer -- -p 8888 ./dist/en-US/stats-es2015.json" \
- "cd client && npm run webpack-bundle-analyzer -- -p 8889 ./dist/embed-stats.json"
+ "cd client && npm run webpack-bundle-analyzer -- -p 8889 ./dist/standalone/videos/embed-stats.json"