-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
feat: Reduce bundle size via better imports + install gcal + gvideo by default for google signups #17810
Conversation
import { OAuth2Client } from "google-auth-library"; | ||
import { calendar_v3 } from "googleapis"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Size of full package is ~20MB while it's ~2-3MB for just calendar and OAuth
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been working on a similar fix! there's the @googleapis/calendar package (and @googleapis/admin) to also slim down the node_modules. Can confirm this works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially you need to use googleapis-common for the OAuth2Client
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially you need to use googleapis-common for the OAuth2Client
Ah yeah maybe if we remove googleapis
. Thanks for the heads up!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been working on a similar fix! there's the @googleapis/calendar package (and @googleapis/admin) to also slim down the node_modules. Can confirm this works
Will handle that in #17811
Graphite Automations"Add consumer team as reviewer" took an action on this PR • (11/23/24)1 reviewer was added to this PR based on Keith Williams's automation. "Add foundation team as reviewer" took an action on this PR • (11/26/24)1 reviewer was added to this PR based on Keith Williams's automation. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Skipped Deployments
|
import type { Credentials } from "google-auth-library"; | ||
import type { OAuth2Client } from "google-auth-library"; | ||
import type { calendar_v3 } from "googleapis"; | ||
import { oauth2_v2 } from "googleapis"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
E2E results are ready! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally not too happy with this.
- GoogleService is a good idea, but it doesn't belong in @calcom/lib/server and there's a similar file that already exists in the app-store/googlecalendar/lib folder.
- It makes more sense to make this an instantiatable class (like googlecalendar/lib) - as it involves credential initialisation.
Concluding I'm not sure why this logic is moving to calcom/lib?
Pull request was converted to draft
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
|
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
@emrysal Thanks alex, addressed your feedback! 🙏 |
import { Prisma } from "@prisma/client"; | ||
import { Request } from "express"; | ||
import { google } from "googleapis"; | ||
import { z } from "zod"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These imports weren't being used
@@ -180,6 +182,7 @@ | |||
"deasync": "^0.1.30", | |||
"detect-port": "^1.3.0", | |||
"env-cmd": "^10.1.0", | |||
"google-auth-library": "^9.15.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this as a dev dependency because we need to import type Credentials
from the lib.
@@ -6,8 +6,7 @@ | |||
"main": "./index.ts", | |||
"description": "Google Meet is Google's web-based video conferencing platform, designed to compete with major conferencing platforms.", | |||
"dependencies": { | |||
"@calcom/prisma": "*", | |||
"googleapis": "^84.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't use anything from googleapis in /googlevideo
@@ -7,7 +7,7 @@ | |||
"description": "Google Calendar is a time management and scheduling service developed by Google. Allows users to create and edit events, with options available for type and time. Available to anyone that has a Gmail account on both mobile and web versions.", | |||
"dependencies": { | |||
"@calcom/prisma": "*", | |||
"googleapis": "^84.0.0" | |||
"@googleapis/calendar": "^9.7.9" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app-store/googlecalendar only uses calendar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LFG! Nice work man 👏 - works locally; very happy with the new imports.
What does this PR do?
Screen.Recording.2024-11-23.at.3.08.25.AM.mov
Mandatory Tasks (DO NOT REMOVE)
How should this be tested?