octokit / octokit.js

The all-batteries-included GitHub SDK for Browsers, Node.js, and Deno.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG]: No Significant Difference with @octokit Submodules

lucioerlan opened this issue · comments

What happened?

Good afternoon, friends. In my project, I'm using a Lambda function to interact with GitHub via Octokit.

We place great importance on best practices regarding Lambda functions, particularly concerning the size of the ZIP package generated when packaging the Lambda function.

Running the command npx sls package locally, I noticed there doesn't seem to be a difference between using the full Octokit module and installing its submodules separately. It appears the @octokit folder installs various components that my project does not use.

This behavior seems somewhat strange to me. Is there actually an option to use submodules in the Octokit library?

Versions

Node v18 and Node v20

Relevant log output

~ ZIP size without submodules: 18.1 MB
~ ZIP size with submodules: 18.1 MB

Code of Conduct

  • I agree to follow this project's Code of Conduct

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

The purpose of this package is to bundle all best practices for Octokit modules.

If you want to lower your bundle size, I would use the packages separately, and only include the ones you actually use.

If you have any specific improvement points, feel free to do a follow up PR

@wolfy1339 , thank you for the feedback.

How do you install individual submodules nowadays? I tried to install just the auth-app and rest submodules, but everything else came along too.

I used:

npm i @octokit/auth-app
npm i @octokit/rest

and nothing has changed

The @octokit/rest package doesn't have any actual code, it is simply a wrapper of different plugins to make a best practices package for interacting with the GitHub API.

It is normal that there are many packages, as things are split into different plugins to enable extensibility.

tks @wolfy1339, I'll go ahead and close this issue. 🚀

If bundle size is a concern, but you still want the convenience of the types for all REST API endpoints, I'd suggest to use @octokit/request: https://bundlephobia.com/package/@octokit/request

If that is not enough beause you need plugins, advanced authentication, or graphql, I'd use @octokit/core: https://bundlephobia.com/package/@octokit/core@6.0.1

Both are a lot smaller than octokit: https://bundlephobia.com/package/octokit@3.1.2