perf: remove atoms monorepo imports (#19688)

* perf: Remove atoms/monorepo barrel exports

* Removed more exports

* completely removed the monorepo file

* fixed types

* fixing tests

* fixing package errors

* Pushing latest

* Fixed atoms build

* hack to fix type

* Fixed web build
This commit is contained in:
Keith Williams
2025-03-05 09:49:13 -03:00
committed by GitHub
parent 6f62c6ad5d
commit 381f2781a3
25 changed files with 43 additions and 54 deletions
@@ -1,7 +1,7 @@
import { _generateMetadata } from "app/_utils";
import { getTranslate } from "app/_utils";
import { ConferencingAppsViewWebWrapper } from "@calcom/atoms/monorepo";
import { ConferencingAppsViewWebWrapper } from "@calcom/atoms/connect/conferencing-apps/ConferencingAppsViewWebWrapper";
export const generateMetadata = async () =>
await _generateMetadata(
@@ -3,10 +3,8 @@
import { useEffect, Suspense } from "react";
import { InstallAppButton } from "@calcom/app-store/components";
import {
SelectedCalendarsSettingsWebWrapper,
DestinationCalendarSettingsWebWrapper,
} from "@calcom/atoms/monorepo";
import { DestinationCalendarSettingsWebWrapper } from "@calcom/atoms/destination-calendar/wrappers/DestinationCalendarSettingsWebWrapper";
import { SelectedCalendarsSettingsWebWrapper } from "@calcom/atoms/selected-calendars/wrappers/SelectedCalendarsSettingsWebWrapper";
import AppListCard from "@calcom/features/apps/components/AppListCard";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { trpc } from "@calcom/trpc/react";
@@ -3,7 +3,7 @@
import { useRouter } from "next/navigation";
import { useState } from "react";
import { AvailabilitySettings } from "@calcom/atoms/monorepo";
import { AvailabilitySettings } from "@calcom/atoms/availability/AvailabilitySettings";
import type { BulkUpdatParams } from "@calcom/features/eventtypes/components/BulkEditDefaultForEventsModal";
import { withErrorFromUnknown } from "@calcom/lib/getClientErrorFromUnknown";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
+1 -1
View File
@@ -1,6 +1,6 @@
"use client";
import { Booker } from "@calcom/atoms/monorepo";
import { BookerWebWrapper as Booker } from "@calcom/atoms/booker";
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
import { type PageProps } from "@lib/d/[link]/[slug]/getServerSideProps";
@@ -1,6 +1,6 @@
"use client";
import { EventType } from "@calcom/atoms/monorepo";
import { EventTypeWebWrapper as EventType } from "@calcom/atoms/event-types/wrappers/EventTypeWebWrapper";
import type { PageProps } from "@lib/event-types/[type]/getServerSideProps";
@@ -2,7 +2,7 @@
import type { EmbedProps } from "app/WithEmbedSSR";
import { Booker } from "@calcom/atoms/monorepo";
import { BookerWebWrapper as Booker } from "@calcom/atoms/booker";
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
import type { getServerSideProps } from "@lib/org/[orgSlug]/instant-meeting/team/[slug]/[type]/getServerSideProps";
+1 -1
View File
@@ -3,7 +3,7 @@
import type { EmbedProps } from "app/WithEmbedSSR";
import { useSearchParams } from "next/navigation";
import { Booker } from "@calcom/atoms/monorepo";
import { BookerWebWrapper as Booker } from "@calcom/atoms/booker";
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
import type { getServerSideProps } from "@lib/team/[slug]/[type]/getServerSideProps";
@@ -3,7 +3,7 @@
import type { EmbedProps } from "app/WithEmbedSSR";
import { useSearchParams } from "next/navigation";
import { Booker } from "@calcom/atoms/monorepo";
import { BookerWebWrapper as Booker } from "@calcom/atoms/booker";
import { getBookerWrapperClasses } from "@calcom/features/bookings/Booker/utils/getBookerWrapperClasses";
import type { inferSSRProps } from "@lib/types/inferSSRProps";
+1 -1
View File
@@ -21,7 +21,7 @@ vi.mock("@calcom/lib/hooks/useLocale", () => ({
},
}));
vi.mock("@calcom/atoms/monorepo", () => ({
vi.mock("@calcom/atoms/hooks/useIsPlatform", () => ({
useIsPlatform: () => {
return false;
},
+1 -1
View File
@@ -6,7 +6,7 @@ import { Toaster } from "sonner";
import { shallow } from "zustand/shallow";
import BookingPageTagManager from "@calcom/app-store/BookingPageTagManager";
import { useIsPlatformBookerEmbed } from "@calcom/atoms/monorepo";
import { useIsPlatformBookerEmbed } from "@calcom/atoms/hooks/useIsPlatformBookerEmbed";
import dayjs from "@calcom/dayjs";
import useSkipConfirmStep from "@calcom/features/bookings/Booker/components/hooks/useSkipConfirmStep";
import { getQueryParam } from "@calcom/features/bookings/Booker/utils/query-param";
@@ -4,7 +4,7 @@ import Link from "next/link";
import { useMemo, useState } from "react";
import type { FieldError } from "react-hook-form";
import { useIsPlatformBookerEmbed } from "@calcom/atoms/monorepo";
import { useIsPlatformBookerEmbed } from "@calcom/atoms/hooks/useIsPlatformBookerEmbed";
import type { BookerEvent } from "@calcom/features/bookings/types";
import { WEBSITE_PRIVACY_POLICY_URL, WEBSITE_TERMS_URL } from "@calcom/lib/constants";
import { getPaymentAppData } from "@calcom/lib/getPaymentAppData";
@@ -1,8 +1,8 @@
import type { ReactNode } from "react";
import React from "react";
import { useEventTypeById } from "@calcom/atoms/hooks/event-types/private/useEventTypeById";
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
import { useEventTypeById } from "@calcom/atoms/monorepo";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { Badge, Dialog, DialogContent } from "@calcom/ui";
@@ -3,7 +3,7 @@ import dynamic from "next/dynamic";
import { useEffect, useMemo } from "react";
import { shallow } from "zustand/shallow";
import { Timezone as PlatformTimezoneSelect } from "@calcom/atoms/monorepo";
import { Timezone as PlatformTimezoneSelect } from "@calcom/atoms/timezone";
import { useEmbedUiConfig, useIsEmbed } from "@calcom/embed-core/embed-iframe";
import { EventDetails, EventMembers, EventMetaSkeleton, EventTitle } from "@calcom/features/bookings";
import { SeatsAvailabilityText } from "@calcom/features/bookings/components/SeatsAvailabilityText";
@@ -3,7 +3,7 @@ import { useRouter } from "next/navigation";
import { useRef, useState, useEffect } from "react";
import { createPaymentLink } from "@calcom/app-store/stripepayment/lib/client";
import { useHandleBookEvent } from "@calcom/atoms/monorepo";
import { useHandleBookEvent } from "@calcom/atoms/hooks/bookings/useHandleBookEvent";
import dayjs from "@calcom/dayjs";
import { sdkActionManager } from "@calcom/embed-core/embed-iframe";
import { useBookerStore } from "@calcom/features/bookings/Booker/store";
@@ -3,8 +3,9 @@ import { useFormContext } from "react-hook-form";
import { Controller } from "react-hook-form";
import type { Options } from "react-select";
import { AddMembersWithSwitchPlatformWrapper } from "@calcom/atoms/add-members-switch/AddMembersWithSwitchPlatformWrapper";
import { AddMembersWithSwitchWebWrapper } from "@calcom/atoms/add-members-switch/AddMembersWithSwitchWebWrapper";
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
import { AddMembersWithSwitchWebWrapper, AddMembersWithSwitchPlatformWrapper } from "@calcom/atoms/monorepo";
import { Segment } from "@calcom/features/Segment";
import type {
FormValues,
@@ -1,7 +1,6 @@
import { useMemo, useState, Suspense } from "react";
import type { UseFormReturn } from "react-hook-form";
import { Shell as PlatformShell } from "@calcom/atoms/monorepo";
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
import { EventTypeEmbedButton, EventTypeEmbedDialog } from "@calcom/features/embed/EventTypeEmbed";
import type { FormValues } from "@calcom/features/eventtypes/lib/types";
@@ -31,6 +30,7 @@ import {
} from "@calcom/ui";
import classNames from "@calcom/ui/classNames";
import { Shell as PlatformShell } from "../../../platform/atoms/src/components/ui/shell";
import { DeleteDialog } from "./dialogs/DeleteDialog";
type Props = {
@@ -3,13 +3,13 @@ import type { Dispatch, SetStateAction } from "react";
import { Controller, useFormContext } from "react-hook-form";
import type { z } from "zod";
import { useAtomsContext } from "@calcom/atoms/hooks/useAtomsContext";
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
import {
SelectedCalendarsSettingsWebWrapper,
SelectedCalendarSettingsScope,
SelectedCalendarsSettingsWebWrapperSkeleton,
} from "@calcom/atoms/monorepo";
import { useAtomsContext } from "@calcom/atoms/monorepo";
} from "@calcom/atoms/selected-calendars/wrappers/SelectedCalendarsSettingsWebWrapper";
import getLocationsOptionsForSelect from "@calcom/features/bookings/lib/getLocationOptionsForSelect";
import DestinationCalendarSelector from "@calcom/features/calendars/DestinationCalendarSelector";
import useLockedFieldsManager from "@calcom/features/ee/managed-event-types/hooks/useLockedFieldsManager";
+1
View File
@@ -7,6 +7,7 @@
"version": "1.0.0",
"main": "index.ts",
"dependencies": {
"@calcom/atoms": "*",
"@calcom/dayjs": "*",
"@calcom/lib": "*",
"@calcom/trpc": "*",
+1 -1
View File
@@ -1,6 +1,6 @@
import { useTranslation } from "next-i18next";
import { useAtomsContext } from "@calcom/atoms/monorepo";
import { useAtomsContext } from "@calcom/atoms/hooks/useAtomsContext";
export const useLocale = (namespace: Parameters<typeof useTranslation>[0] = "common") => {
const context = useAtomsContext();
-22
View File
@@ -1,22 +0,0 @@
export { BookerWebWrapper as Booker } from "./booker";
export { CalProvider } from "./cal-provider/CalProvider";
export { useAtomsContext } from "./hooks/useAtomsContext";
export { useEventTypeById } from "./hooks/event-types/private/useEventTypeById";
export { useHandleBookEvent } from "./hooks/bookings/useHandleBookEvent";
export * as Dialog from "./src/components/ui/dialog";
export { Timezone } from "./timezone";
export {
SelectedCalendarsSettingsWebWrapper,
SelectedCalendarsSettingsWebWrapperSkeleton,
SelectedCalendarSettingsScope,
} from "./selected-calendars/wrappers/SelectedCalendarsSettingsWebWrapper";
export { DestinationCalendarSettingsWebWrapper } from "./destination-calendar/wrappers/DestinationCalendarSettingsWebWrapper";
export * from "./availability";
export { EventTypeWebWrapper as EventType } from "./event-types/wrappers/EventTypeWebWrapper";
export { ConferencingAppsViewWebWrapper } from "./connect/conferencing-apps/ConferencingAppsViewWebWrapper";
export type { UpdateScheduleInput_2024_06_11 as UpdateScheduleBody } from "@calcom/platform-types";
export { Shell } from "./src/components/ui/shell";
export { AddMembersWithSwitchWebWrapper } from "./add-members-switch/AddMembersWithSwitchWebWrapper";
export { AddMembersWithSwitchPlatformWrapper } from "./add-members-switch/AddMembersWithSwitchPlatformWrapper";
export { markdownToSafeHTML } from "./lib/markdownToSafeHTML";
export { useIsPlatformBookerEmbed } from "./hooks/useIsPlatformBookerEmbed";
+17 -7
View File
@@ -46,14 +46,24 @@
"import": "./dist/cal-atoms.js",
"types": "./dist/index.d.ts"
},
"./monorepo": {
"import": "./monorepo.ts",
"require": "./monorepo.ts"
},
"./hooks/useIsPlatform": "./hooks/useIsPlatform.ts",
"./globals.min.css": "./globals.min.css",
"./add-members-switch/AddMembersWithSwitchPlatformWrapper": "./add-members-switch/AddMembersWithSwitchPlatformWrapper.tsx",
"./add-members-switch/AddMembersWithSwitchWebWrapper": "./add-members-switch/AddMembersWithSwitchWebWrapper.tsx",
"./availability/AvailabilitySettings": "./availability/AvailabilitySettings.tsx",
"./booker": "./booker/index.ts",
"./components/ui/shell": "./src/components/ui/shell.tsx",
"./connect/conferencing-apps/ConferencingAppsViewWebWrapper": "./connect/conferencing-apps/ConferencingAppsViewWebWrapper.tsx",
"./destination-calendar/wrappers/DestinationCalendarSettingsWebWrapper": "./destination-calendar/wrappers/DestinationCalendarSettingsWebWrapper.tsx",
"./dist/index.ts": "./index.ts",
"./dist/index.d.ts": "./dist/index.d.ts"
"./dist/index.d.ts": "./dist/index.d.ts",
"./event-types/wrappers/EventTypeWebWrapper": "./event-types/wrappers/EventTypeWebWrapper.tsx",
"./globals.min.css": "./globals.min.css",
"./hooks/bookings/useHandleBookEvent": "./hooks/bookings/useHandleBookEvent.ts",
"./hooks/useAtomsContext": "./hooks/useAtomsContext.ts",
"./hooks/useIsPlatform": "./hooks/useIsPlatform.ts",
"./hooks/useIsPlatformBookerEmbed": "./hooks/useIsPlatformBookerEmbed.ts",
"./hooks/event-types/private/useEventTypeById": "./hooks/event-types/private/useEventTypeById.ts",
"./selected-calendars/wrappers/SelectedCalendarsSettingsWebWrapper": "./selected-calendars/wrappers/SelectedCalendarsSettingsWebWrapper.tsx",
"./timezone": "./timezone/index.tsx"
},
"types": "./dist/index.d.ts",
"dependencies": {
+1 -1
View File
@@ -52,7 +52,7 @@ export default defineConfig(({ mode }) => {
path: resolve("../../../node_modules/rollup-plugin-node-builtins"),
os: resolve("../../../node_modules/rollup-plugin-node-builtins"),
"@": path.resolve(__dirname, "./src"),
"@calcom/lib/markdownToSafeHTML": "@calcom/atoms/monorepo",
"@calcom/lib/markdownToSafeHTML": path.resolve(__dirname, "./lib/markdownToSafeHTML"),
".prisma/client": path.resolve(__dirname, "../../prisma-client"),
"@prisma/client": path.resolve(__dirname, "../../prisma-client"),
"@calcom/prisma": path.resolve(__dirname, "../../prisma"),
+1 -1
View File
@@ -7,11 +7,11 @@ import type { ForwardRefExoticComponent, ReactElement, ReactNode } from "react";
import React, { useMemo, useState } from "react";
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
import { Dialog as PlatformDialogPrimitives } from "@calcom/atoms/monorepo";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import classNames from "@calcom/ui/classNames";
import * as PlatformDialogPrimitives from "../../../platform/atoms/src/components/ui/dialog";
import type { ButtonProps } from "../button";
import { Button } from "../button";
import type { IconName } from "../icon";
+1 -1
View File
@@ -57,7 +57,7 @@ vi.mock("@calcom/lib/hooks/useLocale", () => ({
},
}));
vi.mock("@calcom/atoms/monorepo", () => ({
vi.mock("@calcom/atoms/hooks/useIsPlatform", () => ({
useIsPlatform: () => {
return false;
},
+1
View File
@@ -2945,6 +2945,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@calcom/features@workspace:packages/features"
dependencies:
"@calcom/atoms": "*"
"@calcom/dayjs": "*"
"@calcom/lib": "*"
"@calcom/trpc": "*"