Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dev package dependencies #1270

Merged

Conversation

jlucaso1
Copy link
Contributor

@jlucaso1 jlucaso1 commented Feb 28, 2025

Changes:

  1. Removed libphonenumber-js as it is no longer used in the project. (It was previously used in an example, but has since been removed.)
  2. Upgraded TypeScript to the latest version. (This reduces disk space usage by approximately 20 MiB in node_modules and improves Language Server Protocol (LSP) performance in the IDE.) The src/Utils/noise-handler.ts file was updated due to stricter Buffer type checking in TypeScript 5.
  3. Updated TypeDoc to the latest version. (A dependency of TypeDoc, Shiki, consumes more disk space in older versions.) This upgrade required the removal of the Google Analytics ID from the configuration, but it can be restored using a JavaScript plugin. What are your thoughts on this, @purpshell?
  4. Moved audio-decode to peer dependencies and marked it as optional.
  5. Upgraded Jest and Jest-TS to latest version for typescript 5 support (no test regression).

These changes reduced the node_modules size in the development environment from 341.5 MiB to 300.1 MiB.

My next steps (in a separate pull request) will be to remove the Jest dependency and utilize the new Node.js native test runner. (I will migrate all existing tests.) I estimate this will further reduce the node_modules size by approximately 104.3 MiB.

In the future, I plan to optimize the library's bundling to decrease the size of the compiled code through tree shaking. Upgrading to TypeScript 5+ will facilitate this process.

@whiskeysockets-bot
Copy link
Contributor

Thanks for your contribution.

The next step is to wait for review and approval to merge it to main repository

The community can help reacting with a thumb up (:thumbsup:) for approval and rocket (:rocket:) for who has tested it.

To test this PR you can run the following command below:

# NPM
npm install @whiskeysockets/baileys@jlucaso1/Baileys#chore-upgrade-dev-packages
# YARN v2
yarn add @whiskeysockets/baileys@jlucaso1/Baileys#chore-upgrade-dev-packages

@AstroX11
Copy link
Contributor

Efficiency at it's peak

@purpshell
Copy link
Collaborator

TYVM! A lot of what you have brought here has been on my to-do list for the past while. As for testing, you can start work on it but I don't think it matches with my view on testing. The goal is to implement both end-to-end (and provided with test numbers as well) and mock testing to see if a PR or a branch change works successfully before releasing a version.

As for tree-shaking, that would be appreciated as well. Any contributions to this project are welcome.

As for audio-decode, I am not sure where to put it for now. I'm looking into more and more options and might either eliminate most of the peer deps or find another way to include them.

@jlucaso1
Copy link
Contributor Author

jlucaso1 commented Mar 1, 2025

@purpshell Yeah I agree with e2e tests, maybe we need to implement a pseudo WhatsApp compatible server for these tests to not use real numbers and fast run (a bit of difficulty and hard work, but I think this is the way).
As for audio-decode, we can modularize some code, possibly doing sub-packages with third party integrations, while maintain the core code intact.

@purpshell
Copy link
Collaborator

@purpshell Yeah I agree with e2e tests, maybe we need to implement a pseudo WhatsApp compatible server for these tests to not use real numbers and fast run (a bit of difficulty and hard work, but I think this is the way). As for audio-decode, we can modularize some code, possibly doing sub-packages with third party integrations, while maintain the core code intact.

For now, I give the OK on keeping it as an optional peer-dep. Will merge

@purpshell purpshell added this to the 6.7.14 milestone Mar 1, 2025
@purpshell purpshell merged commit 265c8d6 into WhiskeySockets:master Mar 1, 2025
2 checks passed
@jlucaso1
Copy link
Contributor Author

jlucaso1 commented Mar 1, 2025

@purpshell Apparently this commit got lost in limbo. I can't find any reference to it in the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants