forked from openshift/console
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to capture Webpack bundle analysis in CI
- Loading branch information
Showing
2 changed files
with
18 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -exuo pipefail | ||
|
||
ARTIFACT_DIR=${ARTIFACT_DIR:=/tmp/artifacts} | ||
|
||
# Run `yarn analyze` and save the report as artifacts in CI. | ||
|
||
pushd frontend | ||
yarn run analyze --no-open | ||
if [ -d "$ARTIFACT_DIR" ]; then | ||
echo "Copying the Webpack Bundle Analyzer report to $ARTIFACT_DIR..." | ||
cp public/dist/report.html "${ARTIFACT_DIR}" | ||
fi | ||
# Print chunk sizes, largest first. | ||
jq -r '.assets|sort_by(.size)|reverse|.[]|select(.name|test("js$"))|"\(.size/1024|ceil) KiB => \(.name)"' public/dist/stats.json | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters