Skip to content

Commit 7dec4fc

Browse files
authored
Merge pull request #923 from ReactTooltip/feat/bundlesize-check
feat: add bundlesize check into the project
2 parents 2a3702f + 85926c0 commit 7dec4fc

File tree

6 files changed

+381
-402
lines changed

6 files changed

+381
-402
lines changed

.github/workflows/bundlesize.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Run Bundlesize
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
bundlesize:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-node@v3
12+
13+
- name: Install dev dependencies
14+
run: yarn install
15+
16+
- name: Build ReactTooltip component package
17+
run: yarn build
18+
19+
- name: Bundlesize
20+
run: yarn run bundlesize
21+

.github/workflows/pull-request.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ on:
99
jobs:
1010
lint:
1111
uses: ./.github/workflows/lint.yaml
12+
13+
bundlesize:
14+
uses: ./.github/workflows/bundlesize.yaml

bundlesize.config.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"files": [
3+
{
4+
"path": "./dist/react-tooltip.cjs.min.js",
5+
"maxSize": "13.5 kB"
6+
},
7+
{
8+
"path": "./dist/react-tooltip.esm.min.js",
9+
"maxSize": "13.5 kB"
10+
},
11+
{
12+
"path": "./dist/react-tooltip.umd.min.js",
13+
"maxSize": "13.5 kB"
14+
}
15+
]
16+
}

package.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"description": "react tooltip component",
55
"scripts": {
66
"dev": "node ./cli.js --env=development && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.dev.js --watch",
7-
"build": "node ./cli.js --env=production && npm run types && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.prod.js",
7+
"build": "node ./cli.js --env=production && npm run types && node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.prod.js && npm run bundlesize",
88
"types": "node --max_old_space_size=2048 ./node_modules/rollup/dist/bin/rollup -c rollup.config.types.js",
99
"eslint": "eslint --ext=js --ext=jsx --ext=ts --ext=tsx --fix ./src",
1010
"stylelint": "stylelint \"src/**/*.css\"",
1111
"prettier": "prettier --config ./.prettierrc.json --write \"src/**/*{.js,.jsx,.ts,.tsx,.css}\"",
12-
"cm": "git cz",
1312
"prepare": "husky install",
13+
"bundlesize": "bundlesize",
1414
"test": "jest"
1515
},
1616
"main": "dist/react-tooltip.cjs.min.js",
@@ -57,9 +57,8 @@
5757
"@types/react-test-renderer": "^18.0.0",
5858
"@typescript-eslint/eslint-plugin": "^5.42.1",
5959
"@typescript-eslint/parser": "^5.42.1",
60-
"commitizen": "^4.2.5",
60+
"bundlesize": "^0.18.1",
6161
"css-loader": "6.7.2",
62-
"cz-conventional-changelog": "^3.3.0",
6362
"eslint": "8.28.0",
6463
"eslint-config-airbnb": "19.0.4",
6564
"eslint-config-prettier": "^8.3.0",
@@ -117,11 +116,6 @@
117116
"last 1 safari version"
118117
]
119118
},
120-
"config": {
121-
"commitizen": {
122-
"path": "node_modules/cz-conventional-changelog"
123-
}
124-
},
125119
"dependencies": {
126120
"@floating-ui/dom": "^1.0.4",
127121
"classnames": "^2.3.2"

rollup.config.prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const minifiedOutputData = pkg.buildFormats.map(({ file, format }) => ({
8787
plugins: [...pluginsForCSSMinification, terser(), filesize()],
8888
}))
8989

90-
const outputData = [...minifiedOutputData, ...defaultOutputData]
90+
const outputData = [...defaultOutputData, ...minifiedOutputData]
9191

9292
const config = outputData.map(({ file, format, plugins: specificPLugins }) => ({
9393
input,

0 commit comments

Comments
 (0)