workflow: report brotli size of baseline build

This commit is contained in:
Evan You 2021-12-11 10:38:21 +08:00
parent 1928c9b537
commit d0ea900922
2 changed files with 7 additions and 1 deletions

View File

@ -6,7 +6,7 @@
"build": "node scripts/build.js",
"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 runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build",
"size-baseline": "node scripts/build.js runtime-dom runtime-core reactivity shared -f esm-bundler && cd packages/size-check && vite build && node brotli",
"lint": "eslint --ext .ts packages/*/src/**.ts",
"format": "prettier --write --parser typescript \"packages/**/*.ts?(x)\"",
"test": "run-s \"test-unit -- {@}\" \"test-e2e -- {@}\" --",

View File

@ -0,0 +1,6 @@
const { compress } = require('brotli')
const file = require('fs').readFileSync('dist/index.js')
const compressed = compress(file)
const compressedSize = (compressed.length / 1024).toFixed(2) + 'kb'
console.log(`brotli: ${compressedSize}`)