diff --git a/package.json b/package.json index 8385902f..ebea38cb 100644 --- a/package.json +++ b/package.json @@ -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 -- {@}\" --", diff --git a/packages/size-check/brotli.js b/packages/size-check/brotli.js new file mode 100644 index 00000000..1e7ea0c7 --- /dev/null +++ b/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}`)