fixed twenty website build (#5174)

Made code compile during build even when then environment variable is
not yet available

Co-authored-by: Ady Beraud <a.beraud96@gmail.com>
This commit is contained in:
Ady Beraud 2024-04-25 16:54:54 +03:00 committed by GitHub
parent d23e02adca
commit 6e8c6c8e58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 23 additions and 3 deletions

View File

@ -9,6 +9,8 @@ import { savePRsToDB } from '@/github-sync/contributors/save-prs-to-db';
import { searchIssuesPRs } from '@/github-sync/contributors/search-issues-prs';
import { IssueNode, PullRequestNode } from '@/github-sync/contributors/types';
export const dynamic = 'force-dynamic';
export async function GET() {
if (!global.process.env.GITHUB_TOKEN) {
return new Response('No GitHub token provided', { status: 500 });

View File

@ -8,6 +8,8 @@ import EmotionRootStyleRegistry from './emotion-root-style-registry';
import './layout.css';
export const dynamic = 'force-dynamic';
export const metadata: Metadata = {
title: 'Twenty.com',
description: 'Open Source CRM',

View File

@ -11,6 +11,8 @@ export const metadata = {
icons: '/images/core/logo.svg',
};
export const dynamic = 'force-dynamic';
export default async function OssFriends() {
const ossList = await fetch('https://formbricks.com/api/oss-friends');

View File

@ -1,5 +1,7 @@
import { ContentContainer } from './_components/ui/layout/ContentContainer';
export const dynamic = 'force-dynamic';
export default function Home() {
return (
<ContentContainer>

View File

@ -9,6 +9,8 @@ export interface ReleaseNote {
content: string;
}
export const dynamic = 'force-dynamic';
export async function GET(request: NextRequest) {
const host = request.nextUrl.hostname;
const protocol = request.nextUrl.protocol;

View File

@ -16,6 +16,8 @@ export const metadata: Metadata = {
'Discover the newest features and improvements in Twenty, the #1 open-source CRM.',
};
export const dynamic = 'force-dynamic';
const Home = async () => {
const releases = await getReleases();
const mdxReleasesContent = await getMdxReleasesContent(releases);

View File

@ -4,6 +4,8 @@ import UserGuideContent from '@/app/_components/user-guide/UserGuideContent';
import { fetchArticleFromSlug } from '@/shared-utils/fetchArticleFromSlug';
import { formatSlug } from '@/shared-utils/formatSlug';
export const dynamic = 'force-dynamic';
export async function generateMetadata({
params,
}: {

View File

@ -7,6 +7,8 @@ export const metadata = {
icons: '/images/core/logo.svg',
};
export const dynamic = 'force-dynamic';
export default async function UserGuideHome() {
return <UserGuideMain />;
}

View File

@ -1,12 +1,16 @@
import { global } from '@apollo/client/utilities/globals';
import { drizzle } from 'drizzle-orm/postgres-js';
import { drizzle, PostgresJsDatabase } from 'drizzle-orm/postgres-js';
import { migrate as postgresMigrate } from 'drizzle-orm/postgres-js/migrator';
import postgres from 'postgres';
import 'dotenv/config';
const pgClient = postgres(`${global.process.env.DATABASE_PG_URL}`);
const pgDb = drizzle(pgClient, { logger: false });
let pgDb: PostgresJsDatabase;
if (global.process.env.DATABASE_PG_URL) {
const pgClient = postgres(`${global.process.env.DATABASE_PG_URL}`);
pgDb = drizzle(pgClient, { logger: false });
}
const migrate = async () => {
await postgresMigrate(pgDb, {