Skip to content

Commit 1a95db2

Browse files
chore(sio-client): add a script to compute the bundle size
1 parent 282ae92 commit 1a95db2

File tree

3 files changed

+82
-64
lines changed

3 files changed

+82
-64
lines changed

packages/socket.io-client/CHANGELOG.md

+46-64
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,51 @@
11
# History
22

3-
## 2024
4-
5-
- [4.7.5](#475-2024-03-14) (Mar 2024)
6-
- [4.7.4](#474-2024-01-12) (Jan 2024)
7-
- [4.7.3](#473-2024-01-03) (Jan 2024)
8-
9-
## 2023
10-
11-
- [4.7.2](#472-2023-08-02) (Aug 2023)
12-
- [4.7.1](#471-2023-06-28) (Jun 2023)
13-
- [4.7.0](#470-2023-06-22) (Jun 2023)
14-
- [4.6.2](#462-2023-05-31) (May 2023)
15-
- [4.6.1](#461-2023-02-20) (Feb 2023)
16-
- [4.6.0](#460-2023-02-07) (Feb 2023)
17-
18-
## 2022
19-
20-
- [4.5.4](#454-2022-11-22) (Nov 2022)
21-
- [4.5.3](#453-2022-10-15) (Oct 2022)
22-
- [4.5.2](#452-2022-09-02) (Sep 2022)
23-
- [2.5.0](#250-2022-06-26) (Jun 2022) (from the [2.x](https://github.com/socketio/socket.io-client/tree/2.x) branch)
24-
- [4.5.1](#451-2022-05-17) (May 2022)
25-
- [4.5.0](#450-2022-04-23) (Apr 2022)
26-
- [4.4.1](#441-2022-01-06) (Jan 2022)
27-
28-
## 2021
29-
30-
- [4.4.0](#440-2021-11-18) (Nov 2021)
31-
- [4.3.2](#432-2021-10-16) (Oct 2021)
32-
- [4.3.1](#431-2021-10-15) (Oct 2021)
33-
- [4.3.0](#430-2021-10-14) (Oct 2021)
34-
- [4.2.0](#420-2021-08-30) (Aug 2021)
35-
- [4.1.3](#413-2021-07-10) (Jul 2021)
36-
- [4.1.2](#412-2021-05-17) (May 2021)
37-
- [4.1.1](#411-2021-05-11) (May 2021)
38-
- [4.1.0](#410-2021-05-11) (May 2021)
39-
- [4.0.2](#402-2021-05-06) (May 2021)
40-
- [4.0.1](#401-2021-03-31) (Mar 2021)
41-
- [3.1.3](#313-2021-03-12) (Mar 2021) (from the [3.1.x](https://github.com/socketio/socket.io-client/tree/3.1.x) branch)
42-
- [**4.0.0**](#400-2021-03-10) (Mar 2021)
43-
- [3.1.2](#312-2021-02-26) (Feb 2021)
44-
- [3.1.1](#311-2021-02-03) (Feb 2021)
45-
- [3.1.0](#310-2021-01-15) (Jan 2021)
46-
- [3.0.5](#305-2021-01-05) (Jan 2021)
47-
- [2.4.0](#240-2021-01-04) (Jan 2021) (from the [2.x](https://github.com/socketio/socket.io-client/tree/2.x) branch)
48-
49-
## 2020
50-
51-
- [3.0.4](#304-2020-12-07) (Dec 2020)
52-
- [3.0.3](#303-2020-11-19) (Nov 2020)
53-
- [3.0.2](#302-2020-11-17) (Nov 2020)
54-
- [3.0.1](#301-2020-11-09) (Nov 2020)
55-
- [**3.0.0**](#300-2020-11-05) (Nov 2020)
56-
- [2.3.1](#231-2020-09-30) (Sep 2020)
57-
58-
## 2019
59-
60-
- [2.3.0](#230-2019-09-20) (Sep 2019)
61-
62-
## 2018
63-
64-
- [2.2.0](#220-2018-11-29) (Nov 2018)
65-
- [2.1.1](#211-2018-05-17) (May 2018)
66-
- [2.1.0](#210-2018-03-29) (Mar 2018)
3+
| Version | Release date | Bundle size (UMD min+gzip) |
4+
|-------------------------------------------------------------------------------------------------------------|----------------|----------------------------|
5+
| [4.7.5](#475-2024-03-14) | March 2024 | `14.6 KB` |
6+
| [4.7.4](#474-2024-01-12) | January 2024 | `14.5 KB` |
7+
| [4.7.3](#473-2024-01-03) | January 2024 | `14.5 KB` |
8+
| [4.7.2](#472-2023-08-02) | August 2023 | `14.5 KB` |
9+
| [4.7.1](#471-2023-06-28) | June 2023 | `14.1 KB` |
10+
| [4.7.0](#470-2023-06-22) | June 2023 | `14.0 KB` |
11+
| [4.6.2](#462-2023-05-31) | May 2023 | `13.4 KB` |
12+
| [4.6.1](#461-2023-02-20) | February 2023 | `13.3 KB` |
13+
| [4.6.0](#460-2023-02-07) | February 2023 | `13.3 KB` |
14+
| [4.5.4](#454-2022-11-22) | November 2022 | `12.8 KB` |
15+
| [4.5.3](#453-2022-10-15) | October 2022 | `12.8 KB` |
16+
| [4.5.2](#452-2022-09-02) | September 2022 | `12.7 KB` |
17+
| [2.5.0](#250-2022-06-26) (from the [2.x](https://github.com/socketio/socket.io-client/tree/2.x) branch) | June 2022 | `18.8 KB` |
18+
| [4.5.1](#451-2022-05-17) | May 2022 | `12.7 KB` |
19+
| [4.5.0](#450-2022-04-23) | April 2022 | `12.7 KB` |
20+
| [4.4.1](#441-2022-01-06) | January 2022 | `12.3 KB` |
21+
| [4.4.0](#440-2021-11-18) | November 2021 | `12.3 KB` |
22+
| [4.3.2](#432-2021-10-16) | October 2021 | `12.1 KB` |
23+
| [4.3.1](#431-2021-10-15) | October 2021 | `12.1 KB` |
24+
| [4.3.0](#430-2021-10-14) | October 2021 | `12.1 KB` |
25+
| [4.2.0](#420-2021-08-30) | August 2021 | `15.2 KB` |
26+
| [4.1.3](#413-2021-07-10) | July 2021 | `14.9 KB` |
27+
| [4.1.2](#412-2021-05-17) | May 2021 | `14.9 KB` |
28+
| [4.1.1](#411-2021-05-11) | May 2021 | `14.9 KB` |
29+
| [4.1.0](#410-2021-05-11) | May 2021 | `14.9 KB` |
30+
| [4.0.2](#402-2021-05-06) | May 2021 | `14.9 KB` |
31+
| [4.0.1](#401-2021-03-31) | March 2021 | `14.9 KB` |
32+
| [3.1.3](#313-2021-03-12) (from the [3.1.x](https://github.com/socketio/socket.io-client/tree/3.1.x) branch) | March 2021 | `14.6 KB` |
33+
| [**4.0.0**](#400-2021-03-10) | March 2021 | `14.9 KB` |
34+
| [3.1.2](#312-2021-02-26) | February 2021 | `14.6 KB` |
35+
| [3.1.1](#311-2021-02-03) | February 2021 | `14.5 KB` |
36+
| [3.1.0](#310-2021-01-15) | January 2021 | `14.5 KB` |
37+
| [3.0.5](#305-2021-01-05) | January 2021 | `14.5 KB` |
38+
| [2.4.0](#240-2021-01-04) (from the [2.x](https://github.com/socketio/socket.io-client/tree/2.x) branch) | January 2021 | `18.8 KB` |
39+
| [3.0.4](#304-2020-12-07) | December 2020 | `14.6 KB` |
40+
| [3.0.3](#303-2020-11-19) | November 2020 | `14.5 KB` |
41+
| [3.0.2](#302-2020-11-17) | November 2020 | `14.5 KB` |
42+
| [3.0.1](#301-2020-11-09) | November 2020 | `14.7 KB` |
43+
| [**3.0.0**](#300-2020-11-05) | November 2020 | `14.6 KB` |
44+
| [2.3.1](#231-2020-09-30) | September 2020 | `18.8 KB` |
45+
| [2.3.0](#230-2019-09-20) | September 2019 | `19.6 KB` |
46+
| [2.2.0](#220-2018-11-29) | November 2018 | `18.6 KB` |
47+
| [2.1.1](#211-2018-05-17) | May 2018 | `18.7 KB` |
48+
| [2.1.0](#210-2018-03-29) | March 2018 | `18.7 KB` |
6749

6850

6951
# Release notes

packages/socket.io-client/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"test:browser": "ts-node test/browser-runner.ts",
5858
"test:types": "tsd",
5959
"build": "rollup -c support/rollup.config.umd.js && rollup -c support/rollup.config.esm.js && rollup -c support/rollup.config.umd.msgpack.js",
60+
"bundle-size": "node support/bundle-size.js",
6061
"format:check": "prettier --check \"*.js\" \"lib/**/*.ts\" \"test/**/*.ts\" \"support/**/*.js\"",
6162
"format:fix": "prettier --write \"*.js\" \"lib/**/*.ts\" \"test/**/*.ts\" \"support/**/*.js\"",
6263
"prepack": "npm run compile"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
const { resolve } = require("node:path");
2+
const { readFile } = require("node:fs/promises");
3+
const { gzipSync, brotliCompressSync } = require("node:zlib");
4+
5+
const bundles = [
6+
{
7+
name: "UMD bundle",
8+
path: "dist/socket.io.min.js",
9+
},
10+
{
11+
name: "ESM bundle",
12+
path: "dist/socket.io.esm.min.js",
13+
},
14+
];
15+
16+
function format(size) {
17+
return (size / 1024).toFixed(1);
18+
}
19+
20+
async function main() {
21+
for (const bundle of bundles) {
22+
const path = resolve(bundle.path);
23+
const content = await readFile(path);
24+
const gzip = gzipSync(content);
25+
const brotli = brotliCompressSync(content);
26+
27+
console.log(`${bundle.name}`);
28+
console.log(`min: ${format(content.length)} KB`);
29+
console.log(`min+gzip: ${format(gzip.length)} KB`);
30+
console.log(`min+br: ${format(brotli.length)} KB`);
31+
console.log();
32+
}
33+
}
34+
35+
main();

0 commit comments

Comments
 (0)