Skip to content
Keep your bundle size in check and detect when it gets too big.
TypeScript JavaScript
Branch: master
Clone or download
Latest commit 27f5465 May 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
meta 💅new readme and improved package metadata Mar 28, 2019
src update to client v0.1.0, add a way to override name parameter May 21, 2019
.gitignore init Jan 13, 2019
.prettierignore init Jan 13, 2019
.prettierrc 💅new readme and improved package metadata Mar 28, 2019
CHANGELOG.md 💅new readme and improved package metadata Mar 28, 2019
CONTRIBUTING.md
LICENSE 💅new readme and improved package metadata Mar 28, 2019
README.md minor readme updates May 22, 2019
jest.config.js 🆙 update codechecks Mar 31, 2019
package.json 0.1.0 May 21, 2019
tsconfig.json init Jan 13, 2019
tslint.json add more tests Mar 3, 2019
yarn.lock update to client v0.1.0, add a way to override name parameter May 21, 2019

README.md

codechecks.io

Build Size Watcher

Keep your build size in check and detect when it gets too big

Build Status Software License

Install

npm add --save-dev @codechecks/build-size-watcher

or

yarn add --dev @codechecks/build-size-watcher

Usage

Add to your codechecks.yml file:

checks:
  - name: build-size-watcher
    options:
      files:
        - path: "./build/static/js/*.js"
          maxSize: 1MB
        - path: "./build/static/css/*.css"
        - path: "./build/static/images/*.jpg"
  # ...

With each pull request you will get a summary like Change +3 KB(+1%) Total 300KB and detailed size breakdown for each path in check's details.

API

buildSizeWatcher(options: BuildSizeWatcherOptions): Promise<void>

BuildSizeWatcherOptions

interface BuildSizeWatcherOptions {
  gzip?: boolean; // defaults to true
  files: {
    path: string; // supports globs
    maxSize?: number | string;
  }[];
  name?: string; // defaults to "Build Size"
}
gzip

optional boolean

Default: true

Specify if files should be gzipped before size calculation

files
interface FileDescription {
  path: string; // supports glob
  maxSize?: number | string;
}

List of files to track.

files.path

string

Path specifying files to bundle together while calculating size. Supports globs. It's great when you have to deal with checksums in file names: ex. "./build/static/js/*.js"

files.maxSize

optional number|string

Provide the maximum size of all files matched by files.path. It can be a number in bytes or a string like "1KB" or "1MB". When max size is reached the whole check will report failure.

name

optional string

Default: Build Size

Specify the name for check. Might be useful when you track multiple builds for example in monorepo.

Contributing

All contributions are welcomed. Read more in CONTRIBUTING.md

Licence

MIT @ codechecks.io

You can’t perform that action at this time.