Skip to content

Commit

Permalink
feat: add gzip in log
Browse files Browse the repository at this point in the history
  • Loading branch information
hustcc committed Oct 16, 2020
1 parent 63b2d93 commit a07df66
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "limit-size",
"version": "0.1.3",
"version": "0.1.4",
"description": "Lightweight, Convenient, Fast command tool to control your file size, size-limit is too bloated.",
"license": "MIT",
"bin": {
Expand Down
2 changes: 1 addition & 1 deletion src/cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { lint } from './lint';
import { logResust } from './log';

program
.version('0.1.3', '-v, --version')
.version('0.1.4', '-v, --version')
.usage('<limit-size> [options]')
.description('limit size for your files.')
.option('-c, --config [configure-file]', 'default .limit-size.json')
Expand Down
8 changes: 7 additions & 1 deletion src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ import { format } from './bytes';
dist/g2plot.min.js
Size limit: 700 KB
Size: 305.15 KB
Gzip: Yes
dist/g2plot.min.js
Package size limit has exceeded by 105.15 KB
Size limit: 200 KB
Size: 305.15 KB
Gzip: No
*/
export function logResust(result: Result) {
result.forEach((r: SingleResult) => {
const { config, passed, bytes, limitBytes } = r;
const { path, limit } = config;
const { path, limit, gzip } = config;

const logs = [
chalk.bold(path),
Expand All @@ -32,6 +34,10 @@ export function logResust(result: Result) {
'Size: ',
passed ? chalk.bold.green(format(bytes)) : chalk.bold.red(format(bytes)),
'\n',
' ',
'Gzip: ',
gzip ? chalk.bold('Yes') : chalk.bold('No'),
'\n',
];

// 打印
Expand Down

0 comments on commit a07df66

Please sign in to comment.