]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
build: report both gzip and brotli sizes
authorEvan You <yyx990803@gmail.com>
Fri, 4 Oct 2019 13:57:32 +0000 (09:57 -0400)
committerEvan You <yyx990803@gmail.com>
Fri, 4 Oct 2019 13:57:32 +0000 (09:57 -0400)
scripts/build.js

index b4d63ab21d8aa32b6c85e1b4a4cb36b4ba330a9c..51eb6bc03abcd9af22637f203522903c40d63969 100644 (file)
@@ -19,6 +19,7 @@ const path = require('path')
 const zlib = require('zlib')
 const chalk = require('chalk')
 const execa = require('execa')
+const { gzipSync } = require('zlib')
 const { compress } = require('brotli')
 const { targets: allTargets, fuzzyMatchTarget } = require('./utils')
 
@@ -112,12 +113,14 @@ function checkSize(target) {
   if (fs.existsSync(esmProdBuild)) {
     const file = fs.readFileSync(esmProdBuild)
     const minSize = (file.length / 1024).toFixed(2) + 'kb'
+    const gzipped = gzipSync(file)
+    const gzippedSize = (gzipped.length / 1024).toFixed(2) + 'kb'
     const compressed = compress(file)
     const compressedSize = (compressed.length / 1024).toFixed(2) + 'kb'
     console.log(
       `${chalk.gray(
         chalk.bold(target)
-      )} min:${minSize} / brotli:${compressedSize}`
+      )} min:${minSize} / gzip:${gzippedSize} / brotli:${compressedSize}`
     )
   }
 }