bundle-stats icon indicating copy to clipboard operation
bundle-stats copied to clipboard

Add option for baseline stats path

Open vio opened this issue 5 years ago • 3 comments

Allow to pass and use a custom baseline path.

rel: #688

vio avatar Jul 02 '20 06:07 vio

Hi! Love the package, thank you for building this 🙌

Just checking if this feature is still coming? Would it support remote values? I'm considering using this for CI tests. It's very possible I'm going about this all wrong, but the workflow I'm considering is:

  1. Set outDir to a public directory. Our process involves automatically spinning up internally available environments for our Node/Express app on PR open. So by making this public, anyone can go to a designated path on that env to view the stats report.
  2. When generating the baseline stats (automatically on push to the main branch, likely as a Github Action) output to a different, public location.
  3. When generating the current stats in 1., if baseline stats path can be set to the public location on our stage environment, which will always reflect what's in the main branch. This would allow us to always view the difference between the feature branch and the main branch.

So basically, this requires setting the baseline path to a remote location. I can't rely on the default baseline in node_modules, like we can in local, because the environment will be brand new on deploy.

Like I said, I'm possibly going about this all wrong, so I'm open to suggestions.

TREFZ avatar Apr 24 '21 14:04 TREFZ

Example:

Bundle stats on our persistent staging env. This will always show the bundle stats for what is in the main branch. https://stage.development-domain.com/public/stats/bundle-stats.html https://stage.development-domain.com/public/stats/bundle-stats.json

Bundle stats for our feature environment. This will show the feature's bundle stats, compared to the .json stats at the location above. https://my-feature.development-domain.com/public/stats/bundle-stats.html

TREFZ avatar Apr 24 '21 14:04 TREFZ

Love the package, thank you for building this

Thank you, @TREFZ! 🙇

Just checking if this feature is still coming? Would it support remote values? I'm considering using this for CI tests.

This feature is to allow users to point to a different path for the baseline. Currently is based on find-cache-dir.

bundle-stats main usage is for local comparisons, for CI usage i would recommend having a look at http://relative-ci.com (bundle-stats reports with dashboard, github/slack integrations, metrics monitoring).

If you are still considering doing something custom, i will accept a PR for it, currently this issue is not prioritised. There are couple projects that are relying on a similar flow (eg: Monitor & Analyze Asset Sizes with Every Build).

vio avatar Apr 25 '21 13:04 vio

It can be tested with [email protected] using baselineFilepath webpack-plugin option:

https://github.com/relative-ci/bundle-stats/blob/e2707fb80e456ae86a570006021004ee696e189a/packages/webpack-plugin/README.md?plain=1#L69-L76

https://github.com/relative-ci/bundle-stats/blob/v4.6.0-beta.1/packages/webpack-plugin/README.md#bundlestatswebpackpluginoptions

vio avatar Aug 08 '23 23:08 vio

Available on [email protected]:

webpack-plugin

https://github.com/relative-ci/bundle-stats/blob/ae13eb56c1eb7dd9086eae33f5c45f898a2ffe60/packages/webpack-plugin/README.md?plain=1#L73-L75

CLI

https://github.com/relative-ci/bundle-stats/blob/ae13eb56c1eb7dd9086eae33f5c45f898a2ffe60/packages/cli/README.md?plain=1#L97-L101

vio avatar Aug 10 '23 22:08 vio