🌜
ğŸŒž
bundlewatch

bundlewatch

v0.3.3

Keep watch of your bundle size

npm install bundlewatch

README



npm bundlewatch All Contributors

node Libraries.io dependency status for latest release builds test


npm-chart contributors license

BundleWatch

BundleWatch checks file sizes, ensuring bundled browser assets don't jump in file size.
Sharp increases in BundleWatch can signal that something is wrong - adding a package that bloats the slug, a wrong import, or forgetting to minify.

Inspired by Siddharth Kshetrapal bundlesize

Getting Started

Install the BundleWatch package:

  • NPM: npm install bundlewatch --save-dev
  • Yarn: yarn add bundlewatch --dev

Add some basic configuration to your package.json

{
    "name": "my package name",
    "version": "0.0.1",
    "bundlewatch": {
        "files": [
            {
                "path": "myfolder/*.js",
                "maxSize": "100kB"
            }
        ]
    }
}

Usage:

  • NPM: npm run bundlewatch
  • Yarn: yarn run bundlewatch

This will give you command line output. If you want BundleWatch to report build status on your pull requests, see below.

Adding Build Status

BundleWatch can report its status on your GitHub Pull Requests.

build status preview

CI Auth Variables Needed by BundleWatch

  • BUNDLEWATCH_GITHUB_TOKEN

You will need to give BundleWatch access to your GitHub Statuses, which can be done by heading to: https://service.bundlewatch.io/setup-github

This will give you your BUNDLEWATCH_GITHUB_TOKEN. You will need to set this as an environment variable in CI.

CI Variables Needed by BundleWatch

The most efficient way to get this running is to ensure that some environment variables are available for BundleWatch to find.

  • CI_REPO_OWNER github.com/facebook/react
  • CI_REPO_NAME github.com/facebook/react
  • CI_COMMIT_SHA
  • CI_BRANCH

If you're using, Travis, CircleCI, Wrecker, Drone or GitHub Actions these should all work out of the box.

Have a look at the source code to see which variables are automatically found: getCIVars

Viewing the results breakdown

After setting up the above you will have BuildStatus on your Pull Requests. Clicking the details link on the reported status will show you a results file breakdown.

build results preview

Additional Documentation

Full documentation available on bundlewatch.io

I use bundlesize, why should I switch to BundleWatch

  • Bundlesize has entered maintenance mode and pull requests are left hanging, so we wanted to reboot the community through creating BundleWatch
  • New BundleWatch service with infrastructure as code
  • Launched bundlewatch.io documentation website
  • Enough test coverage to support CD
  • Node API Support
  • Lower barrier to contributing (automated testing and publishing), build a trusted community of contributors to have continuous improvement

Additional Features

  • Config validation to stop users from guessing why BundleWatch won't work
  • Support for config file path
  • Better results breakdown page
  • Better comparisons between branches, support branches other than master
  • Support for your own server for storing data
  • New and improved CI behaviour
  • Show history of BundleWatchs over time (coming soon)

Contributors

Thanks goes to these wonderful people (emoji key):

contributor
Jake Bolam

💻
contributor
Shouvik DCosta

💻
contributor
Tyler Benning

ğŸŽ¨
contributor
Leila Rosenthal

📖
contributor
Francois Campbell

💻
contributor
Emmanuel Ogbizi

🚧 💻 🛡️
contributor
Pascal Iske

🐛
contributor
Oleksii Leonov

💻
contributor
Nicolas Charpentier

💻 🚧 🛡️

This project follows the all-contributors specification. Contributions of any kind welcome!

Want to Help? Become a Contributor

Contributions of any kind are welcome! See the Contributing docs or Join us on Slack.

Release Notes

0.3.3
By Nicolas Charpentier • Published on January 14, 2022

What's Changed

New Contributors

Full Changelog: https://github.com/bundlewatch/bundlewatch/compare/v0.3.2...v0.3.3

0.3.2
By Emmanuel Ogbizi • Published on January 26, 2021
  • build(deps): [security] bump axios from 0.19.2 to 0.21.1 (#310)
0.3.1
By Jake Bolam • Published on September 22, 2020

#30, via #238 (thanks to @cheapsteak )

0.3.0
By Jake Bolam • Published on September 9, 2020

Adds:

  • #30, via #214 (thanks to @cheapsteak and @BeeeQueue)
0.2.7
By Emmanuel Ogbizi • Published on May 7, 2020

Bug fixes

  • Correctly set ci envs including pr base branch (#129) (@iamogbz)
  • Add support for TravisCI push branch name (#95) (@aleksejleonov)
  • Binary file size calculation (#94) (@aleksejleonov)
0.2.6
By Emmanuel Ogbizi • Published on March 11, 2020

Bug fixes

  • Extract GitHub Action branch name from GITHUB_REF (#66)
  • Main does not reflect index.js location (#33)
0.2.4
By Jake Bolam • Published on June 16, 2019

Fixed in #32 thanks @pascaliske for the fix.

0.2.3
By Jake Bolam • Published on June 16, 2019

Allow installation of bundlewatch from any version of yarn

0.2.2
By Emmanuel Ogbizi • Published on June 15, 2019

Axios dependency has a reported DoS vulnerability, which has been fixed and deployed in v0.19.0. The vulnerability is documented on Synk.

0.2.0
By Jake Bolam • Published on May 6, 2018
  • A breaking API change, (CI env sniffing) was made.

General

License
MIT
Typescript Types
None found
Tree-shakeable
No

Popularity

GitHub Stargazers
347
Community Interest
318
Number of Forks
39

Maintenance

Commits
10/219/22015
Last Commit
Open Issues
22
Closed Issues
19
Open Pull Requests
8
Closed Pull Requests
123

Versions

Versions Released
10/219/2201
Latest Version Released
Jan 14, 2022
Current Tags
latest0.3.3

Contributors

jakebolam
jakebolam
Commits: 122
iamogbz
iamogbz
Commits: 14
allcontributors[bot]
allcontributors[bot]
Commits: 7
sdcosta
sdcosta
Commits: 4
leilarosenthal
leilarosenthal
Commits: 3
aleksejleonov
aleksejleonov
Commits: 2
limonte
limonte
Commits: 2
villelahdenvuo
villelahdenvuo
Commits: 1
dat2
dat2
Commits: 1
francoiscampbell
francoiscampbell
Commits: 1
cheapsteak
cheapsteak
Commits: 1
Aghassi
Aghassi
Commits: 1
BeeeQueue
BeeeQueue
Commits: 1
indocomsoft
indocomsoft
Commits: 1
tgrant59
tgrant59
Commits: 1