How to measure bundle size difference report in Circle CI?

Viewed 122

Circle CI enables you to auto post a comment on a PR. I am trying to make it auto post a comment about the bundle size. Since my app uses source-map-explorer I can easily out a stats.json file like so:

source-map-explorer foo.min.js --json
{
  "results": [
    {
      "bundleName": "tests/data/foo.min.js",
      "totalBytes": 718,
      "mappedBytes": 681,
      "unmappedBytes": 1,
      "eolBytes": 1,
      "sourceMapCommentBytes": 35
    }
  ]
}

This can be output on each run of CircleCI - however, when I create a PR, I want to grab the stats from the master branch and post it in a comment side by side with the stats of the current branch (PR branch) for comparison.

Question: How do I access the stats.json files present in the master branch and current branch respectively on PR creation?

This is easily doable with GH actions, but not sure how to approach it in Circle CI.

0 Answers
Related