Skip to content

Commit

Permalink
Merge pull request #30 from yousifalraheem/develop
Browse files Browse the repository at this point in the history
Improvements 29-Mar-2021
  • Loading branch information
yousifalraheem authored Mar 29, 2021
2 parents d7cceb3 + 2125b5e commit a6e4804
Show file tree
Hide file tree
Showing 16 changed files with 3,133 additions and 2,489 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- run: node scripts/pre-docs.js
- run: npm run build:docs
- uses: crazy-max/ghaction-github-pages@v1
with:
build_dir: dist
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
node-version: [12.x, 14.x]

steps:
- uses: actions/checkout@v2
Expand All @@ -26,3 +26,4 @@ jobs:
- run: npm run build
- run: npm test
- run: npm run test:project
- run: npm run build:docs
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ A rollup plugin that summarizes the output of the build. Under the hood, it uses
### npm

```terminal
npm i rollup-plugin-summary -D
npm i -D rollup-plugin-summary
```

### yarn

```terminal
yarn add rollup-plugin-summary -D
yarn add -D rollup-plugin-summary
```

<hr/>
Expand All @@ -43,17 +43,17 @@ export default {
]
}
```

<!-- REMOVE -->
<!-- github-only-start -->

<hr/>

## Documentation

Read the [documentation](https://yousifalraheem.github.io/rollup-plugin-summary/) to learn about options and more.
Read the full [documentation](https://yousifalraheem.github.io/rollup-plugin-summary/) to learn about options and more.

<hr/>

## License

MIT
<!-- github-only-end -->
28 changes: 0 additions & 28 deletions docs/docs.md

This file was deleted.

32 changes: 32 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<hr/>

## Options

These are the available options:

| Name | Type | Description | Default |
| --------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| warnLow | number | Minimum size in bytes to be highlighted in yellow.<br><sub>This is used to warn <span style="color: #ffcd39;">(in yellow)</span> about the files whom on the brink of exceeding the acceptable pre-defined file size</sub> | 5000 |
| warnHigh | number | Minimum size in bytes to be highlighted in red.<br><sub>This is used to alert <span style="color: #dc3545;">(in red)</span> about files that exceeded the acceptable pre-defined file size</sub> | 10000 |
| totalLow | number | Minimum total size in bytes to be highlighted in yellow.<br><sub>This is used to warn <span style="color: #ffcd39;">(in yellow)</span> about the total build size if it comes nearly below maximum acceptable pre-defined size</sub> | 200000 |
| totalHigh | number | Minimum total size in bytes to be highlighted in red.<br><sub>This is used to alert <span style="color: #dc3545;">(in red)</span> about the total build size if it exceeds the acceptable pre-defined size</sub> | 300000 |

<br/>

Here is an example of how it's used:

```javascript
{
plugins: [
summary({
warnLow: 1000,
warnHigh: 3000,
showMinifiedSize: false
})
]
}
```

<br/>

<small>**Note:** When changing the aforementioned options make sure you pass them in pairs. Changing the `warnLow` will require you to also pass `warnHigh`. Same goes with `totalLow` and `totalHigh`. The reason is if you don't change the `high` value, it will will be prioritized. So raising the `warnLow` value will still result in the value to be highlighted in `red`.</small>
69 changes: 55 additions & 14 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,59 @@
declare module "rollup-plugin-summary" {
export interface SummaryOptions {
/** Minimum size in bytes to be highlighted in yellow. Default: `5000` */
warnLow: number;
/** Minimum size in bytes to be highlighted in red. Default: `10000` */
warnHigh: number;
/** Minimum total size in bytes to be highlighted in yellow. Default: `200000` */
totalLow: number;
/** Minimum total size in bytes to be highlighted in red. Default: `300000` */
totalHigh: number;
}
declare interface SummaryPrint {
Name: string;
Size: string;
Minified: string;
Gzipped: string;
Brotli: string;
}

declare interface SummaryOptions {
/**
* Minimum size in bytes to be highlighted in yellow.
* @default 5000
* @description
* This is used to warn (in yellow) about the files whom on the brink of exceeding the acceptable pre-defined file size
*/
warnLow?: number;
/**
* Minimum size in bytes to be highlighted in red.
* @default 10000
* @description
* This is used to alert (in red) about files that exceeded the acceptable pre-defined file size
*/
warnHigh?: number;
/**
* Minimum total size in bytes to be highlighted in yellow.
* @default 200000
* @description
* This is used to warn (in yellow) about the total build size if it comes nearly below maximum acceptable pre-defined size
*/
totalLow?: number;
/**
* Prints out a summary of the rollup build
* @param {SummaryOptions} options Summary plugin options
* Minimum total size in bytes to be highlighted in red.
* @default 300000
* @description
* This is used to alert (in red) about the total build size if it exceeds the acceptable pre-defined size
*/
export default function summary(options: SummaryOptions): void;
totalHigh?: number;
/**
* Show file size in Brotli compression.
* @default true
*/
showBrotliSize?: boolean;
/**
* Show file size minified.
* @default true
*/
showMinifiedSize?: boolean;
/**
* Show file size Gzipped.
* @default true
*/
showGzippedSize?: boolean;
}

/**
* Prints out a summary of the rollup build
* @param {SummaryOptions} options Summary plugin options
*/
export default function summary(options: SummaryOptions): void;
Loading

0 comments on commit a6e4804

Please sign in to comment.