Skip to content

Commit

Permalink
chore: replace brotli with node:zlib (#8045)
Browse files Browse the repository at this point in the history
Signed-off-by: JayFate <48240828+JayFate@users.noreply.github.com>
  • Loading branch information
JayFate authored Apr 10, 2023
1 parent 19e17a9 commit 37701a8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"@typescript-eslint/parser": "^5.56.0",
"@vitest/coverage-istanbul": "^0.29.7",
"@vue/consolidate": "0.17.3",
"brotli": "^1.3.2",
"chalk": "^4.1.0",
"conventional-changelog-cli": "^2.0.31",
"enquirer": "^2.3.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/size-check/brotli.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { compress } = require('brotli')
const { brotliCompressSync } = require('zlib')

const file = require('fs').readFileSync('dist/index.js')
const compressed = compress(file)
const compressed = brotliCompressSync(file)
const compressedSize = (compressed.length / 1024).toFixed(2) + 'kb'
console.log(`brotli: ${compressedSize}`)
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import fs from 'node:fs/promises'
import { existsSync, readFileSync, rmSync } from 'node:fs'
import path from 'node:path'
import minimist from 'minimist'
import { gzipSync } from 'node:zlib'
import { compress } from 'brotli'
import { gzipSync, brotliCompressSync } from 'node:zlib'
import chalk from 'chalk'
import execa from 'execa'
import { cpus } from 'node:os'
Expand Down Expand Up @@ -143,7 +142,7 @@ function checkFileSize(filePath) {
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 compressed = brotliCompressSync(file)
// @ts-ignore
const compressedSize = (compressed.length / 1024).toFixed(2) + 'kb'
console.log(
Expand Down

0 comments on commit 37701a8

Please sign in to comment.