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

perf: split up routers to separate lambdas #8041

Merged
merged 37 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
25fafc0
split up routers to separate lambdas
juliusmarminge Mar 31, 2023
6b719a2
fix responsemeta
juliusmarminge Mar 31, 2023
4ec8c9a
move
juliusmarminge Mar 31, 2023
70a34f7
add typeguards to make sure all endpoints are covered in the approuter
juliusmarminge Mar 31, 2023
0a993e5
prettier
juliusmarminge Mar 31, 2023
ed78cb2
move slotsrouter
juliusmarminge Mar 31, 2023
0dddf3c
split ssg/ssr
juliusmarminge Mar 31, 2023
6a4df55
make sure correct headers are sent on viewer.public
juliusmarminge Mar 31, 2023
13ed9f4
make sure correct headers are sent + use ctx.prisma
juliusmarminge Mar 31, 2023
b02b169
Merge branch 'main' into split-router
roae Apr 1, 2023
ae25067
Merge branch 'main' into split-router
emrysal Apr 4, 2023
fee7d26
Merged with main
emrysal Apr 5, 2023
176f5c8
Merge branch 'main' into split-router
emrysal Apr 5, 2023
775973c
Fixed new prefetch broken by merge
emrysal Apr 5, 2023
042729c
Merge branch 'main' into split-router
PeerRich Apr 7, 2023
c9b6a6d
Merge branch 'main' into split-router
keithwillcode Apr 11, 2023
201f978
Merge branch 'main' into pr/8041
zomars Apr 12, 2023
af5c7c5
Merge branch 'main' into pr/8041
zomars Apr 12, 2023
b12329d
Merge remote-tracking branch 'calcom/main' into split-router
keithwillcode May 1, 2023
3177ca4
Fixes after merge
keithwillcode May 1, 2023
7e2c348
Created separate API route for all tRPC routers
keithwillcode Apr 26, 2023
5188527
More fixes from refactor
keithwillcode May 1, 2023
970f6f1
Fixed tRPC query for slots
keithwillcode May 1, 2023
21db6cc
Put back extra line
keithwillcode May 1, 2023
2232d26
Fixed type checks
keithwillcode May 1, 2023
112f5fb
Removed Endpoint type check since it loads from client
keithwillcode May 1, 2023
d298846
Reverted change in getSchedule test
keithwillcode May 1, 2023
8befee5
Merge branch 'main' into split-router
keithwillcode May 2, 2023
eb3858e
Merge branch 'main' into split-router
keithwillcode May 2, 2023
656ce94
Merge branch 'main' into split-router
keithwillcode May 2, 2023
2d39cd9
Merge branch 'main' into split-router
keithwillcode May 2, 2023
d7fa176
Merge branch 'main' into split-router
keithwillcode May 2, 2023
e7b6109
Fix trpc routes in expectations
hariombalhara May 3, 2023
f8fcc12
Fix one more route test
hariombalhara May 3, 2023
4d1e31d
Merge branch 'main' into split-router
keithwillcode May 3, 2023
0fbba6f
Merge branch 'main' into split-router
keithwillcode May 3, 2023
86a3a7e
Merge branch 'main' into split-router
keithwillcode May 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'calcom/main' into split-router
  • Loading branch information
keithwillcode committed May 1, 2023
commit b12329d339b97d5b7de27f9107a5fc5dbc52ca4c
42 changes: 0 additions & 42 deletions .devcontainer/devcontainer.json

This file was deleted.

8 changes: 5 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ CALENDSO_ENCRYPTION_KEY=
# Intercom Config
NEXT_PUBLIC_INTERCOM_APP_ID=

# Secret to enable Intercom Identity Verification
INTERCOM_SECRET=

# Zendesk Config
NEXT_PUBLIC_ZENDESK_KEY=

Expand Down Expand Up @@ -160,9 +163,6 @@ CLOSECOM_API_KEY=
# Sendgrid internal sync service
SENDGRID_SYNC_API_KEY=

# Sentry
NEXT_PUBLIC_SENTRY_DSN=
SENTRY_IGNORE_API_RESOLUTION_ERROR=

# Change your Brand
NEXT_PUBLIC_APP_NAME="Cal.com"
Expand All @@ -177,3 +177,5 @@ CSP_POLICY=

# Vercel Edge Config
EDGE_CONFIG=

NEXT_PUBLIC_MINUTES_TO_BOOK=5 # Minutes
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @calcom/reviewers
# ⬇️ Removed so we can manually trigger checks
# * @calcom/reviewers

.github/ @calcom/core
.husky/ @calcom/core
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/cron-stale-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Cron - mark stale for inactive issues

permissions:
issues: write
pull-requests: write

on:
# "Scheduled workflows run on the latest commit on the default or base branch."
Expand All @@ -20,4 +21,4 @@ jobs:
days-before-pr-stale: 14
days-before-pr-close: 7
stale-pr-message: "This PR is being marked as stale due to inactivity."
close-pr-message: "This PR is being closed due to inactivity. Please reopen if work is intended to be continued.
close-pr-message: "This PR is being closed due to inactivity. Please reopen if work is intended to be continued."
4 changes: 2 additions & 2 deletions .github/workflows/nextjs-bundle-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Analyze bundle
run: |
cd apps/web
npx -p nextjs-bundle-analysis report
npx -p nextjs-bundle-analysis@0.5.0 report

- name: Upload bundle
uses: actions/upload-artifact@v2
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
id: fc
with:
issue-number: ${{ github.event.number }}
body-includes: "<!-- __NEXTJS_BUNDLE -->"
body-includes: "<!-- __NEXTJS_BUNDLE_@calcom/web -->"

- name: Create Comment
uses: peter-evans/create-or-update-comment@v1.4.4
Expand Down
20 changes: 5 additions & 15 deletions .github/workflows/scripts/apply-issue-labels-to-pr.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const https = require("https");

async function applyLabelFromLinkedIssueToPR(pr, token) {

// Get the labels from issues linked to the PR
const query = `
query GetLinkedIssues($owner: String!, $repo: String!, $prNumber: Int!) {
Expand Down Expand Up @@ -38,7 +37,7 @@ async function applyLabelFromLinkedIssueToPR(pr, token) {
headers: {
"Content-Type": "application/json",
"Content-Length": graphqlData.length,
"Authorization": "Bearer " + token,
Authorization: "Bearer " + token,
"User-Agent": "Node.js",
},
};
Expand All @@ -52,14 +51,7 @@ async function applyLabelFromLinkedIssueToPR(pr, token) {
responseBody += chunk;
});
response.on("end", () => {
resolve(
JSON.parse(responseBody)
?.data
?.repository
?.pullRequest
?.closingIssuesReferences
?.nodes
);
resolve(JSON.parse(responseBody)?.data?.repository?.pullRequest?.closingIssuesReferences?.nodes);
});
});

Expand Down Expand Up @@ -96,7 +88,7 @@ async function applyLabelFromLinkedIssueToPR(pr, token) {
headers: {
"Content-Type": "application/json",
"Content-Length": labelsData.length,
"Authorization": "Bearer " + token,
Authorization: "Bearer " + token,
"User-Agent": "Node.js",
},
};
Expand Down Expand Up @@ -126,11 +118,9 @@ async function applyLabelFromLinkedIssueToPR(pr, token) {
console.log(`Error labelling PR: ${labelResult.message}`);
continue;
}

console.log(
`Applied labels: ${labels.join(", ")} to PR #${
pr.number
} from linked issue #${issue.number}`
`Applied labels: ${labels.join(", ")} to PR #${pr.number} from linked issue #${issue.number}`
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
},
"typescript.preferences.importModuleSpecifier": "non-relative",
"spellright.language": ["en"],
"spellright.documentTypes": ["markdown", "typescript"],
"spellright.documentTypes": ["markdown", "typescript", "typescriptreact"],
"tailwindCSS.experimental.classRegex": [["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"]]
}
2 changes: 2 additions & 0 deletions apps/storybook/.storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = {
stories: [
"../intro.stories.mdx",
"../../../packages/ui/components/**/*.stories.mdx",
"../../../packages/atoms/**/*.stories.mdx",
"../../../packages/features/**/*.stories.mdx",
"../../../packages/ui/components/**/*.stories.@(js|jsx|ts|tsx)",
],
Expand Down Expand Up @@ -70,4 +71,5 @@ module.exports = {

return config;
},
typescript: { reactDocgen: "react-docgen" },
};
2 changes: 0 additions & 2 deletions apps/web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,3 @@ public/embed

# Copied app-store images
public/app-store
# Sentry
.sentryclirc
53 changes: 0 additions & 53 deletions apps/web/calendso.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,59 +103,6 @@ paths:
summary: Reset a user's password
tags:
- Authentication
"/api/availability/{user}?dateFrom={dateFrom}&dateTo={dateTo}":
get:
description: "Gets the busy times for a particular user, by username."
summary: Gets the busy times for a user
tags:
- Availability
responses:
"200":
description: OK
content:
application/json:
schema:
type: array
description: ""
minItems: 1
uniqueItems: true
x-examples:
example-1:
- start: "Fri, 03 Sep 2021 17:00:00 GMT"
end: "Fri, 03 Sep 2021 17:40:00 GMT"
items:
type: object
properties:
start:
type: string
minLength: 1
end:
type: string
minLength: 1
required:
- start
- end
"500":
description: Internal Server Error
parameters:
- schema:
type: string
name: user
in: path
required: true
description: The username of who you want to check availability for
- schema:
type: string
name: dateFrom
in: path
required: true
description: The timestamp of which time you want to get busy times from
- schema:
type: string
name: dateTo
in: path
required: true
description: The timestamp of which time you want to get busy times until
/api/availability/calendar:
get:
description: Gets the user's selected calendars.
Expand Down
4 changes: 2 additions & 2 deletions apps/web/components/AddToHomescreen.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState } from "react";

import { useLocale } from "@calcom/lib/hooks/useLocale";
import { FiX } from "@calcom/ui/components/icon";
import { X } from "@calcom/ui/components/icon";

export default function AddToHomescreen() {
const { t } = useLocale();
Expand Down Expand Up @@ -40,7 +40,7 @@ export default function AddToHomescreen() {
type="button"
className="-mr-1 flex rounded-md p-2 hover:bg-gray-800 focus:outline-none focus:ring-2 focus:ring-white">
<span className="sr-only">{t("dismiss")}</span>
<FiX className="text-inverted h-6 w-6" aria-hidden="true" />
<X className="text-inverted h-6 w-6" aria-hidden="true" />
</button>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions apps/web/components/AppListCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { z } from "zod";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { useTypedQuery } from "@calcom/lib/hooks/useTypedQuery";
import { Badge, ListItemText } from "@calcom/ui";
import { FiAlertCircle } from "@calcom/ui/components/icon";
import { AlertCircle } from "@calcom/ui/components/icon";

type ShouldHighlight = { slug: string; shouldHighlight: true } | { shouldHighlight?: never; slug?: never };

Expand Down Expand Up @@ -77,7 +77,7 @@ export default function AppListCard(props: AppListCardProps) {
<ListItemText component="p">{description}</ListItemText>
{invalidCredential && (
<div className="flex gap-x-2 pt-2">
<FiAlertCircle className="h-8 w-8 text-red-500 sm:h-4 sm:w-4" />
<AlertCircle className="h-8 w-8 text-red-500 sm:h-4 sm:w-4" />
<ListItemText component="p" className="whitespace-pre-wrap text-red-500">
{t("invalid_credential")}
</ListItemText>
Expand Down
12 changes: 6 additions & 6 deletions apps/web/components/Embed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
TextField,
ColorPicker,
} from "@calcom/ui";
import { FiCode, FiTrello, FiSun, FiArrowLeft } from "@calcom/ui/components/icon";
import { Code, Trello, Sun, ArrowLeft } from "@calcom/ui/components/icon";

import Select from "@components/ui/form/Select";

Expand Down Expand Up @@ -493,7 +493,7 @@ const tabs = [
{
name: "HTML",
href: "embedTabName=embed-code",
icon: FiCode,
icon: Code,
type: "code",
Component: forwardRef<
HTMLTextAreaElement | HTMLIFrameElement | null,
Expand Down Expand Up @@ -546,7 +546,7 @@ ${getEmbedTypeSpecificString({ embedFramework: "HTML", embedType, calLink, previ
{
name: "React",
href: "embedTabName=embed-react",
icon: FiCode,
icon: Code,
type: "code",
Component: forwardRef<
HTMLTextAreaElement | HTMLIFrameElement | null,
Expand Down Expand Up @@ -586,7 +586,7 @@ ${getEmbedTypeSpecificString({ embedFramework: "react", embedType, calLink, prev
{
name: "Preview",
href: "embedTabName=embed-preview",
icon: FiTrello,
icon: Trello,
type: "iframe",
Component: forwardRef<
HTMLIFrameElement | HTMLTextAreaElement | null,
Expand Down Expand Up @@ -622,7 +622,7 @@ Cal("init", {origin:"${WEBAPP_URL}"});
const ThemeSelectControl = ({ children, ...props }: ControlProps<{ value: Theme; label: string }, false>) => {
return (
<components.Control {...props}>
<FiSun className="text-subtle ml-2 h-4 w-4" />
<Sun className="text-subtle ml-2 h-4 w-4" />
{children}
</components.Control>
);
Expand Down Expand Up @@ -830,7 +830,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
onClick={() => {
removeQueryParams(router, ["embedType", "embedTabName"]);
}}>
<FiArrowLeft className="mr-4 w-4" />
<ArrowLeft className="mr-4 w-4" />
</button>
{embed.title}
</h3>
Expand Down
16 changes: 9 additions & 7 deletions apps/web/components/I18nLanguageHandler.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isEmpty } from "lodash";
import { useTranslation } from "next-i18next";
import { useEffect } from "react";

import { getDirFromLang } from "@calcom/lib/i18n";
import { trpc } from "@calcom/trpc/react";

export function useViewerI18n() {
Expand All @@ -22,16 +22,18 @@ export function useViewerI18n() {
*/
const I18nLanguageHandler = (): null => {
const { i18n } = useTranslation("common");
const locale = useViewerI18n().data?.locale || "en";
const locale = useViewerI18n().data?.locale || i18n.language;

useEffect(() => {
if (locale && i18n.language && i18n.language !== locale) {
if (typeof i18n.changeLanguage === "function") i18n.changeLanguage(locale);
// bail early when i18n = {}
if (isEmpty(i18n)) return;
// if locale is ready and the i18n.language does != locale - changeLanguage
if (locale && i18n.language !== locale) {
i18n.changeLanguage(locale);
}

const dir = getDirFromLang(locale);
// set dir="rtl|ltr"
document.dir = i18n.dir();
document.documentElement.setAttribute("lang", locale);
document.documentElement.setAttribute("dir", dir);
}, [locale, i18n]);

return null;
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.