# @atlaskit/measure

> Tool for measuring bundle size of an individual package in Atlaskit

Latest version **0.4.2** (published 2019-08-26) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @atlaskit/measure
pnpm add @atlaskit/measure
yarn add @atlaskit/measure
bun add @atlaskit/measure
```

Provides the command `measure`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.2 |
| Published | 2019-08-26 |
| First published | 2019-08-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 11 |
| Unpacked size | 49 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Atlassian Pty Ltd |
| Maintainers | atlaskit |

## Links

- npm: https://www.npmjs.com/package/@atlaskit/measure
- npm.io page: https://npm.io/package/@atlaskit/measure

## Dependencies (11)

- [ora](https://npm.io/package/ora.md) ^3.0.0
- [bolt](https://npm.io/package/bolt.md) ^0.23.6
- [meow](https://npm.io/package/meow.md) ^5.0.0
- [axios](https://npm.io/package/axios.md) ^0.18.0
- [chalk](https://npm.io/package/chalk.md) ^2.1.0
- [npm-run](https://npm.io/package/npm-run.md) ^4.1.2
- [webpack](https://npm.io/package/webpack.md) ^4.16.1
- [gzip-size](https://npm.io/package/gzip-size.md) ^5.0.0
- [minimatch](https://npm.io/package/minimatch.md) ^3.0.4
- [pretty-bytes](https://npm.io/package/pretty-bytes.md) ^5.1.0
- [@atlaskit/webpack-config](https://npm.io/package/@atlaskit/webpack-config.md) ^2.0.13

## Recent versions

- 0.4.2 (latest) — 2019-08-26
- 0.4.1 — 2019-08-22
- 0.4.0 — 2019-08-16

## README

# Atlaskit Measure Tool

The atlaskit measure tool is effectively a quick script to analyze the webpack bundle for a package. This is incredibly useful both to get the bundle size at-a-glance as well as when doing deep dives into bundle size.

There are two commands in measure:

## Basic usage

```sh
yarn measure [path1] [path2] [path3]
```

For example, to measure button, you would use:

```sh
yarn measure packages/core/button
```

This prints output just to the terminal which will look like:

![measure output](./screenshots/measure-output.png)

As you can see, we have split our code into different chunks to better understand where weight is. Most importantly, you can see if atlaskit, the code's own source, or external dependencies are the things weighing the package down.

## Updating snapshot

If changes that have been introduced increase a bundle size beyond the allowed threshold, you might need to update measure snapshot. To do this, you can add the `--updateSnapshot` flag.

Please make sure that this decision is carefully considered and discussed. The point of measuring bundle size change like this is to prevent things growing unexpectedly. Always ask if there is a better way to do what you are trying to do.

```sh
yarn measure:updateSnapshot [path]
```

## In-depth analysis

Sometime you will need to look into what is in each chunk. To do this, you can add the `--analyze` flag.

```sh
yarn measure [path] --analyze
```

This will output the information above to the console, but will also launch a new tab in your browser which shows the [webpack-bundle-analyzer](https://www.npmjs.com/package/webpack-bundle-analyzer) view of the code.

With this, you can see exactly what packages or files are heavy.

## Exceptions

It is important to know that we filter out some 'common packages' that are a cost that will be paid by almost everyone using atlaskit. Including these common packages in each output would distort information.

The excluded packages are:

- `react` 5.9kb (2.5kb)
- `react-dom` 96.5kb (30.9kb)
- `styled-components` 43.1kb (16kb)
- `tslib` 5.6kb (2kb)
- `prop-types` 829B (502B)

## A note on this package

The way this package is currently written it is **heavily** tied to the Atlaskit code-base. If you wish to use it elsewhere, we strongly recommend making sure you understand why each piece of the code exists when rolling your own version.

---
_Source: https://npm.io/package/@atlaskit/measure · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
