# ember-asset-size-report

> Asset size report generation for Ember.js apps

Latest version **1.2.4** (published 2019-12-08) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install ember-asset-size-report
pnpm add ember-asset-size-report
yarn add ember-asset-size-report
bun add ember-asset-size-report
```

Provides the command `ember-asset-size-report`.

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.4 |
| Published | 2019-12-08 |
| First published | 2019-12-04 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 18 |
| Unpacked size | 159.1 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Mike North |
| Maintainers | northm |

## Links

- npm: https://www.npmjs.com/package/ember-asset-size-report
- Repository: https://github.com/mike-north/ember-asset-size-report
- npm.io page: https://npm.io/package/ember-asset-size-report

## Dependencies (18)

- [ora](https://npm.io/package/ora.md) ^4.0.3
- [tmp](https://npm.io/package/tmp.md) ^0.1.0
- [yam](https://npm.io/package/yam.md) ^1.0.0
- [zlib](https://npm.io/package/zlib.md) ^1.0.5
- [cliui](https://npm.io/package/cliui.md) ^6.0.0
- [debug](https://npm.io/package/debug.md) ^4.1.1
- [execa](https://npm.io/package/execa.md) ^3.4.0
- [yargs](https://npm.io/package/yargs.md) ^15.0.2
- [pkg-up](https://npm.io/package/pkg-up.md) ^3.1.0
- [rimraf](https://npm.io/package/rimraf.md) ^3.0.0
- [terser](https://npm.io/package/terser.md) ^4.4.2
- [find-up](https://npm.io/package/find-up.md) ^4.1.0
- [resolve](https://npm.io/package/resolve.md) ^1.13.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^8.1.0
- [left-pad](https://npm.io/package/left-pad.md) ^1.3.0
- [ember-cli](https://npm.io/package/ember-cli.md) ^3.14.0
- [walk-sync](https://npm.io/package/walk-sync.md) ^2.0.2
- [@types/resolve](https://npm.io/package/@types/resolve.md) ^0.0.8

## Recent versions

- 1.2.4 (latest) — 2019-12-08
- 1.2.3 — 2019-12-08
- 1.2.2 — 2019-12-08
- 1.2.1 — 2019-12-08
- 1.2.0 — 2019-12-08
- 1.1.6 — 2019-12-07
- 1.1.5 — 2019-12-07
- 1.1.4 — 2019-12-07
- 1.1.3 — 2019-12-07
- 1.1.2 — 2019-12-07
- 1.1.1 — 2019-12-07
- 1.1.0 — 2019-12-07
- 1.0.2 — 2019-12-07
- 1.0.1 — 2019-12-07
- 0.0.6 — 2019-12-05
- … 11 more at https://npm.io/package/ember-asset-size-report/versions

## README

# ember-asset-size-report

A utility for generating CSV files describing the assets in your ember-cli bundles

## Usage

First, ensure you have [`broccoli-concat-analyser`](https://github.com/stefanpenner/broccoli-concat-analyser/) installed in your app

### As a CLI tool

You should then be able to run

```sh
npx ember-asset-size-report
```

and after the command is done, you'll find a `module-size-report.csv` in your working directory

### As a library

Check out our [api documentation](https://github.com/mike-north/ember-asset-size-report/blob/master/docs/ember-asset-size-report.md)

```ts
import { generateReport } from "ember-asset-size-report";

async function main() {
  await generateReport(
    "path-to-my-ember-project-root", // optional
    "my-desired-report-output-path.csv" // optional
  );
}
```

## Experimental Usage

Experimental use (read: no SemVer guarantees) of a lower level JavaScript API

If you're using typescript, you'll need to make the following adustment to your `tsconfig.json` in order to "detect" this new API surface

```json
"paths": {
    "ember-asset-size-report": ["node_modules/ember-asset-size-report/dist/ember-asset-size-report-beta.d.ts"]
}
```

You should then be able to do something like

```ts
import {
  Spinner,
  EmberProject,
  ReportGenerator
} from "ember-asset-size-report";

// Create a progress spinner
const spinner = new Spinner();

// Create a "controller" for your ember-cli project
const project = new EmberProject("/Users/me/my-project-path", spinner);
// Create a report generator
const rptBuilder = new ReportGenerator(project, "/Users/me/my-report.csv");
// Create a prod build of the ember app, with concat stats output enabled
await project.build();

// analyze the stats data (and other things) to arrive at module/bundle sizes
await rptBuilder.analyze();

// add other files from the ./public folder to the csv data
await rptBuilder.addPublicFile(
  path.join(project.distPath, "assets", "i18n", "support_en_US.js")
);

// save the report. the .csv file should now appear
await rptBuilder.save();
```

## CSV Format

The csv format is designed to be easy to parse with tools like Google Sheets. To allow for easy backwards compatibility in parsing logic, data output is _versioned_. Please consult the [#Schema]

###### Example output

```csv
schema-version, 3

type, dataset, bundleName, moduleName, size, minSize, gzipSize, brSize, bundleRatio, soloGzSize, soloBrSize

type, dataset, bundleName, size, minSize, gzipSize, brSize

module, experiment: drop ie11, ember-fetch.js, abortcontroller.js, 4977, 1913, 637, 567, 0.1927, 774, 655
module, experiment: drop ie11, ember-fetch.js, fetch.js, 14540, 8015, 2671, 2374, 0.8073, 2687, 2390
module, experiment: drop ie11, example-app.js, vendor/ember-cli/app-prefix.js, 16, 13, 3, 3, 0.0014, 33, 17
module, experiment: drop ie11, example-app.js, example-app/adapters/-json-api.js, 348, 247, 57, 50, 0.027, 185, 155

bundle, experiment: drop ie11, ember-fetch.js, 19519, 9928, 3308, 2941
bundle, experiment: drop ie11, example-app.js, 15996, 9164, 2127, 1862
bundle, experiment: drop ie11, ember-testing.js, 81182, 22122, 5569, 4962
bundle, experiment: drop ie11, ember.js, 1951427, 490714, 126574, 106521
bundle, experiment: drop ie11, vendor.js, 2855105, 731260, 183679, 152473
```

### Extracting multiple tables from the CSV

Multiple tables (i.e., "modules" and "bundles" can be extracted from the single `.csv` file, using the conventions described above). [Here is an example](https://docs.google.com/spreadsheets/d/1vhor2qAQtWnTu_GNI4LaLZeu9Li0lZVi-koseZG2tTg/edit?usp=sharing) of Google Sheets being used to analyze CSV data pulled directly from this github repo

### Schema

##### schema-version (1 row)

This numeric version allows us to introduce breaking changes to the output format, while preserving the ability to parse both old and new data

#### Version 3

There are several sections

##### module data headers (1 row)

a single row of headers corresponding to module data

##### bundle data headers (1 row)

a single row of headers corresponding to bundle data

##### module data (many rows)

these rows always begin with "module" in the first column

##### bundle data (many rows)

these rows always begin with "bundle" in the first column

## Legal

&copy; 2019 LinkedIn All Rights Reserved

---
_Source: https://npm.io/package/ember-asset-size-report · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
