Skip to content

Commit 01299eb

Browse files
Merge pull request #197 from remarkablemark/ci/size-limit
ci(github): add `size-limit.yml` workflow
2 parents f67cc8d + e82e419 commit 01299eb

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

.github/workflows/size-limit.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: size
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
size:
8+
runs-on: ubuntu-latest
9+
env:
10+
CI_JOB_NUMBER: 1
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: andresz1/size-limit-action@v1
14+
with:
15+
github_token: ${{ secrets.GITHUB_TOKEN }}

.size-limit.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"path": "dist/html-react-parser.min.js",
4+
"limit": "8 KB"
5+
}
6+
]

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Demos:
4848
- [Elements aren't nested correctly](#elements-arent-nested-correctly)
4949
- [Warning: validateDOMNesting(...): Whitespace text nodes cannot appear as a child of table](#warning-validatedomnesting-whitespace-text-nodes-cannot-appear-as-a-child-of-table)
5050
- [Don't change case of tags](#dont-change-case-of-tags)
51-
- [Benchmarks](#benchmarks)
51+
- [Performance](#performance)
5252
- [Contributors](#contributors)
5353
- [Code Contributors](#code-contributors)
5454
- [Financial Contributors](#financial-contributors)
@@ -410,20 +410,28 @@ parse('<CustomElement>', options); // React.createElement('CustomElement')
410410
411411
See [#62](https://github.com/remarkablemark/html-react-parser/issues/62) and [example](https://repl.it/@remarkablemark/html-react-parser-62).
412412
413-
## Benchmarks
413+
## Performance
414+
415+
Run benchmark:
414416
415417
```sh
416418
$ npm run test:benchmark
417419
```
418420
419-
Here's an example output of the benchmarks run on a MacBook Pro 2017:
421+
Output of benchmark run on MacBook Pro 2017:
420422

421423
```
422424
html-to-react - Single x 415,186 ops/sec ±0.92% (85 runs sampled)
423425
html-to-react - Multiple x 139,780 ops/sec ±2.32% (87 runs sampled)
424426
html-to-react - Complex x 8,118 ops/sec ±2.99% (82 runs sampled)
425427
```
426428

429+
Run [Size Limit](https://github.com/ai/size-limit):
430+
431+
```sh
432+
$ npx size-limit
433+
```
434+
427435
## Contributors
428436

429437
### Code Contributors

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@commitlint/config-conventional": "^11.0.0",
4242
"@rollup/plugin-commonjs": "^17.0.0",
4343
"@rollup/plugin-node-resolve": "^11.0.0",
44+
"@size-limit/preset-big-lib": "^4.9.1",
4445
"@types/react": "^17.0.0",
4546
"@typescript-eslint/parser": "^4.9.1",
4647
"benchmark": "^2.1.4",
@@ -57,6 +58,7 @@
5758
"rimraf": "^3.0.2",
5859
"rollup": "^2.34.2",
5960
"rollup-plugin-terser": "^7.0.2",
61+
"size-limit": "^4.9.1",
6062
"standard-version": "^9.0.0",
6163
"typescript": "^4.1.3"
6264
},

0 commit comments

Comments
 (0)