Skip to content

Commit 7599d89

Browse files
committedJul 14, 2022
ci: add size-limit support
1 parent ac860be commit 7599d89

9 files changed

+2516
-7845
lines changed
 

‎.eslintignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dist
22
lib
33
CHANGELOG.md
4-
/pnpm-*.yml
4+
/pnpm-lock.yml
55
!/.*.cjs
6-
!/.changeset/*.json
6+
!/.changeset

‎.github/workflows/pkg-size.yml

-34
This file was deleted.

‎.github/workflows/size-limit.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Size Limit
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
8+
jobs:
9+
size-limit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Setup pnpm
15+
uses: pnpm/action-setup@v2
16+
with:
17+
version: latest
18+
19+
- name: Setup Node.js ${{ matrix.node }}
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: ${{ matrix.node }}
23+
cache: pnpm
24+
25+
- name: Install Dependencies
26+
run: pnpm i
27+
28+
- uses: andresz1/size-limit-action@v1
29+
with:
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
skip_step: install
32+
script: pnpm size-limit --json

‎.npmrc

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
enable-pre-post-scripts=true
2-
; https://github.com/pkg-size/action/pull/45
3-
; package-lock=false
42
public-hoist-pattern[]=@1stg/*
53
public-hoist-pattern[]=@pkgr/*
64
public-hoist-pattern[]=@commitlint/*

‎.prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
.npmrc
21
.type-coverage
32
dist
43
lib
54
node_modules
65
CHANGELOG.md
6+
/pnpm-lock.yaml

‎.size-limit.cjs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { dependencies } = require('./package.json')
2+
3+
/** @see https://github.com/ai/size-limit/issues/291 */
4+
const external = Object.keys(dependencies)
5+
6+
module.exports = [
7+
{
8+
path: './lib/index.js',
9+
ignore: external,
10+
},
11+
{
12+
path: './lib/worker.mjs',
13+
ignore: external,
14+
},
15+
]

‎package.json

+12-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
},
4242
"funding": "https://opencollective.com/unts",
4343
"license": "ISC",
44-
"packageManager": "pnpm@7.5.0",
44+
"packageManager": "pnpm@7.5.1",
4545
"engines": {
4646
"node": "^12.20.0 || ^14.18.0 || >=16.0.0"
4747
},
@@ -103,25 +103,32 @@
103103
"synckit": "^0.7.2"
104104
},
105105
"devDependencies": {
106-
"@1stg/lib-config": "^8.0.0",
106+
"@1stg/lib-config": "^9.0.0",
107107
"@changesets/changelog-github": "^0.4.5",
108-
"@changesets/cli": "^2.23.1",
108+
"@changesets/cli": "^2.23.2",
109109
"@mozilla/glean": "^1.0.0",
110+
"@size-limit/preset-small-lib": "^7.0.8",
110111
"@types/debug": "^4.1.7",
111112
"@types/enhanced-resolve": "^3.0.7",
112113
"@types/is-core-module": "^2.2.0",
113114
"@types/is-glob": "^4.0.2",
114-
"@types/node": "^18.0.3",
115+
"@types/node": "^18.0.4",
115116
"@types/unist": "^2.0.6",
116117
"dummy.js": "link:dummy.js",
117118
"eslint-import-resolver-typescript": "link:.",
118119
"react": "^18.2.0",
119-
"type-coverage": "^2.21.2",
120+
"size-limit": "^7.0.8",
121+
"type-coverage": "^2.22.0",
120122
"typescript": "^4.7.4"
121123
},
122124
"resolutions": {
123125
"prettier": "^2.7.1"
124126
},
127+
"pnpm": {
128+
"patchedDependencies": {
129+
"@size-limit/esbuild@7.0.8": "patches/@size-limit__esbuild@7.0.8.patch"
130+
}
131+
},
125132
"typeCoverage": {
126133
"atLeast": 100,
127134
"cache": true,
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
diff --git a/get-config.js b/get-config.js
2+
index caf78653fda1c3464ffb12ff10e19cd82fce644a..ddd3f4a229791a633668bd66d7fb3a63217b5e70 100644
3+
--- a/get-config.js
4+
+++ b/get-config.js
5+
@@ -16,7 +16,9 @@ module.exports = async function getConfig(limitConfig, check, output) {
6+
bundle: true,
7+
minifyWhitespace: true,
8+
minifyIdentifiers: true,
9+
- minifySyntax: true
10+
+ minifySyntax: true,
11+
+
12+
+ platform: 'node'
13+
}
14+
15+
return config

0 commit comments

Comments
 (0)
Please sign in to comment.