Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/codechecks/build-size-watcher
Keep your bundle size in check and detect when it gets too big.
https://github.com/codechecks/build-size-watcher
build build-size codecheck size watcher
Last synced: about 2 months ago
JSON representation
Keep your bundle size in check and detect when it gets too big.
- Host: GitHub
- URL: https://github.com/codechecks/build-size-watcher
- Owner: codechecks
- License: mit
- Created: 2019-01-13T17:33:08.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-11-28T07:16:58.000Z (almost 3 years ago)
- Last Synced: 2024-07-20T17:44:32.311Z (2 months ago)
- Topics: build, build-size, codecheck, size, watcher
- Language: TypeScript
- Homepage: https://codechecks.io
- Size: 734 KB
- Stars: 17
- Watchers: 3
- Forks: 5
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Build Size Watcher
Keep your build size in check and detect when it gets too big
## Install
```sh
npm add --save-dev @codechecks/build-size-watcher
```or
```sh
yarn add --dev @codechecks/build-size-watcher
```## Usage
Add to your `codechecks.yml` file:
```yml
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\
#### BuildSizeWatcherOptions
```typescript
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
```typescript
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](./CONTRIBUTING.md)
## Licence
MIT @ [codechecks.io](https://codechecks.io)