Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: define and check dist size limit [KHCP-7179] #455

Merged
merged 9 commits into from
May 26, 2023
10 changes: 3 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ jobs:
# The `...` syntax tells pnpm to include dependent packages
run: pnpm --stream --filter "...${{steps.changed_packages.outputs.filter}}..." run build

- name: Check dist bundle size against max-limit
uses: Kong/github-action-dist-size-checker@main

- name: Publish Previews
if: ${{github.event_name == 'pull_request' && steps.changed_packages.outputs.filter != ''}}
run: |
Expand Down Expand Up @@ -229,13 +232,6 @@ jobs:
```
GITHUB_TOKEN: ${{ secrets.KONGPONENTS_BOT_PAT }}

- name: Upload bundle-analyzer results
if: ${{ steps.changed_packages.outputs.filter != '' }}
uses: actions/upload-artifact@v3
with:
name: rollup-plugin-visualizer
path: packages/*/*/bundle-analyzer/stats-treemap.html

- name: Run Unit Tests
if: ${{ steps.changed_packages.outputs.unitTestFilter != '' }}
run: pnpm --parallel --stream --filter "${{steps.changed_packages.outputs.unitTestFilter}}" run test:unit
Expand Down
3 changes: 3 additions & 0 deletions packages/analytics/analytics-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
"volta": {
"extends": "../../../package.json"
},
"distSizeChecker": {
"errorLimit": "500KB"
},
"dependencies": {
"date-fns": "^2.30.0"
}
Expand Down
6 changes: 5 additions & 1 deletion packages/analytics/metric-cards/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"scripts": {
"dev": "cross-env USE_SANDBOX=true vite",
"build": "run-s typecheck build:package build:types",
"build:package": "BUILD_VISUALIZER='analytics/metric-cards' vite build -m production",
"build:package": "vite build -m production",
"build:analyzer": "BUILD_VISUALIZER='analytics/metric-cards' vite build -m production",
"build:types": "vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly",
"preview:package": "vite preview --port 4173",
"preview": "cross-env USE_SANDBOX=true PREVIEW_SANDBOX=true run-s build:package preview:package",
Expand Down Expand Up @@ -60,5 +61,8 @@
"license": "Apache-2.0",
"volta": {
"extends": "../../../package.json"
},
"distSizeChecker": {
"errorLimit": "500KB"
}
}
6 changes: 5 additions & 1 deletion packages/core/app-layout/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"scripts": {
"dev": "cross-env USE_SANDBOX=true vite",
"build": "run-s typecheck build:package build:types",
"build:package": "BUILD_VISUALIZER='core/app-layout' vite build -m production",
"build:package": "vite build -m production",
"build:analyzer": "BUILD_VISUALIZER='core/app-layout' vite build -m production",
"build:types": "vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly",
"preview:package": "vite preview --port 4173",
"preview": "cross-env USE_SANDBOX=true PREVIEW_SANDBOX=true run-s build:package preview:package",
Expand Down Expand Up @@ -65,5 +66,8 @@
"license": "Apache-2.0",
"volta": {
"extends": "../../../package.json"
},
"distSizeChecker": {
"errorLimit": "500KB"
}
}
6 changes: 5 additions & 1 deletion packages/core/cli/src/__template__/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"scripts": {
"dev": "cross-env USE_SANDBOX=true vite",
"build": "run-s typecheck build:package build:types",
"build:package": "BUILD_VISUALIZER='{%%WORKSPACE%%}/{%%PACKAGE_NAME%%}' vite build -m production",
"build:package": "vite build -m production",
"build:analyzer": "BUILD_VISUALIZER='{%%WORKSPACE%%}/{%%PACKAGE_NAME%%}' vite build -m production",
"build:types": "vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly",
"preview:package": "vite preview --port 4173",
"preview": "cross-env USE_SANDBOX=true PREVIEW_SANDBOX=true run-s build:package preview:package",
Expand Down Expand Up @@ -52,5 +53,8 @@
"license": "Apache-2.0",
"volta": {
"extends": "../../../package.json"
},
"distSizeChecker": {
"errorLimit": "200KB"
}
}
6 changes: 5 additions & 1 deletion packages/core/copy-uuid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"scripts": {
"dev": "cross-env USE_SANDBOX=true vite",
"build": "run-s typecheck build:package build:types",
"build:package": "BUILD_VISUALIZER='core/copy-uuid' vite build -m production",
"build:package": "vite build -m production",
"build:analyzer": "BUILD_VISUALIZER='core/copy-uuid' vite build -m production",
"build:types": "vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly",
"preview:package": "vite preview --port 4173",
"preview": "cross-env USE_SANDBOX=true PREVIEW_SANDBOX=true run-s build:package preview:package",
Expand Down Expand Up @@ -57,5 +58,8 @@
"license": "Apache-2.0",
"volta": {
"extends": "../../../package.json"
},
"distSizeChecker": {
"errorLimit": "250KB"
}
}
6 changes: 5 additions & 1 deletion packages/core/i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"scripts": {
"dev": "cross-env USE_SANDBOX=true vite",
"build": "run-s typecheck build:package build:types",
"build:package": "BUILD_VISUALIZER='core/i18n' vite build -m production",
"build:package": "vite build -m production",
"build:analyzer": "BUILD_VISUALIZER='core/i18n' vite build -m production",
"build:types": "vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly",
"preview:package": "vite preview --port 4173",
"preview": "cross-env USE_SANDBOX=true PREVIEW_SANDBOX=true run-s build:package preview:package",
Expand Down Expand Up @@ -50,6 +51,9 @@
"volta": {
"extends": "../../../package.json"
},
"distSizeChecker": {
"errorLimit": "300KB"
},
"peerDependencies": {
"vue": "^3.2.47"
},
Expand Down
9 changes: 6 additions & 3 deletions packages/core/misc-widgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"scripts": {
"dev": "cross-env USE_SANDBOX=true vite",
"build": "run-s typecheck build:package build:types",
"build:package": "BUILD_VISUALIZER='core/misc-widgets' vite build -m production",
"build:package": "vite build -m production",
"build:analyzer": "BUILD_VISUALIZER='core/misc-widgets' vite build -m production",
"build:types": "vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly",
"preview:package": "vite preview --port 4173",
"preview": "cross-env USE_SANDBOX=true PREVIEW_SANDBOX=true run-s build:package preview:package",
Expand Down Expand Up @@ -58,7 +59,9 @@
"author": "Kong, Inc.",
"license": "Apache-2.0",
"volta": {
"extends": "../../../package.json",
"yarn": "1.22.19"
"extends": "../../../package.json"
},
"distSizeChecker": {
"errorLimit": "250KB"
}
}
6 changes: 5 additions & 1 deletion packages/portal/document-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"scripts": {
"dev": "cross-env USE_SANDBOX=true vite",
"build": "run-s typecheck build:package build:types",
"build:package": "BUILD_VISUALIZER='portal/document-viewer' vite build -m production",
"build:package": "vite build -m production",
"build:analyzer": "BUILD_VISUALIZER='portal/document-viewer' vite build -m production",
"build:types": "vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly",
"preview:package": "vite preview --port 4173",
"preview": "cross-env USE_SANDBOX=true PREVIEW_SANDBOX=true run-s build:package preview:package",
Expand Down Expand Up @@ -61,5 +62,8 @@
"license": "Apache-2.0",
"volta": {
"extends": "../../../package.json"
},
"distSizeChecker": {
"errorLimit": "3MB"
}
}
6 changes: 5 additions & 1 deletion packages/portal/spec-renderer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"scripts": {
"dev": "cross-env USE_SANDBOX=true vite",
"build": "run-s typecheck build:package build:types",
"build:package": "BUILD_VISUALIZER='portal/spec-renderer' vite build -m production",
"build:package": "vite build -m production",
"build:analyzer": "BUILD_VISUALIZER='portal/spec-renderer' vite build -m production",
"build:types": "vue-tsc -p './tsconfig.build.json' --emitDeclarationOnly",
"preview:package": "vite preview --port 4173",
"preview": "cross-env USE_SANDBOX=true PREVIEW_SANDBOX=true run-s build:package preview:package",
Expand Down Expand Up @@ -67,5 +68,8 @@
"license": "Apache-2.0",
"volta": {
"extends": "../../../package.json"
},
"distSizeChecker": {
"errorLimit": "7.5MB"
}
}
3 changes: 3 additions & 0 deletions packages/portal/swagger-ui-web-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"volta": {
"extends": "../../../package.json"
},
"distSizeChecker": {
"errorLimit": "3MB"
},
"devDependencies": {
"css-loader": "^6.7.3",
"raw-loader": "^4.0.2",
Expand Down