Skip to content

Commit

Permalink
chore(sio-client): add a script to compute the bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Sep 21, 2024
1 parent 282ae92 commit 1a95db2
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 64 deletions.
110 changes: 46 additions & 64 deletions packages/socket.io-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,51 @@
# History

## 2024

- [4.7.5](#475-2024-03-14) (Mar 2024)
- [4.7.4](#474-2024-01-12) (Jan 2024)
- [4.7.3](#473-2024-01-03) (Jan 2024)

## 2023

- [4.7.2](#472-2023-08-02) (Aug 2023)
- [4.7.1](#471-2023-06-28) (Jun 2023)
- [4.7.0](#470-2023-06-22) (Jun 2023)
- [4.6.2](#462-2023-05-31) (May 2023)
- [4.6.1](#461-2023-02-20) (Feb 2023)
- [4.6.0](#460-2023-02-07) (Feb 2023)

## 2022

- [4.5.4](#454-2022-11-22) (Nov 2022)
- [4.5.3](#453-2022-10-15) (Oct 2022)
- [4.5.2](#452-2022-09-02) (Sep 2022)
- [2.5.0](#250-2022-06-26) (Jun 2022) (from the [2.x](https://github.com/socketio/socket.io-client/tree/2.x) branch)
- [4.5.1](#451-2022-05-17) (May 2022)
- [4.5.0](#450-2022-04-23) (Apr 2022)
- [4.4.1](#441-2022-01-06) (Jan 2022)

## 2021

- [4.4.0](#440-2021-11-18) (Nov 2021)
- [4.3.2](#432-2021-10-16) (Oct 2021)
- [4.3.1](#431-2021-10-15) (Oct 2021)
- [4.3.0](#430-2021-10-14) (Oct 2021)
- [4.2.0](#420-2021-08-30) (Aug 2021)
- [4.1.3](#413-2021-07-10) (Jul 2021)
- [4.1.2](#412-2021-05-17) (May 2021)
- [4.1.1](#411-2021-05-11) (May 2021)
- [4.1.0](#410-2021-05-11) (May 2021)
- [4.0.2](#402-2021-05-06) (May 2021)
- [4.0.1](#401-2021-03-31) (Mar 2021)
- [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)
- [**4.0.0**](#400-2021-03-10) (Mar 2021)
- [3.1.2](#312-2021-02-26) (Feb 2021)
- [3.1.1](#311-2021-02-03) (Feb 2021)
- [3.1.0](#310-2021-01-15) (Jan 2021)
- [3.0.5](#305-2021-01-05) (Jan 2021)
- [2.4.0](#240-2021-01-04) (Jan 2021) (from the [2.x](https://github.com/socketio/socket.io-client/tree/2.x) branch)

## 2020

- [3.0.4](#304-2020-12-07) (Dec 2020)
- [3.0.3](#303-2020-11-19) (Nov 2020)
- [3.0.2](#302-2020-11-17) (Nov 2020)
- [3.0.1](#301-2020-11-09) (Nov 2020)
- [**3.0.0**](#300-2020-11-05) (Nov 2020)
- [2.3.1](#231-2020-09-30) (Sep 2020)

## 2019

- [2.3.0](#230-2019-09-20) (Sep 2019)

## 2018

- [2.2.0](#220-2018-11-29) (Nov 2018)
- [2.1.1](#211-2018-05-17) (May 2018)
- [2.1.0](#210-2018-03-29) (Mar 2018)
| Version | Release date | Bundle size (UMD min+gzip) |
|-------------------------------------------------------------------------------------------------------------|----------------|----------------------------|
| [4.7.5](#475-2024-03-14) | March 2024 | `14.6 KB` |
| [4.7.4](#474-2024-01-12) | January 2024 | `14.5 KB` |
| [4.7.3](#473-2024-01-03) | January 2024 | `14.5 KB` |
| [4.7.2](#472-2023-08-02) | August 2023 | `14.5 KB` |
| [4.7.1](#471-2023-06-28) | June 2023 | `14.1 KB` |
| [4.7.0](#470-2023-06-22) | June 2023 | `14.0 KB` |
| [4.6.2](#462-2023-05-31) | May 2023 | `13.4 KB` |
| [4.6.1](#461-2023-02-20) | February 2023 | `13.3 KB` |
| [4.6.0](#460-2023-02-07) | February 2023 | `13.3 KB` |
| [4.5.4](#454-2022-11-22) | November 2022 | `12.8 KB` |
| [4.5.3](#453-2022-10-15) | October 2022 | `12.8 KB` |
| [4.5.2](#452-2022-09-02) | September 2022 | `12.7 KB` |
| [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` |
| [4.5.1](#451-2022-05-17) | May 2022 | `12.7 KB` |
| [4.5.0](#450-2022-04-23) | April 2022 | `12.7 KB` |
| [4.4.1](#441-2022-01-06) | January 2022 | `12.3 KB` |
| [4.4.0](#440-2021-11-18) | November 2021 | `12.3 KB` |
| [4.3.2](#432-2021-10-16) | October 2021 | `12.1 KB` |
| [4.3.1](#431-2021-10-15) | October 2021 | `12.1 KB` |
| [4.3.0](#430-2021-10-14) | October 2021 | `12.1 KB` |
| [4.2.0](#420-2021-08-30) | August 2021 | `15.2 KB` |
| [4.1.3](#413-2021-07-10) | July 2021 | `14.9 KB` |
| [4.1.2](#412-2021-05-17) | May 2021 | `14.9 KB` |
| [4.1.1](#411-2021-05-11) | May 2021 | `14.9 KB` |
| [4.1.0](#410-2021-05-11) | May 2021 | `14.9 KB` |
| [4.0.2](#402-2021-05-06) | May 2021 | `14.9 KB` |
| [4.0.1](#401-2021-03-31) | March 2021 | `14.9 KB` |
| [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` |
| [**4.0.0**](#400-2021-03-10) | March 2021 | `14.9 KB` |
| [3.1.2](#312-2021-02-26) | February 2021 | `14.6 KB` |
| [3.1.1](#311-2021-02-03) | February 2021 | `14.5 KB` |
| [3.1.0](#310-2021-01-15) | January 2021 | `14.5 KB` |
| [3.0.5](#305-2021-01-05) | January 2021 | `14.5 KB` |
| [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` |
| [3.0.4](#304-2020-12-07) | December 2020 | `14.6 KB` |
| [3.0.3](#303-2020-11-19) | November 2020 | `14.5 KB` |
| [3.0.2](#302-2020-11-17) | November 2020 | `14.5 KB` |
| [3.0.1](#301-2020-11-09) | November 2020 | `14.7 KB` |
| [**3.0.0**](#300-2020-11-05) | November 2020 | `14.6 KB` |
| [2.3.1](#231-2020-09-30) | September 2020 | `18.8 KB` |
| [2.3.0](#230-2019-09-20) | September 2019 | `19.6 KB` |
| [2.2.0](#220-2018-11-29) | November 2018 | `18.6 KB` |
| [2.1.1](#211-2018-05-17) | May 2018 | `18.7 KB` |
| [2.1.0](#210-2018-03-29) | March 2018 | `18.7 KB` |


# Release notes
Expand Down
1 change: 1 addition & 0 deletions packages/socket.io-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"test:browser": "ts-node test/browser-runner.ts",
"test:types": "tsd",
"build": "rollup -c support/rollup.config.umd.js && rollup -c support/rollup.config.esm.js && rollup -c support/rollup.config.umd.msgpack.js",
"bundle-size": "node support/bundle-size.js",
"format:check": "prettier --check \"*.js\" \"lib/**/*.ts\" \"test/**/*.ts\" \"support/**/*.js\"",
"format:fix": "prettier --write \"*.js\" \"lib/**/*.ts\" \"test/**/*.ts\" \"support/**/*.js\"",
"prepack": "npm run compile"
Expand Down
35 changes: 35 additions & 0 deletions packages/socket.io-client/support/bundle-size.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const { resolve } = require("node:path");
const { readFile } = require("node:fs/promises");
const { gzipSync, brotliCompressSync } = require("node:zlib");

const bundles = [
{
name: "UMD bundle",
path: "dist/socket.io.min.js",
},
{
name: "ESM bundle",
path: "dist/socket.io.esm.min.js",
},
];

function format(size) {
return (size / 1024).toFixed(1);
}

async function main() {
for (const bundle of bundles) {
const path = resolve(bundle.path);
const content = await readFile(path);
const gzip = gzipSync(content);
const brotli = brotliCompressSync(content);

console.log(`${bundle.name}`);
console.log(`min: ${format(content.length)} KB`);
console.log(`min+gzip: ${format(gzip.length)} KB`);
console.log(`min+br: ${format(brotli.length)} KB`);
console.log();
}
}

main();

0 comments on commit 1a95db2

Please sign in to comment.