Skip to content

Move generation of bundle-size-report to bundle-size-review job

Lukas Eipert requested to merge leipert-improve-bundle-size-generation into master

What does this MR do and why?

Write out webpack log to file instead of stdout

In our compile-production-assets logs, webpack logs too much and one has a hard time investigating what is going on.

Let's log the stdout to the tmp directory and expose it as an artifact.

This also has the benefit of using less resources for the job logs in general.

Move bundle analysis to bundle-size-review job

This way the generatorion of the webpack reports has no impact on our compile-production-assets job anymore. Furthermore we are currently writing a rather large JSON as an artifact, which the bundle-size-review job downloads.

However: We now need to create a bundle-size-report job on master as well in order to be able to create the comparison baseline.

Here is a small explanation how the whole process works:

  1. We run webpack in a production like mode and enable the BundleAnalyzerPlugin
  2. The Plugin builds a index.html for human consumption and a stats.json. These are exposed in CI, so that other tools can consume them.
  3. In Merge Requests, Danger uses a script:
    • to create a smaller analysis.json from the gargantuan stats.json
    • compare that smaller to analysis.json to the one from the base commit on master

Generate bundle size analysis outside of danger

Instead of generating the bundle size diff only in danger, we do it directly in our newly minted bash script. This way we do not need to expose a gigabyte large artifact anymore.

Screenshots or screen recordings

N/A

How to set up and validate locally

Look at the bundle-size-review below!

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Lukas Eipert

Merge request reports

Loading