Skip to content

Commit

Permalink
Require Node.js 12
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 2, 2021
1 parent e5200f1 commit b022d53
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 30 deletions.
3 changes: 0 additions & 3 deletions .github/funding.yml

This file was deleted.

5 changes: 2 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ jobs:
fail-fast: false
matrix:
node-version:
- 16
- 14
- 12
- 10
- 8
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand Down
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ module.exports = (options = {}) => {
}, function (callback) {
this.size = totalSize.values().next().value;
this.prettySize = prettyBytes(this.size);

if (!(fileCount === 1 && options.showFiles) && hasSize(totalSize) && fileCount > 0 && options.showTotal) {
log(chalk.green('all files'), totalSize);
}
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 <sindresorhus@gmail.com> (sindresorhus.com)
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (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
21 changes: 11 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
"description": "Display the size of your project",
"license": "MIT",
"repository": "sindresorhus/gulp-size",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=12"
},
"scripts": {
"test": "xo && mocha"
Expand All @@ -32,18 +33,18 @@
],
"dependencies": {
"brotli-size": "^4.0.0",
"chalk": "^2.3.0",
"fancy-log": "^1.3.2",
"gzip-size": "^5.1.1",
"chalk": "^4.1.1",
"fancy-log": "^1.3.3",
"gzip-size": "^6.0.0",
"plugin-error": "^1.0.1",
"pretty-bytes": "^5.3.0",
"pretty-bytes": "^5.6.0",
"stream-counter": "^1.0.0",
"through2": "^3.0.1"
"through2": "^4.0.2"
},
"devDependencies": {
"mocha": "^6.2.0",
"vinyl": "^2.1.0",
"xo": "^0.24.0"
"mocha": "^8.3.2",
"vinyl": "^2.2.1",
"xo": "^0.39.1"
},
"peerDependencies": {
"gulp": ">=4"
Expand Down
21 changes: 9 additions & 12 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@

Logs out the total size of files in the stream and optionally the individual file-sizes.


## Install

```
$ npm install --save-dev gulp-size
```


## Usage

```js
Expand All @@ -27,7 +25,6 @@ exports.default = () => (
);
```


## API

### size(options?)
Expand All @@ -38,63 +35,63 @@ Type: `object`

##### title

Type: `string`<br>
Type: `string`\
Default: `''`

Give it a title so it's possible to distinguish the output of multiple instances logging at once.

##### gzip

Type: `boolean`<br>
Type: `boolean`\
Default: `false`

Displays the gzipped size.

##### brotli

Type: `boolean`<br>
Type: `boolean`\
Default: `false`

Displays the brotli compressed size.

##### uncompressed

Type: `boolean`<br>
Type: `boolean`\
Default: `false` if either of gzip or brotli is `true`, otherwise `true`

Displays the uncompressed size.

##### pretty

Type: `boolean`<br>
Type: `boolean`\
Default: `true`

Displays prettified size: `1337 B``1.34 kB`.

##### showFiles

Type: `boolean`<br>
Type: `boolean`\
Default: `false`

Displays the size of every file instead of just the total size.

##### showTotal

Type: `boolean`<br>
Type: `boolean`\
Default: `true`

Displays the total of all files.

### size.size

Type: `number`<br>
Type: `number`\
Example: `12423000`

The total size of all files in bytes.

### size.prettySize

Type: `string`<br>
Type: `string`\
Example: `14 kB`

Prettified version of `.size`.
Expand Down
2 changes: 1 addition & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path');
const assert = require('assert');
const Vinyl = require('vinyl');
const through = require('through2');
const size = require('.');
const size = require('./index.js');

it('should show the size of files in the stream', callback => {
const out = process.stdout.write.bind(process.stdout);
Expand Down

0 comments on commit b022d53

Please sign in to comment.