All Projects → LironEr → bundlemon

LironEr / bundlemon

Licence: MIT license
Monitor your bundle size

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to bundlemon

Webpack Bundle Analyzer
Webpack plugin and CLI utility that represents bundle content as convenient interactive zoomable treemap
Stars: ✭ 11,472 (+21545.28%)
Mutual labels:  bundle, size
Intercept-netkeeper-account
截取NetKeeper拨号时的真实账号,截获到的账号可以用于路由器、电脑等的pppoe拨号,可用4.9及其以下版本的NetKeeper
Stars: ✭ 57 (+7.55%)
Mutual labels:  monitor
gl-bench
⏱ WebGL performance monitor with CPU/GPU load.
Stars: ✭ 146 (+175.47%)
Mutual labels:  monitor
service
Service for storing and computing BundleWatch data
Stars: ✭ 17 (-67.92%)
Mutual labels:  bundlesize
vite-bundle
Integration with your Symfony app & Vite
Stars: ✭ 56 (+5.66%)
Mutual labels:  bundle
dynamic-engine
Monitor events in the background on Android.
Stars: ✭ 24 (-54.72%)
Mutual labels:  monitor
deadman-check
Monitoring companion for Nomad periodic jobs and Cron
Stars: ✭ 49 (-7.55%)
Mutual labels:  monitor
FCMBundle
A Bundle for Symfony projects to send notifications in mobile devices through Firebase Cloud Messaging API
Stars: ✭ 43 (-18.87%)
Mutual labels:  bundle
vaper
Take a look at the relations among servers.
Stars: ✭ 16 (-69.81%)
Mutual labels:  monitor
iOSThin
iOS瘦身方案
Stars: ✭ 25 (-52.83%)
Mutual labels:  size
next-size
Next.js plugin to print browser assets sizes
Stars: ✭ 39 (-26.42%)
Mutual labels:  size
kafka monitor
A kafka monitor to send alarm emails
Stars: ✭ 14 (-73.58%)
Mutual labels:  monitor
monitor-man
HTTP API monitor based on postman and newman.
Stars: ✭ 44 (-16.98%)
Mutual labels:  monitor
YappyGitHub
A github monitor bot for Discord
Stars: ✭ 64 (+20.75%)
Mutual labels:  monitor
weigh
A command line tool to check the bundle size of one or more browser compatible npm modules
Stars: ✭ 59 (+11.32%)
Mutual labels:  bundlesize
dash
Server control panel
Stars: ✭ 22 (-58.49%)
Mutual labels:  monitor
GuzzleBundleOAuth2Plugin
OAuth2 Plugin for GuzzleBundle
Stars: ✭ 13 (-75.47%)
Mutual labels:  bundle
composer-cost
Displays cost/size of each composer package installed.
Stars: ✭ 31 (-41.51%)
Mutual labels:  size
speedy
Test, track, monitor and analyze your internet speed.
Stars: ✭ 35 (-33.96%)
Mutual labels:  monitor
lexik-jose-bridge
An Encoder for the LexikJWTAuthenticationBundle that uses web-token/jwt-framework
Stars: ✭ 27 (-49.06%)
Mutual labels:  bundle
BundleMon logo

BundleMon

npm node npm npm

BundleMon helps you to monitor your bundle size.

Your goal is to keep your bundle size as small as possible to reduce the amount of time it takes for users to load your website/application. This is particularly important for users on low bandwidth connections.

BundleMon helps you achieve that by constantly monitoring your bundle size on every commit and alerts you on changes.

Features

  • Set max size for files, will fail build if exceeded
  • Compare files to base branch
  • Set max increase allowed in percentage from base branch, will fail build if exceeded
  • Supports multiple CI
  • Integrates with Github, can post build status & comment with detailed information
  • History report - example

Guides

Setup

npm install bundlemon --save-dev

# or

yarn add bundlemon --dev

Add bundlemon property to your package.json

"bundlemon": {
  "baseDir": "./build",
  "files": [
    {
      "path": "index.html",
      "maxSize": "2kb",
      "maxPercentIncrease": 5
    },
    {
      "path": "bundle.<hash>.js",
      "maxSize": "10kb"
    },
    {
      "path": "assets/**/*.{png,svg}"
    }
  ]
}

BundleMon config can be placed in other places like: .bundlemonrc, .bundlemonrc.json, bundlemon.config.js exporting a JS object, more forms can be found here

Name Description Type Default
baseDir Relative/absolute path to the directory string process.cwd()
files Files config FileConfig[] required -
groups Sum all file sizes matching the pattern, rules applies to the sum of the files Groups config FileConfig[] -
defaultCompression Use compression before calculating file size "none" | "gzip" | "brotli" "gzip"
reportOutput Output options (string | [string, object])[] []
verbose Print more details boolean false
subProject By setting sub project you can use the same project id for multiple projects. This can be useful for monorepos. Can be set/overwrite with BUNDLEMON_SUB_PROJECT env var string undefined

CLI usage

You can also set some of the variables using CLI flags

bundlemon --config my-custom-config-path.json

CLI flags docs

Create new project

In order to save history and get differences from your main branches you will need to create a new project and setup environment variables.

  • Create new project and copy the project ID and API key
  • Add the ID to BUNDLEMON_PROJECT_ID and the API key to BUNDLEMON_PROJECT_APIKEY environment variables in your CI

Set additional environment variables

In order to get BundleMon to work you'll need to set these environment variables:

If you are using one of the supported CIs (GitHub Actions, Travis, CircleCI and Codefresh) you dont need to set anything.

  • CI=true
  • CI_REPO_OWNER - github.com/LironEr/bundlemon LironEr
  • CI_REPO_NAME - github.com/LironEr/bundlemon bundlemon
  • CI_BRANCH - source branch name
  • CI_COMMIT_SHA - commit SHA
  • CI_TARGET_BRANCH - target branch name, only set if BundleMon runs on a pull request
  • CI_PR_NUMBER - PR number, only set if BundleMon runs on a pull request

Using hash in file names?

When using hash in file names the file name can be changed every build.

In order for BundleMon to keep track of your files you can use <hash> to replace the hash with a constant string.

For example:

index.html
home.b72f15a3.chunk.js
login.057c430b.chunk.js
bundle.ea45e578.js

Config:

"bundlemon": {
  "baseDir": "./build",
  "files": [
    {
      "path": "*.<hash>.chunk.js"
    },
    {
      "path": "*.<hash>.js"
    }
  ]
}

Output:

[PASS] bundle.(hash).js: 19.67KB
[FAIL] home.(hash).chunk.js: 70.09KB > 50KB
[PASS] login.(hash).chunk.js: 3.37KB < 50KB

GitHub integration

BundleMon can create GitHub check run, post commit status and a detailed comment on your PR.

GitHub check run


GitHub build status


GitHub detailed comment

Just Install BundleMon GitHub App

Then add github to reportOutput

"reportOutput": ["github"]

// override default options

"reportOutput": [
  [
    "github",
    {
      "checkRun": false,
      "commitStatus": true,
      "prComment": true
    }
  ]
]

GitHub action example & forks support

BundleMon supports running on PRs originating from forks, ONLY on public repos and by removing BUNDLEMON_PROJECT_APIKEY variable.

Step by step guide to set up BundleMon with Github actions

name: Build

on:
  push:
    branches: [main]
  pull_request:
    types: [synchronize, opened, reopened]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js 16
        uses: actions/setup-node@v2
        with:
          node-version: '16'

      - name: Install dependencies
        run: yarn

      - name: Build
        run: yarn build

      - name: Run BundleMon
        run: yarn bundlemon
        env:
          BUNDLEMON_PROJECT_ID: YOUR_PROJECT_ID
          BUNDLEMON_PROJECT_APIKEY: ${{ secrets.BUNDLEMON_PROJECT_APIKEY }} # not required for public repos
          CI_COMMIT_SHA: ${{github.event.pull_request.head.sha || github.sha}} # important!

Make sure to set CI_COMMIT_SHA env var, more info can be found here

Contributing

Read the contributing guide to learn how to run this project locally and contribute.

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].