Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: size
on:
# this action will error unless run in a pr context
pull_request:
pull_request_target:

jobs:
# Build current and upload stats.json
# You may replace this with your own build method. All that
# is required is that the stats.json be an artifact
build-head:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- run: pnpm install
- run: pnpm build
- name: Upload stats.json
uses: actions/upload-artifact@v3
with:
name: head-stats
path: ./stats.json

# Build base for comparison and upload stats.json
# You may replace this with your own build method. All that
# is required is that the stats.json be an artifact
build-base:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: ${{ github.base_ref }}
- run: corepack enable
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- run: pnpm install
- run: pnpm build
- name: Upload stats.json
uses: actions/upload-artifact@v3
with:
name: base-stats
path: ./stats.json

# run the action against the stats.json files
compare:
runs-on: ubuntu-latest
needs: [build-base, build-head]
permissions:
pull-requests: write
steps:
- uses: actions/download-artifact@v3
- uses: twk3/rollup-size-compare-action@v1.0.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
current-stats-json-path: ./head-stats/stats.json
base-stats-json-path: ./base-stats/stats.json
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dist
nuxt-app
.pnpm-store
coverage
stats.json
2 changes: 2 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineBuildConfig } from 'unbuild'
import type { InputPluginOption } from 'rollup'
import { purgePolyfills } from 'unplugin-purge-polyfills'
import { visualizer } from 'rollup-plugin-visualizer'

export default defineBuildConfig({
declaration: true,
Expand All @@ -10,6 +11,7 @@ export default defineBuildConfig({
plugins.push(purgePolyfills.rollup({
logLevel: 'verbose',
}))
plugins.push(visualizer({ template: 'raw-data' }))
},
},
rollup: {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"pkg-pr-new": "^0.0.39",
"pkg-types": "^1.3.0",
"rollup": "^4.30.0",
"rollup-plugin-visualizer": "^5.13.1",
"scule": "^1.3.0",
"semver": "^7.6.3",
"std-env": "^3.8.0",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading