ci: improve size script
This commit is contained in:
parent
c1cf26d207
commit
f27a98becc
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -50,4 +50,4 @@ jobs:
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
build_script: size
|
||||
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
|
||||
files: packages/vue/dist/vue.global.prod.js packages/runtime-dom/dist/runtime-dom.global.prod.js packages/size-check/dist/index.js
|
||||
|
@ -7,7 +7,9 @@
|
||||
"scripts": {
|
||||
"dev": "node scripts/dev.js",
|
||||
"build": "node scripts/build.js",
|
||||
"size": "node scripts/build.js vue runtime-dom size-check -p -f global",
|
||||
"size": "run-s size-global size-baseline",
|
||||
"size-global": "node scripts/build.js vue runtime-dom -f global -p",
|
||||
"size-baseline": "node scripts/build.js vue runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build",
|
||||
"lint": "eslint --ext .ts packages/*/src/**.ts",
|
||||
"format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
|
||||
"test": "node scripts/build.js vue -f global -d && jest --runInBand",
|
||||
@ -15,8 +17,8 @@
|
||||
"test-dts-only": "tsc -p ./test-dts/tsconfig.json && tsc -p ./test-dts/tsconfig.build.json",
|
||||
"release": "node scripts/release.js",
|
||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
||||
"dev-compiler": "npm-run-all --parallel \"dev template-explorer\" serve",
|
||||
"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",
|
||||
"dev-compiler": "run-p \"dev template-explorer\" serve",
|
||||
"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",
|
||||
"serve-sfc-playground": "vite packages/sfc-playground --host",
|
||||
"serve": "serve",
|
||||
"open": "open http://localhost:5000/packages/template-explorer/local.html",
|
||||
|
@ -2,10 +2,10 @@
|
||||
"name": "@vue/size-check",
|
||||
"version": "3.2.16",
|
||||
"private": true,
|
||||
"buildOptions": {
|
||||
"name": "Vue",
|
||||
"formats": [
|
||||
"global"
|
||||
]
|
||||
"scripts": {
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite": "^2.5.10"
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { h, createApp } from '@vue/runtime-dom'
|
||||
import { h, createApp } from 'vue'
|
||||
|
||||
// The bare minimum code required for rendering something to the screen
|
||||
createApp({
|
||||
|
10
packages/size-check/vite.config.js
Normal file
10
packages/size-check/vite.config.js
Normal file
@ -0,0 +1,10 @@
|
||||
export default {
|
||||
build: {
|
||||
rollupOptions: {
|
||||
input: ['src/index.ts'],
|
||||
output: {
|
||||
entryFileNames: `[name].js`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -155,7 +155,7 @@ async function build(target) {
|
||||
}
|
||||
|
||||
function checkAllSizes(targets) {
|
||||
if (devOnly) {
|
||||
if (devOnly || (formats && !formats.includes('global'))) {
|
||||
return
|
||||
}
|
||||
console.log()
|
||||
@ -168,7 +168,9 @@ function checkAllSizes(targets) {
|
||||
function checkSize(target) {
|
||||
const pkgDir = path.resolve(`packages/${target}`)
|
||||
checkFileSize(`${pkgDir}/dist/${target}.global.prod.js`)
|
||||
if (!formats || formats.includes('global-runtime')) {
|
||||
checkFileSize(`${pkgDir}/dist/${target}.runtime.global.prod.js`)
|
||||
}
|
||||
}
|
||||
|
||||
function checkFileSize(filePath) {
|
||||
|
Loading…
Reference in New Issue
Block a user