Skip to content

Commit d50376c

Browse files
authored
Merge pull request #1 from psd-coder/setup-size-limit
Setup size limit
2 parents 9123608 + f53a451 commit d50376c

File tree

5 files changed

+147
-15
lines changed

5 files changed

+147
-15
lines changed

.github/workflows/size-limit.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Check bundle size
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
permissions:
11+
pull-requests: write
12+
13+
jobs:
14+
sizecheck:
15+
runs-on: ubuntu-latest
16+
env:
17+
CI_RUN: true
18+
CI_JOB_NUMBER: 1
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: andresz1/size-limit-action
22+
with:
23+
github_token: ${{ secrets.GITHUB_TOKEN }}
24+
package_manager: pnpm

.size-limit.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { SizeLimitConfig } from "size-limit";
2+
3+
module.exports = [
4+
{
5+
name: "createTypedChannel",
6+
path: "dist/index.js",
7+
import: "{ createTypedChannel }",
8+
limit: "254 B",
9+
},
10+
{
11+
name: "createPostMessageTransport",
12+
path: "dist/index.js",
13+
import: "{ createPostMessageTransport }",
14+
limit: "86 B",
15+
},
16+
{
17+
name: "createEventTargetTransport",
18+
path: "dist/index.js",
19+
import: "{ createEventTargetTransport }",
20+
limit: "109 B",
21+
},
22+
] satisfies SizeLimitConfig;

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
A type-safe communication channel for sending and receiving messages between different contexts in a TypeScript environment.
44

55
[![npm version](https://img.shields.io/npm/v/typed-channel.svg)](https://www.npmjs.com/package/typed-channel)
6+
[![Bundle size](https://img.shields.io/badge/Bundle_size-from_363_B-brightgreen)](https://github.com/psd-coder/typed-channel/blob/main/.size-limit.ts)
67
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
78

89
## Features

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"lint": "pnpm --parallel /^lint:*/",
3232
"lint:oxlint": "oxlint",
3333
"lint:prettier": "prettier --check .",
34+
"lint:size": "pnpm build && size-limit",
3435
"format": "prettier . --write",
3536
"typecheck": "tsc --noEmit",
3637
"test": "vitest run",
@@ -39,8 +40,10 @@
3940
},
4041
"packageManager": "[email protected]",
4142
"devDependencies": {
43+
"@size-limit/preset-small-lib": "^11.2.0",
4244
"oxlint": "^0.16.6",
4345
"prettier": "^3.5.3",
46+
"size-limit": "^11.2.0",
4447
"tsup": "^8.4.0",
4548
"typescript": "^5.8.3",
4649
"vite": "^6.3.1",

pnpm-lock.yaml

Lines changed: 97 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)