Skip to content

Commit 1b56405

Browse files
authored
ci: improved size report (#8992)
1 parent bd08f05 commit 1b56405

16 files changed

+443
-124
lines changed

.eslintrc.cjs

+1-6
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,7 @@ module.exports = {
7474
},
7575
// Node scripts
7676
{
77-
files: [
78-
'scripts/**',
79-
'*.{js,ts}',
80-
'packages/**/index.js',
81-
'packages/size-check/**'
82-
],
77+
files: ['scripts/**', '*.{js,ts}', 'packages/**/index.js'],
8378
rules: {
8479
'no-restricted-globals': 'off',
8580
'no-restricted-syntax': 'off'

.github/contributing.md

-2
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ This repository employs a [monorepo](https://en.wikipedia.org/wiki/Monorepo) set
248248

249249
- `template-explorer`: A development tool for debugging compiler output, continuously deployed at https://template-explorer.vuejs.org/. To run it locally, run [`nr dev-compiler`](#nr-dev-compiler).
250250

251-
- `size-check`: Used for checking built bundle sizes on CI.
252-
253251
### Importing Packages
254252

255253
The packages can import each other directly using their package names. Note that when importing a package, the name listed in its `package.json` should be used. Most of the time the `@vue/` prefix is needed:

.github/workflows/ci.yml

-20
Original file line numberDiff line numberDiff line change
@@ -114,23 +114,3 @@ jobs:
114114

115115
- name: Run type declaration tests
116116
run: pnpm run test-dts
117-
118-
size:
119-
runs-on: ubuntu-latest
120-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
121-
env:
122-
CI_JOB_NUMBER: 1
123-
steps:
124-
- uses: actions/checkout@v3
125-
126-
- name: Install pnpm
127-
uses: pnpm/action-setup@v2
128-
129-
- name: Set node version to 18
130-
uses: actions/setup-node@v3
131-
with:
132-
node-version: 18
133-
cache: 'pnpm'
134-
135-
- run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
136-
- run: pnpm run size

.github/workflows/size-report.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: size report
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
12+
jobs:
13+
size:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Install pnpm
20+
uses: pnpm/action-setup@v2
21+
22+
- name: Set node version to LTS
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: lts/*
26+
cache: pnpm
27+
28+
- run: PUPPETEER_SKIP_DOWNLOAD=1 pnpm install
29+
- run: pnpm run size
30+
31+
- name: Download Previous Size Report
32+
id: download-artifact
33+
uses: dawidd6/action-download-artifact@v2
34+
with:
35+
branch: main
36+
name: size-report
37+
path: temp/size-prev
38+
if_no_artifact_found: warn
39+
40+
- name: Upload Size Report
41+
uses: actions/upload-artifact@v3
42+
with:
43+
name: size-report
44+
path: temp/size
45+
46+
- name: Compare size
47+
run: pnpm tsx scripts/size-report.ts > size.md
48+
49+
- name: Read Size Markdown
50+
id: size-markdown
51+
uses: juliangruber/read-file-action@v1
52+
with:
53+
path: ./size.md
54+
55+
- name: Create Comment
56+
uses: actions-cool/maintain-one-comment@v3
57+
with:
58+
body: |
59+
${{steps.size-markdown.outputs.content}}
60+
<!-- VUE_CORE_SIZE -->
61+
body-include: '<!-- VUE_CORE_SIZE -->'

package.json

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
"dev": "node scripts/dev.js",
88
"build": "node scripts/build.js",
99
"build-dts": "tsc -p tsconfig.build.json && rollup -c rollup.dts.config.js",
10-
"size": "run-s size-global size-baseline",
11-
"size-global": "node scripts/build.js vue runtime-dom -f global -p",
12-
"size-baseline": "node scripts/build.js vue -f esm-bundler-runtime && node scripts/build.js runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build && node brotli",
10+
"size": "run-s \"size-*\" && tsx scripts/usage-size.ts",
11+
"size-global": "node scripts/build.js vue runtime-dom -f global -p --size",
12+
"size-esm-runtime": "node scripts/build.js vue -f esm-bundler-runtime",
13+
"size-esm": "node scripts/build.js runtime-dom runtime-core reactivity shared -f esm-bundler",
1314
"check": "tsc --incremental --noEmit",
1415
"lint": "eslint --cache --ext .ts packages/*/{src,__tests__}/**.ts",
1516
"format": "prettier --write --cache \"**/*.[tj]s?(x)\"",
@@ -81,10 +82,12 @@
8182
"lint-staged": "^10.2.10",
8283
"lodash": "^4.17.15",
8384
"magic-string": "^0.30.0",
85+
"markdown-table": "^3.0.3",
8486
"marked": "^4.0.10",
8587
"minimist": "^1.2.0",
8688
"npm-run-all": "^4.1.5",
8789
"prettier": "^3.0.1",
90+
"pretty-bytes": "^6.1.1",
8891
"pug": "^3.0.1",
8992
"puppeteer": "~19.6.0",
9093
"rollup": "^3.26.0",
@@ -94,9 +97,10 @@
9497
"semver": "^7.3.2",
9598
"serve": "^12.0.0",
9699
"simple-git-hooks": "^2.8.1",
97-
"terser": "^5.15.1",
100+
"terser": "^5.19.2",
98101
"todomvc-app-css": "^2.3.0",
99102
"tslib": "^2.5.0",
103+
"tsx": "^3.12.7",
100104
"typescript": "^5.1.6",
101105
"vite": "^4.3.0",
102106
"vitest": "^0.30.1"

packages/size-check/README.md

-3
This file was deleted.

packages/size-check/brotli.js

-6
This file was deleted.

packages/size-check/package.json

-11
This file was deleted.

packages/size-check/src/index.ts

-6
This file was deleted.

packages/size-check/vite.config.js

-15
This file was deleted.

0 commit comments

Comments
 (0)