Skip to content

Commit f27a98b

Browse files
committed
ci: improve size script
1 parent c1cf26d commit f27a98b

File tree

6 files changed

+26
-12
lines changed

6 files changed

+26
-12
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ jobs:
5050
with:
5151
github_token: ${{ secrets.GITHUB_TOKEN }}
5252
build_script: size
53-
files: packages/vue/dist/vue.global.prod.js packages/runtime-dom/dist/runtime-dom.global.prod.js packages/size-check/dist/size-check.global.prod.js
53+
files: packages/vue/dist/vue.global.prod.js packages/runtime-dom/dist/runtime-dom.global.prod.js packages/size-check/dist/index.js

package.json

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
"scripts": {
88
"dev": "node scripts/dev.js",
99
"build": "node scripts/build.js",
10-
"size": "node scripts/build.js vue runtime-dom size-check -p -f global",
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 runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build",
1113
"lint": "eslint --ext .ts packages/*/src/**.ts",
1214
"format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
1315
"test": "node scripts/build.js vue -f global -d && jest --runInBand",
1416
"test-dts": "node scripts/build.js shared reactivity runtime-core runtime-dom -dt -f esm-bundler && yarn test-dts-only",
1517
"test-dts-only": "tsc -p ./test-dts/tsconfig.json && tsc -p ./test-dts/tsconfig.build.json",
1618
"release": "node scripts/release.js",
1719
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
18-
"dev-compiler": "npm-run-all --parallel \"dev template-explorer\" serve",
19-
"dev-sfc": "npm-run-all --parallel \"dev compiler-sfc -f esm-browser\" \"dev runtime-core -f esm-bundler\" \"dev runtime-dom -f esm-bundler\" serve-sfc-playground",
20+
"dev-compiler": "run-p \"dev template-explorer\" serve",
21+
"dev-sfc": "run-p \"dev compiler-sfc -f esm-browser\" \"dev runtime-core -f esm-bundler\" \"dev runtime-dom -f esm-bundler\" serve-sfc-playground",
2022
"serve-sfc-playground": "vite packages/sfc-playground --host",
2123
"serve": "serve",
2224
"open": "open http://localhost:5000/packages/template-explorer/local.html",

packages/size-check/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "@vue/size-check",
33
"version": "3.2.16",
44
"private": true,
5-
"buildOptions": {
6-
"name": "Vue",
7-
"formats": [
8-
"global"
9-
]
5+
"scripts": {
6+
"build": "vite build"
7+
},
8+
"devDependencies": {
9+
"vite": "^2.5.10"
1010
}
1111
}

packages/size-check/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { h, createApp } from '@vue/runtime-dom'
1+
import { h, createApp } from 'vue'
22

33
// The bare minimum code required for rendering something to the screen
44
createApp({

packages/size-check/vite.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default {
2+
build: {
3+
rollupOptions: {
4+
input: ['src/index.ts'],
5+
output: {
6+
entryFileNames: `[name].js`
7+
}
8+
}
9+
}
10+
}

scripts/build.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async function build(target) {
155155
}
156156

157157
function checkAllSizes(targets) {
158-
if (devOnly) {
158+
if (devOnly || (formats && !formats.includes('global'))) {
159159
return
160160
}
161161
console.log()
@@ -168,7 +168,9 @@ function checkAllSizes(targets) {
168168
function checkSize(target) {
169169
const pkgDir = path.resolve(`packages/${target}`)
170170
checkFileSize(`${pkgDir}/dist/${target}.global.prod.js`)
171-
checkFileSize(`${pkgDir}/dist/${target}.runtime.global.prod.js`)
171+
if (!formats || formats.includes('global-runtime')) {
172+
checkFileSize(`${pkgDir}/dist/${target}.runtime.global.prod.js`)
173+
}
172174
}
173175

174176
function checkFileSize(filePath) {

0 commit comments

Comments
 (0)