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

feat: Reduce bundle size via better imports + install gcal + gvideo by default for google signups #17810

Merged
merged 13 commits into from
Dec 6, 2024

Conversation

hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Nov 23, 2024

What does this PR do?

  • New testing screencast
Screen.Recording.2024-11-23.at.3.08.25.AM.mov

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A - I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Go through a sign up process using Google sign-in. DM me if you need help with this.

@graphite-app graphite-app bot requested a review from a team November 23, 2024 07:36
@dosubot dosubot bot added app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar ✨ feature New feature or request ❗️ .env changes contains changes to env variables labels Nov 23, 2024
@keithwillcode keithwillcode added consumer core area: core, team members only labels Nov 23, 2024
Comment on lines 3 to 4
import { OAuth2Client } from "google-auth-library";
import { calendar_v3 } from "googleapis";
Copy link
Contributor Author

@hbjORbj hbjORbj Nov 23, 2024

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

Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor Author

@hbjORbj hbjORbj Nov 25, 2024

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!

Copy link
Contributor Author

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

Copy link

graphite-app bot commented Nov 23, 2024

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.

Copy link

vercel bot commented Nov 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Nov 26, 2024 5:11pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Nov 26, 2024 5:11pm

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";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Contributor

github-actions bot commented Nov 23, 2024

E2E results are ready!

Copy link
Contributor

@emrysal emrysal left a 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?

@github-actions github-actions bot marked this pull request as draft November 25, 2024 17:05
auto-merge was automatically disabled November 25, 2024 17:05

Pull request was converted to draft

@hbjORbj hbjORbj changed the title feat: [with OOM fix] install gcal + gvideo by default for google signups ( feat: Reduce bundle size via better imports + install gcal + gvideo by default for google signups Nov 26, 2024
Copy link

socket-security bot commented Nov 26, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher

View full report↗︎

Copy link

socket-security bot commented Nov 26, 2024

👍 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.

View full report↗︎

@hbjORbj
Copy link
Contributor Author

hbjORbj commented Nov 26, 2024

@emrysal Thanks alex, addressed your feedback! 🙏

@hbjORbj hbjORbj marked this pull request as ready for review November 26, 2024 17:37
@dosubot dosubot bot added the performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive label Nov 26, 2024
@graphite-app graphite-app bot requested a review from a team November 26, 2024 17:37
Comment on lines -30 to -33
import { Prisma } from "@prisma/client";
import { Request } from "express";
import { google } from "googleapis";
import { z } from "zod";
Copy link
Contributor Author

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",
Copy link
Contributor Author

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"
Copy link
Contributor Author

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"
Copy link
Contributor Author

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

Copy link
Contributor

@emrysal emrysal left a 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.

@emrysal emrysal merged commit b8219c2 into main Dec 6, 2024
80 of 88 checks passed
@emrysal emrysal deleted the feat/gcal-gmeets-default branch December 6, 2024 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app-store area: app store, apps, calendar integrations, google calendar, outlook, lark, apple calendar consumer core area: core, team members only ❗️ .env changes contains changes to env variables ✨ feature New feature or request performance area: performance, page load, slow, slow endpoints, loading screen, unresponsive ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants