Skip to content

Commit

Permalink
chore: update scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Apr 17, 2024
1 parent 960e67c commit 65ff9ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@
"@type-challenges/utils": "0.1.1",
"bannerjs": "2.0.1",
"colors-cli": "^1.0.29",
"pako": "^2.1.0",
"rollup": "^3.17.3",
"tsbb": "^4.0.5",
"zlib": "1.0.5"
},
"dependencies": {}
"tsbb": "^4.0.5"
}
}
10 changes: 4 additions & 6 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const nodeResolve = require('@rollup/plugin-node-resolve');
const commonjs = require('@rollup/plugin-commonjs');
const terser = require('@rollup/plugin-terser');
const banner = require('bannerjs');
const zlib = require('zlib');
const pako = require('pako');
require('colors-cli/toxic');

// see below for details on the options
Expand Down Expand Up @@ -60,11 +60,9 @@ const inputOptions = {

function report(result, outpath, extra) {
const code = result.output[0].code;
zlib.gzip(code, (_err, zipped) => {
if (_err) return reject(_err);
extra = `(gzipped: ${getSize(zipped).green_bt})`;
console.log(`${(outpath).blue_bt} ${getSize(code).green_bt + (extra || '')}`);
});
const compressed = pako.deflate(code);
extra = ` (gzipped: ${(compressed.length / 1024).toFixed(2).green_bt} kb)`
console.log(`${(outpath).blue_bt} ${getSize(code).green_bt + (extra || '')}`);
}

function getSize(code) {
Expand Down

0 comments on commit 65ff9ef

Please sign in to comment.