Skip to content

Commit

Permalink
Require Node.js 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Nov 16, 2020
1 parent 6646b59 commit aab9dde
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js:
- '14'
- '12'
- '10'
- '8'
- '6'
6 changes: 2 additions & 4 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const cli = meow(`
`, {
flags: {
level: {
type: 'string'
type: 'number'
},
raw: {
type: 'boolean'
Expand All @@ -40,9 +40,7 @@ if (!input && process.stdin.isTTY) {
const source = input ? fs.createReadStream(input) : process.stdin;

const options = {};
if (cli.flags.level) {
options.level = Number(cli.flags.level);
}
options.level = cli.flags.level;

source.pipe(gzipSize.stream(options)).on('gzip-size', size => {
console.log(cli.flags.raw ? size : prettyBytes(size));
Expand Down
2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
Copyright (c) Sindre Sorhus <[email protected]> (https://sindresorhus.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
"description": "Get the gzipped size of a file or stdin",
"license": "MIT",
"repository": "sindresorhus/gzip-size-cli",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "[email protected]",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"bin": {
"gzip-size": "cli.js"
},
"engines": {
"node": ">=6"
"node": ">=10"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -32,13 +33,13 @@
"stdin"
],
"dependencies": {
"gzip-size": "^5.0.0",
"meow": "^5.0.0",
"pretty-bytes": "^5.1.0"
"gzip-size": "^6.0.0",
"meow": "^8.0.0",
"pretty-bytes": "^5.4.1"
},
"devDependencies": {
"ava": "*",
"execa": "^0.10.0",
"xo": "*"
"ava": "^2.4.0",
"execa": "^4.1.0",
"xo": "^0.34.2"
}
}
10 changes: 1 addition & 9 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# gzip-size-cli [![Build Status](https://travis-ci.org/sindresorhus/gzip-size-cli.svg?branch=master)](https://travis-ci.org/sindresorhus/gzip-size-cli)
# gzip-size-cli [![Build Status](https://travis-ci.com/sindresorhus/gzip-size-cli.svg?branch=master)](https://travis-ci.com/github/sindresorhus/gzip-size-cli)

> Get the gzipped size of a file or stdin

## Install

```
$ npm install --global gzip-size-cli
```


## Usage

```
Expand All @@ -30,12 +28,6 @@ $ gzip-size --help
192256
```


## Related

- [gzip-size](https://github.com/sindresorhus/gzip-size) - API for this module


## License

MIT © [Sindre Sorhus](https://sindresorhus.com)
4 changes: 2 additions & 2 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ test('main', async t => {

test('file', async t => {
const {stdout} = await execa('./cli.js', ['test.js', '--raw']);
t.is(parseInt(stdout, 10), gzipSize.sync(fixture));
t.is(Number.parseInt(stdout, 10), gzipSize.sync(fixture));
});

test('stdin', async t => {
const {stdout} = await execa('./cli.js', ['test.js', '--raw'], {
input: fs.createReadStream('test.js')
});
t.is(parseInt(stdout, 10), gzipSize.sync(fixture));
t.is(Number.parseInt(stdout, 10), gzipSize.sync(fixture));
});

0 comments on commit aab9dde

Please sign in to comment.