* chore: deploy api v2 on vercel * fix: replace console.log with logger.log in Vercel handler Address Cubic AI review feedback to use the logging framework consistently instead of console.log in the serverless handler. Co-Authored-By: unknown <> * chore: enable esModuleInterop * chore: deploy api v2 on vercel * chore: deploy api v2 on vercel * Update apps/api/v2/src/bootstrap.ts Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> * fixup! Merge branch 'main' into deploy-api-v2-vercel * Revert "chore: deploy api v2 on vercel" This reverts commit 45c704a48e8396c46118069e1a25d8d7a5ee84be. * chore: deploy api v2 on vercel * fix: address Cubic AI review feedback in main.ts - Replace console.log with logger.log for consistent logging - Replace console.error with logger.error for consistent error logging - Restore comma: true option in qs.parse to support comma-separated arrays Co-Authored-By: unknown <> * fix: remove comma: true from qs.parse to maintain backward compatibility The main branch does not have comma: true in the query parser, so adding it would be a breaking change for existing API consumers. Removing it to maintain consistency with the current production behavior. Co-Authored-By: unknown <> * chore: deploy api v2 on vercel * small fixes * chore: add try catch around bootstrap.ts * fix: use NestJS Logger and throw error instead of process.exit in bootstrap - Replace console.error with logger.error for consistent logging - Replace process.exit(1) with throw error to avoid breaking Vercel serverless instance reuse Addresses Cubic AI review feedback (confidence 10/10 for both issues) Co-Authored-By: unknown <> * chore: try log redis url * fix: sanitize REDIS_URL logging to avoid exposing credentials Replace full REDIS_URL logging with a boolean check that only indicates whether Redis is configured, without exposing the connection string. Addresses Cubic AI review feedback (confidence 9/10) Co-Authored-By: unknown <> * chore: remove unnecessary logs * fix: prisma adapter * chore: handle USE_POOL platform libraries * fix: use JSON.stringify for Vite define value Wrap usePool with JSON.stringify() to properly serialize the string value. Without this, Vite injects the raw value as an identifier instead of a string literal, breaking runtime behavior. Addresses Cubic AI review feedback (confidence 9/10) Co-Authored-By: unknown <> * fix: docker file builds * fix: correct Dockerfile build order for platform packages Reorder builds to match the dependency graph from dev:build script: constants → enums → utils → types → libraries → trpc → api-v2 platform-libraries depends on the other platform packages, so they must be built first. Addresses Cubic AI review feedback (confidence 9/10) Co-Authored-By: unknown <> * fix: docker file builds * chore: add docker build * chore: upgrade nest/bull --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
226 lines
7.6 KiB
JavaScript
226 lines
7.6 KiB
JavaScript
// vite.config.ts
|
|
|
|
import path, { dirname, resolve } from "node:path";
|
|
import process from "node:process";
|
|
import { fileURLToPath } from "node:url";
|
|
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vite";
|
|
import dts from "vite-plugin-dts";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
const usePool = process.env.USE_POOL ?? "true";
|
|
|
|
console.log("Platform libraries usePool", usePool);
|
|
|
|
// https://vitejs.dev/guide/build.html#library-mode
|
|
export default defineConfig({
|
|
define: {
|
|
"process.env.USE_POOL": JSON.stringify(usePool),
|
|
},
|
|
esbuild: {
|
|
target: "node18",
|
|
platform: "node",
|
|
},
|
|
build: {
|
|
target: "node18",
|
|
platform: "node",
|
|
ssr: true,
|
|
lib: {
|
|
entry: {
|
|
index: resolve(__dirname, "./index.ts"),
|
|
schedules: resolve(__dirname, "./schedules.ts"),
|
|
emails: resolve(__dirname, "./emails.ts"),
|
|
"event-types": resolve(__dirname, "./event-types.ts"),
|
|
"app-store": resolve(__dirname, "./app-store.ts"),
|
|
workflows: resolve(__dirname, "./workflows.ts"),
|
|
slots: resolve(__dirname, "./slots.ts"),
|
|
conferencing: resolve(__dirname, "./conferencing.ts"),
|
|
repositories: resolve(__dirname, "./repositories.ts"),
|
|
bookings: resolve(__dirname, "./bookings.ts"),
|
|
organizations: resolve(__dirname, "./organizations.ts"),
|
|
"private-links": resolve(__dirname, "./private-links.ts"),
|
|
pbac: resolve(__dirname, "./pbac.ts"),
|
|
errors: resolve(__dirname, "./errors.ts"),
|
|
},
|
|
name: "calcom-lib",
|
|
fileName: "calcom-lib",
|
|
},
|
|
commonjsOptions: {
|
|
dynamicRequireRoot: "../../../apps/web",
|
|
dynamicRequireTargets: ["next-i18next.config.js"],
|
|
ignoreDynamicRequires: true,
|
|
include: ["../../prisma/client/**"],
|
|
},
|
|
rollupOptions: {
|
|
external: [
|
|
"react",
|
|
"fs",
|
|
"path",
|
|
"os",
|
|
"crypto",
|
|
"react-dom",
|
|
"http",
|
|
"fs/promises",
|
|
"perf_hooks",
|
|
"@prisma/client",
|
|
"@prisma/adapter-pg",
|
|
"pg",
|
|
"async",
|
|
"libphonenumber-js",
|
|
"lodash",
|
|
"short-uuid",
|
|
"uuid",
|
|
"zod",
|
|
"dayjs",
|
|
"i18next",
|
|
"next-i18next",
|
|
"@sentry/nextjs",
|
|
"@trpc/server",
|
|
"raw-body",
|
|
"@getalby/lightning-tools",
|
|
"svix",
|
|
"ical.js",
|
|
"ics",
|
|
"tsdav",
|
|
"@googleapis/calendar",
|
|
"rrule",
|
|
"@hubspot/api-client",
|
|
"querystring",
|
|
"handlebars",
|
|
"@sendgrid/client",
|
|
"@sendgrid/mail",
|
|
"twilio",
|
|
"@prisma/client/runtime/index-browser.js",
|
|
"lru-cache",
|
|
"next-auth/jwt",
|
|
"memory-cache",
|
|
"@jsforce/jsforce-node",
|
|
"jsforce",
|
|
"axios",
|
|
"qs",
|
|
"qs-stringify",
|
|
"stripe",
|
|
"@tryvital/vital-node",
|
|
"queue",
|
|
"entities",
|
|
"nodemailer",
|
|
"react/jsx-runtime",
|
|
"sanitize-html",
|
|
"markdown-it",
|
|
"react-i18next",
|
|
"jsonwebtoken",
|
|
"ews-javascript-api",
|
|
"dayjs/plugin/customParseFormat.js",
|
|
"dayjs/plugin/duration.js",
|
|
"dayjs/plugin/isBetween.js",
|
|
"dayjs/plugin/isToday.js",
|
|
"dayjs/plugin/localizedFormat.js",
|
|
"dayjs/plugin/minMax.js",
|
|
"dayjs/plugin/relativeTime.js",
|
|
"dayjs/plugin/timezone.js",
|
|
"dayjs/plugin/toArray.js",
|
|
"dayjs/plugin/utc.js",
|
|
"@prisma/extension-accelerate",
|
|
"@ewsjs/xhr",
|
|
"next-i18next/serverSideTranslations",
|
|
],
|
|
output: {
|
|
globals: {
|
|
react: "React",
|
|
"react-dom": "ReactDOM",
|
|
fs: "fs",
|
|
path: "path",
|
|
os: "os",
|
|
crypto: "crypto",
|
|
http: "http",
|
|
"fs/promises": "fs/promises",
|
|
perf_hooks: "perf_hooks",
|
|
"@prisma/client": "@prisma/client",
|
|
"@prisma/adapter-pg": "@prisma/adapter-pg",
|
|
pg: "pg",
|
|
async: "async",
|
|
"libphonenumber-js": "libphonenumber-js",
|
|
lodash: "lodash",
|
|
"short-uuid": "short-uuid",
|
|
uuid: "uuid",
|
|
zod: "zod",
|
|
dayjs: "dayjs",
|
|
i18next: "i18next",
|
|
"next-i18next": "next-i18next",
|
|
"@sentry/nextjs": "@sentry/nextjs",
|
|
"@trpc/server": "@trpc/server",
|
|
"raw-body": "raw-body",
|
|
"@getalby/lightning-tools": "@getalby/lightning-tools",
|
|
svix: "svix",
|
|
"ical.js": "ical.js",
|
|
ics: "ics",
|
|
tsdav: "tsdav",
|
|
"@googleapis/calendar": "@googleapis/calendar",
|
|
rrule: "rrule",
|
|
"@hubspot/api-client": "@hubspot/api-client",
|
|
querystring: "querystring",
|
|
handlebars: "handlebars",
|
|
"@sendgrid/client": "@sendgrid/client",
|
|
"@sendgrid/mail": "@sendgrid/mail",
|
|
twilio: "twilio",
|
|
"@prisma/client/runtime/index-browser.js": "@prisma/client/runtime/index-browser.js",
|
|
"lru-cache": "lru-cache",
|
|
"next-auth/jwt": "next-auth/jwt",
|
|
"memory-cache": "memory-cache",
|
|
"@jsforce-node": "@jsforce/jsforce-node",
|
|
jsforce: "jsforce",
|
|
axios: "axios",
|
|
qs: "qs",
|
|
"qs-stringify": "qs-stringify",
|
|
stripe: "stripe",
|
|
"@tryvital/vital-node": "@tryvital/vital-node",
|
|
queue: "queue",
|
|
entities: "entities",
|
|
nodemailer: "nodemailer",
|
|
"react/jsx-runtime": "react/jsx-runtime",
|
|
"sanitize-html": "sanitize-html",
|
|
"markdown-it": "markdown-it",
|
|
"react-i18next": "react-i18next",
|
|
jsonwebtoken: "jsonwebtoken",
|
|
"ews-javascript-api": "ews-javascript-api",
|
|
"dayjs/plugin/customParseFormat.js": "dayjs/plugin/customParseFormat.js",
|
|
"dayjs/plugin/duration.js": "dayjs/plugin/duration.js",
|
|
"dayjs/plugin/isBetween.js": "dayjs/plugin/isBetween.js",
|
|
"dayjs/plugin/isToday.js": "dayjs/plugin/isToday.js",
|
|
"dayjs/plugin/localizedFormat.js": "dayjs/plugin/localizedFormat.js",
|
|
"dayjs/plugin/minMax.js": "dayjs/plugin/minMax.js",
|
|
"dayjs/plugin/relativeTime.js": "dayjs/plugin/relativeTime.js",
|
|
"dayjs/plugin/timezone.js": "dayjs/plugin/timezone.js",
|
|
"dayjs/plugin/toArray.js": "dayjs/plugin/toArray.js",
|
|
"dayjs/plugin/utc.js": "dayjs/plugin/utc.js",
|
|
tslog: "tslog",
|
|
"@prisma/extension-accelerate": "@prisma/extension-accelerate",
|
|
"@ewsjs/xhr": "@ewsjs/xhr",
|
|
"next-i18next/serverSideTranslations": "next-i18next/serverSideTranslations",
|
|
"@calcom/prisma/client": "@calcom/prisma/client",
|
|
},
|
|
},
|
|
},
|
|
},
|
|
plugins: [react(), dts()],
|
|
resolve: {
|
|
conditions: ["node", "import", "require", "default"],
|
|
alias: {
|
|
"@calcom/lib/server/i18n": path.resolve(__dirname, "./i18n.ts"),
|
|
"./server/i18n": path.resolve(__dirname, "./i18n.ts"),
|
|
"../server/i18n": path.resolve(__dirname, "./i18n.ts"),
|
|
"@": path.resolve(__dirname, "./src"),
|
|
"@calcom/lib": path.resolve(__dirname, "../../lib"),
|
|
"@calcom/trpc": resolve("../../trpc"),
|
|
"lru-cache": resolve("../../../node_modules/lru-cache/dist/cjs/index.js"),
|
|
"@calcom/prisma/client/runtime/library": resolve("../../prisma/client/runtime/library"),
|
|
"@calcom/prisma/client": resolve("../../prisma/client"),
|
|
"@calcom/platform-constants": path.resolve(__dirname, "../constants/index.ts"),
|
|
"@calcom/platform-types": path.resolve(__dirname, "../types/index.ts"),
|
|
tslog: path.resolve(__dirname, "../../../apps/api/v2/src/lib/logger.bridge.ts"),
|
|
},
|
|
},
|
|
});
|