Skip to content

Commit

Permalink
chore: add size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
crimx committed May 19, 2024
1 parent ddc3499 commit 61ead99
Show file tree
Hide file tree
Showing 7 changed files with 534 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Test 🧪
run: |
pnpm run test:CI
pnpm run test:coverage
- name: Build 🔧
run: |
Expand Down
66 changes: 66 additions & 0 deletions .size-limit.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[
{
"name": "`*`",
"path": "src/index.ts",
"import": "*"
},
{
"name": "`{ val }`",
"path": "src/index.ts",
"import": "{ val }"
},
{
"name": "`{ from }`",
"path": "src/from.ts",
"import": "{ from }",
"ignore": ["./val", "./agent"]
},
{
"name": "`{ derive }`",
"path": "src/derive.ts",
"import": "{ derive }",
"ignore": ["./val", "./agent", "./from"]
},
{
"name": "`{ combine }`",
"path": "src/combine.ts",
"import": "{ combine }",
"ignore": ["./val", "./agent", "./from"]
},
{
"name": "`{ compute }`",
"path": "src/compute.ts",
"import": "{ compute }",
"ignore": ["./val", "./agent", "./from"]
},
{
"name": "`{ flattenFrom }`",
"path": "src/flatten-from.ts",
"import": "{ flattenFrom }",
"ignore": ["./val", "./agent"]
},
{
"name": "`{ flatten }`",
"path": "src/flatten.ts",
"import": "{ flatten }",
"ignore": ["./val", "./agent", "./flatten-from"]
},
{
"name": "`{ reactiveMap }`",
"path": "src/collections/index.ts",
"import": "{ reactiveMap }",
"ignore": ["value-enhancer"]
},
{
"name": "`{ reactiveSet }`",
"path": "src/collections/index.ts",
"import": "{ reactiveSet }",
"ignore": ["value-enhancer"]
},
{
"name": "`{ reactiveList }`",
"path": "src/collections/index.ts",
"import": "{ reactiveList }",
"ignore": ["value-enhancer"]
}
]
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
[![npm-version](https://img.shields.io/npm/v/value-enhancer.svg)](https://www.npmjs.com/package/value-enhancer)
[![Coverage Status](https://img.shields.io/coveralls/github/crimx/value-enhancer/main)](https://coveralls.io/github/crimx/value-enhancer?branch=main)

[![full-size](https://img.shields.io/bundlephobia/minzip/value-enhancer)](https://bundlejs.com/?q=value-enhancer)
[![core-size](https://img.shields.io/bundlejs/size/value-enhancer?exports=val&label=core%20size)](https://bundlejs.com/?q=value-enhancer&treeshake=%5B%7Bval%7D%5D)
[![tree-shakable](https://img.shields.io/badge/%20tree-shakable-success)](https://bundlejs.com/?q=value-enhancer)
[![no-dependencies](https://img.shields.io/badge/dependencies-none-success)](https://bundlejs.com/?q=value-enhancer)
[![side-effect-free](https://img.shields.io/badge/%20side--effect-free-success)](https://bundlejs.com/?q=value-enhancer)
Expand Down Expand Up @@ -47,6 +45,26 @@ npm add value-enhancer
- Simple DX.
Designed with ergonomics in mind. No hidden rules for getting or setting values. What you see is what you get.

## Size

<!-- size-section-start -->

| import | size(brotli) |
| ------ | ------------ |
| `*` | 1.78 kB |
| `{ val }` | 1.03 kB |
| `{ from }` | 26 B |
| `{ derive }` | 72 B |
| `{ combine }` | 207 B |
| `{ compute }` | 192 B |
| `{ flattenFrom }` | 227 B |
| `{ flatten }` | 39 B |
| `{ reactiveMap }` | 479 B |
| `{ reactiveSet }` | 359 B |
| `{ reactiveList }` | 527 B |

<!-- size-section-end -->

## Quick Q&A

<details>
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,31 @@
"scripts": {
"prepublishOnly": "pnpm run build",
"lint": "eslint --ext .ts,.tsx . && prettier --check . && tsc --noEmit",
"size-limit": "size-limit",
"test": "node --expose-gc ./node_modules/jest/bin/jest.js --runInBand",
"test:CI": "tsc --noEmit -p ./test/tsconfig.json && node --expose-gc ./node_modules/jest/bin/jest.js --collect-coverage",
"test:coverage": "tsc --noEmit -p ./test/tsconfig.json && node --expose-gc ./node_modules/jest/bin/jest.js --collect-coverage",
"docs": "typedoc --options typedoc.json",
"types": "cross-env NODE_ENV=production tsc --declaration --emitDeclarationOnly --jsx react --esModuleInterop --outDir dist",
"build:index": "tsup --config tsup-config/index.tsup.config.ts",
"build:collections": "tsup --config tsup-config/collections.tsup.config.ts",
"build": "cross-env NODE_ENV=production pnpm run build:index && cross-env NODE_ENV=production pnpm run build:collections",
"build:min": "cross-env NODE_ENV=production MINIFY=true pnpm run build:index && cross-env NODE_ENV=production MINIFY=true pnpm run build:collections && node scripts/gzip.mjs",
"build": "cross-env NODE_ENV=production pnpm run build:index && cross-env NODE_ENV=production pnpm run build:collections && node scripts/size.mjs",
"build:min": "cross-env NODE_ENV=production MINIFY=true pnpm run build:index && cross-env NODE_ENV=production MINIFY=true pnpm run build:collections && node scripts/size.mjs",
"release": "standard-version"
},
"devDependencies": {
"@jest/globals": "^29.5.0",
"@size-limit/esbuild": "^11.1.4",
"@size-limit/file": "^11.1.4",
"@types/node": "^18.15.0",
"@typescript-eslint/eslint-plugin": "7.9.0",
"@typescript-eslint/parser": "7.9.0",
"cross-env": "^7.0.3",
"eslint": "8.56.0",
"eslint-config-prettier": "8.10.0",
"gzip-size": "^7.0.0",
"eslint": "8.56.0",
"jest": "^29.5.0",
"prettier": "^2.8.4",
"prettier": "^3.2.5",
"pretty-bytes": "^6.1.0",
"size-limit": "^11.1.4",
"standard-version": "^9.5.0",
"ts-jest": "^29.1.2",
"tsup": "^6.6.3",
Expand Down
Loading

0 comments on commit 61ead99

Please sign in to comment.