Skip to content

Commit 6b45479

Browse files
authored
ci: size-limit and clean-publish (#761)
* ci: size-limit and clean-publish * fix: indent in configs * ci: split workflows
1 parent fe6c00f commit 6b45479

File tree

6 files changed

+1500
-60
lines changed

6 files changed

+1500
-60
lines changed

.clean-publish

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"packageManager": "yarn"
3+
}

.github/workflows/size-limit.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "CI"
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
size:
8+
runs-on: ubuntu-latest
9+
name: Checking size
10+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
11+
env:
12+
CI_JOB_NUMBER: 1
13+
steps:
14+
- name: Checkout the repository
15+
uses: actions/checkout@v2
16+
- name: Check size
17+
uses: andresz1/size-limit-action@v1
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.

.size-limit

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[
2+
{
3+
"path": "dist/index.js",
4+
"limit": "2 KB",
5+
"webpack": false,
6+
"running": false
7+
},
8+
{
9+
"path": "dist/index.js",
10+
"limit": "9.4 KB",
11+
"import": "ChartComponent"
12+
},
13+
{
14+
"path": "dist/index.modern.js",
15+
"limit": "1.8 KB",
16+
"webpack": false,
17+
"running": false
18+
},
19+
{
20+
"path": "dist/index.modern.js",
21+
"limit": "9.3 KB",
22+
"import": "ChartComponent"
23+
}
24+
]

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,13 @@
3131
"test:lint": "eslint 'src/**/*.{ts,tsx}' 'test/**/*.{ts,tsx}'",
3232
"test:unit": "jest -c jest.config.json",
3333
"test:types": "tsc --skipLibCheck --noEmit",
34+
"test:size": "size-limit",
3435
"test:build": "yarn build",
35-
"test": "yarn test:lint && yarn test:unit && yarn test:types && yarn test:build",
36+
"test": "yarn test:lint && yarn test:unit && yarn test:types && yarn test:build && yarn test:size",
3637
"format": "prettier --write src",
3738
"predeploy": "cd example && yarn && yarn build",
38-
"deploy": "gh-pages -d example/build"
39+
"deploy": "gh-pages -d example/build",
40+
"cleanPublish": "yarn test && clean-publish"
3941
},
4042
"dependencies": {
4143
"lodash": "^4.17.19"
@@ -45,6 +47,7 @@
4547
"react": "^16.8.0 || ^17.0.0"
4648
},
4749
"devDependencies": {
50+
"@size-limit/preset-big-lib": "^6.0.3",
4851
"@swc/core": "^1.2.95",
4952
"@swc/jest": "^0.2.4",
5053
"@testing-library/jest-dom": "^5.5.0",
@@ -56,6 +59,7 @@
5659
"@typescript-eslint/parser": "^5.0.0",
5760
"babel-eslint": "^10.0.3",
5861
"chart.js": "^3.1.0",
62+
"clean-publish": "^3.4.1",
5963
"eslint": "^7.32.0",
6064
"eslint-config-prettier": "^8.3.0",
6165
"eslint-config-standard": "^16.0.3",
@@ -75,6 +79,7 @@
7579
"react-dom": "^17.0.1",
7680
"react-test-renderer": "^17.0.1",
7781
"simple-git-hooks": "^2.6.1",
82+
"size-limit": "^6.0.3",
7883
"typescript": "^4.4.3"
7984
},
8085
"files": [

0 commit comments

Comments
 (0)