Skip to content

Commit

Permalink
workflow: report brotli size of baseline build
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 11, 2021
1 parent 1928c9b commit d0ea900
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -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 -- {@}\" --",
Expand Down
6 changes: 6 additions & 0 deletions packages/size-check/brotli.js
@@ -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}`)

0 comments on commit d0ea900

Please sign in to comment.