mirror of https://github.com/Chocobozzz/PeerTube
Analyze embed too with bundlewatch
parent
5c145fe7ab
commit
a3b5e78af3
|
@ -9,9 +9,12 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
test:
|
bundlewatch:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
CI_BRANCH_BASE: develop
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
|
|
@ -33,9 +33,13 @@ module.exports = function () {
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
path: helpers.root('dist/standalone/videos'),
|
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',
|
sourceMapFilename: '[file].map',
|
||||||
chunkFilename: '[id].chunk.js',
|
chunkFilename: '[id].[hash].chunk.js',
|
||||||
publicPath: '/client/standalone/videos/'
|
publicPath: '/client/standalone/videos/'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -113,7 +117,9 @@ module.exports = function () {
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
new ExtractTextPlugin({
|
new ExtractTextPlugin({
|
||||||
filename: '[name].[hash].css'
|
filename: process.env.ANALYZE_BUNDLE === 'true'
|
||||||
|
? '[name].css'
|
||||||
|
: '[name].[hash].css'
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new PurifyCSSPlugin({
|
new PurifyCSSPlugin({
|
||||||
|
|
|
@ -224,6 +224,14 @@
|
||||||
{
|
{
|
||||||
"path": "client/dist/en-US/*-es2015.js",
|
"path": "client/dist/en-US/*-es2015.js",
|
||||||
"maxSize": "1mb"
|
"maxSize": "1mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "client/dist/standalone/videos/video-embed.bundle.js",
|
||||||
|
"maxSize": "1mb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "client/dist/standalone/videos/video-embed.css",
|
||||||
|
"maxSize": "1mb"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ pre_build_hook
|
||||||
additionalParams=""
|
additionalParams=""
|
||||||
if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
|
if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
|
||||||
additionalParams="--namedChunks=true --outputHashing=none"
|
additionalParams="--namedChunks=true --outputHashing=none"
|
||||||
|
export ANALYZE_BUNDLE=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,9 +155,7 @@ if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ]); t
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z ${1+x} ] || [ "$1" == "--analyze-bundle" ]; then
|
cd ../ && npm run build:embed && cd client/
|
||||||
cd ../ && npm run build:embed && cd client/
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy runtime locales
|
# Copy runtime locales
|
||||||
cp -r "./src/locale" "./dist/locale"
|
cp -r "./src/locale" "./dist/locale"
|
||||||
|
|
|
@ -4,4 +4,5 @@ set -eu
|
||||||
|
|
||||||
cd client
|
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"
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
set -eu
|
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 \
|
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 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"
|
||||||
|
|
Loading…
Reference in New Issue