Giter Club home page Giter Club logo

build-size-watcher's Introduction

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

build-size-watcher's People

Contributors

krzkaczor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

build-size-watcher's Issues

Improve readme

There should be a screenshot of detailed view from github

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.