All the TypeScript, Better Docs, More Flexibility, and Fewer Vulnerabilities #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey there! This PR tackles the improvements I suggested in issue #6. Here's a breakdown of what's been done:
Switched to TypeScript: The entire codebase is now in TypeScript, offering better type checks and a smoother experience for developers. I noticed the library uses TravisCI, which I'm not too familiar with, so I haven't included anything for compiling TypeScript. However, I'm more than willing to help set this up if needed.
Added JSDoc Comments: No more switching between code and documentation. Now, all the documentation is right in the editor.
No More CommonJS: The codebase has been updated to use modern ECMAScript syntax, making it more streamlined and up-to-date.
New
src
Directory: I've reorganized the source files into asrc
folder for better structure and clarity.New HTTP Client Interface: I've introduced a
Client
interface for HTTP operations. Any class implementing this interface can be used as the HTTP client. Two implementations are provided: one based on Node'sHTTPS
module and another on thefetch
API. These can be imported fromtelegra.ph/clients
. TheHTTPS
client is the default if no other client is specified inoptions.client
. This change also means droppingisomorphic-fetch
, addressing its security vulnerabilities.Included
LICENSE
andreadme.md
in Package: It's standard practice to include these files in the package distribution, ensuring that users have access to full documentation and licensing information right off the bat.Updated README: The README now showcases ECMAScript syntax and includes an example for injecting an HTTP client.
I've thoroughly tested these changes, and everything seems to be in top shape. This update should significantly enhance the library's robustness, security, and usability. Eager to hear your thoughts! Resolves #6.