Skip to content

Commit bb54235

Browse files
committed
Require Node.js 14
1 parent e6e6a7f commit bb54235

File tree

10 files changed

+75
-98
lines changed

10 files changed

+75
-98
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true
99

10-
[{package.json,*.yml}]
10+
[*.yml]
1111
indent_style = space
1212
indent_size = 2

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* text=auto
1+
* text=auto eol=lf

.github/workflows/main.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,11 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13+
- 16
1314
- 14
14-
- 12
15-
- 10
16-
- 8
17-
- 6
18-
- 4
1915
steps:
2016
- uses: actions/checkout@v2
21-
- uses: actions/setup-node@v1
17+
- uses: actions/setup-node@v2
2218
with:
2319
node-version: ${{ matrix.node-version }}
2420
- run: npm install

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
yarn.lock

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

cli.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env node
2-
'use strict';
3-
const meow = require('meow');
4-
const getStdin = require('get-stdin');
5-
const prettyBytes = require('pretty-bytes');
2+
import process from 'node:process';
3+
import meow from 'meow';
4+
import getStdin from 'get-stdin';
5+
import prettyBytes from 'pretty-bytes';
66

77
const cli = meow(`
88
Usage
@@ -12,7 +12,9 @@ const cli = meow(`
1212
Example
1313
$ pretty-bytes 1337
1414
1.34 kB
15-
`);
15+
`, {
16+
importMeta: import.meta,
17+
});
1618

1719
const input = cli.input[0];
1820

@@ -25,8 +27,4 @@ if (!input && process.stdin.isTTY) {
2527
process.exit(1);
2628
}
2729

28-
if (input) {
29-
init(input);
30-
} else {
31-
getStdin().then(init);
32-
}
30+
init(input ? input : await getStdin());

license

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
The MIT License (MIT)
1+
MIT License
22

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

5-
Permission is hereby granted, free of charge, to any person obtaining a copy
6-
of this software and associated documentation files (the "Software"), to deal
7-
in the Software without restriction, including without limitation the rights
8-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
copies of the Software, and to permit persons to whom the Software is
10-
furnished to do so, subject to the following conditions:
5+
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:
116

12-
The above copyright notice and this permission notice shall be included in
13-
all copies or substantial portions of the Software.
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
148

15-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
THE SOFTWARE.
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

package.json

Lines changed: 49 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,51 @@
11
{
2-
"name": "pretty-bytes-cli",
3-
"version": "2.0.0",
4-
"description": "Convert bytes to a human readable string: 1337 → 1.34 kB",
5-
"license": "MIT",
6-
"repository": "sindresorhus/pretty-bytes-cli",
7-
"author": {
8-
"name": "Sindre Sorhus",
9-
"email": "[email protected]",
10-
"url": "sindresorhus.com"
11-
},
12-
"bin": {
13-
"pretty-bytes": "cli.js"
14-
},
15-
"engines": {
16-
"node": ">=4"
17-
},
18-
"scripts": {
19-
"test": "xo && ava"
20-
},
21-
"files": [
22-
"cli.js"
23-
],
24-
"keywords": [
25-
"cli-app",
26-
"cli",
27-
"pretty",
28-
"bytes",
29-
"byte",
30-
"filesize",
31-
"size",
32-
"file",
33-
"human",
34-
"humanized",
35-
"readable",
36-
"si",
37-
"data"
38-
],
39-
"dependencies": {
40-
"get-stdin": "^5.0.1",
41-
"meow": "^3.6.0",
42-
"pretty-bytes": "^4.0.0"
43-
},
44-
"devDependencies": {
45-
"ava": "*",
46-
"execa": "^0.4.0",
47-
"xo": "*"
48-
},
49-
"xo": {
50-
"esnext": true
51-
}
2+
"name": "pretty-bytes-cli",
3+
"version": "2.0.0",
4+
"description": "Convert bytes to a human readable string: 1337 → 1.34 kB",
5+
"license": "MIT",
6+
"repository": "sindresorhus/pretty-bytes-cli",
7+
"funding": "https://github.com/sponsors/sindresorhus",
8+
"author": {
9+
"name": "Sindre Sorhus",
10+
"email": "[email protected]",
11+
"url": "https://sindresorhus.com"
12+
},
13+
"type": "module",
14+
"bin": {
15+
"pretty-bytes": "./cli.js"
16+
},
17+
"engines": {
18+
"node": "^14.18.0 || >=16.0.0"
19+
},
20+
"scripts": {
21+
"test": "xo && ava"
22+
},
23+
"files": [
24+
"cli.js"
25+
],
26+
"keywords": [
27+
"cli-app",
28+
"cli",
29+
"pretty",
30+
"bytes",
31+
"byte",
32+
"filesize",
33+
"size",
34+
"file",
35+
"human",
36+
"humanized",
37+
"readable",
38+
"si",
39+
"data"
40+
],
41+
"dependencies": {
42+
"get-stdin": "^9.0.0",
43+
"meow": "^10.1.2",
44+
"pretty-bytes": "^6.0.0"
45+
},
46+
"devDependencies": {
47+
"ava": "^4.0.1",
48+
"execa": "^6.1.0",
49+
"xo": "^0.48.0"
50+
}
5251
}

readme.md

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@
44
55
Useful for displaying file sizes for humans.
66

7-
87
## Install
98

10-
```
11-
$ npm install --global pretty-bytes-cli
9+
```sh
10+
npm install --global pretty-bytes-cli
1211
```
1312

14-
1513
## Usage
1614

1715
```
@@ -26,12 +24,6 @@ $ pretty-bytes --help
2624
1.34 kB
2725
```
2826

29-
3027
## Related
3128

3229
- [pretty-bytes](https://github.com/sindresorhus/pretty-bytes) - API for this module
33-
34-
35-
## License
36-
37-
MIT © [Sindre Sorhus](https://sindresorhus.com)

test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import test from 'ava';
2-
import execa from 'execa';
2+
import {execa} from 'execa';
33

44
test('main', async t => {
5-
t.is(await execa.stdout('./cli.js', ['1337']), '1.34 kB');
5+
const {stdout} = await execa('./cli.js', ['1337']);
6+
t.is(stdout, '1.34 kB');
67
});
78

89
test('stdin', async t => {
9-
t.is(await execa.stdout('./cli.js', {input: '1337'}), '1.34 kB');
10+
const {stdout} = await execa('./cli.js', {input: '1337'});
11+
t.is(stdout, '1.34 kB');
1012
});

0 commit comments

Comments
 (0)