Skip to content

Commit 7748bc2

Browse files
author
RooCode
committed
fix: rm output standalone
1 parent d591285 commit 7748bc2

File tree

3 files changed

+87
-32
lines changed

3 files changed

+87
-32
lines changed

app/api-docs/layout.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
import "@/app/globals.css";
2-
31
export default function ApiDocsLayout({ children }: { children: React.ReactNode }) {
42
return (
53
<html lang='en'>
64
<body>
7-
<div className='min-h-screen'>{children}</div>
5+
<div className='min-h-screen bg-background'>{children}</div>
86
</body>
97
</html>
108
);

configs/swagger/config.ts

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,77 @@
11
import { createSwaggerSpec } from "next-swagger-doc";
22

3+
interface OperationObject {
4+
summary?: string;
5+
description?: string;
6+
parameters?: Array<{
7+
name: string;
8+
in: "query" | "header" | "path" | "cookie";
9+
description?: string;
10+
required?: boolean;
11+
schema?: {
12+
type: string;
13+
format?: string;
14+
};
15+
}>;
16+
responses: {
17+
[statusCode: string]: {
18+
description: string;
19+
content?: {
20+
[mediaType: string]: {
21+
schema: {
22+
type: string;
23+
properties?: Record<string, unknown>;
24+
};
25+
};
26+
};
27+
};
28+
};
29+
}
30+
31+
interface PathObject {
32+
get?: OperationObject;
33+
post?: OperationObject;
34+
put?: OperationObject;
35+
delete?: OperationObject;
36+
patch?: OperationObject;
37+
options?: OperationObject;
38+
head?: OperationObject;
39+
}
40+
41+
interface OpenAPISpec {
42+
openapi: string;
43+
info: {
44+
title: string;
45+
version: string;
46+
description: string;
47+
};
48+
servers: Array<{
49+
url: string;
50+
description: string;
51+
}>;
52+
paths: Record<string, PathObject>;
53+
components?: {
54+
schemas?: Record<string, unknown>;
55+
responses?: Record<string, unknown>;
56+
parameters?: Record<string, unknown>;
57+
securitySchemes?: Record<string, unknown>;
58+
};
59+
}
60+
61+
// Cache the generated spec to avoid re-computation on every request
62+
const cachedSpec = {
63+
current: null as OpenAPISpec | null
64+
};
65+
366
export const getApiDocs = () => {
4-
const spec = createSwaggerSpec({
5-
apiFolder: "app/api", // Path to API folder
67+
// Return cached spec if available
68+
if (cachedSpec.current) {
69+
return cachedSpec.current;
70+
}
71+
72+
// Generate spec with optimized settings
73+
const generatedSpec = createSwaggerSpec({
74+
apiFolder: "app/api",
675
definition: {
776
openapi: "3.0.0",
877
info: {
@@ -12,11 +81,20 @@ export const getApiDocs = () => {
1281
},
1382
servers: [
1483
{
15-
url: "http://localhost:3000",
16-
description: "Development server"
84+
url: process.env.NEXT_PUBLIC_API_URL || "http://localhost:3000",
85+
description: "API Server"
1786
}
1887
]
88+
},
89+
// Add cache settings
90+
cache: {
91+
maxAge: 60 * 60 * 1000, // 1 hour
92+
cacheControl: "public, max-age=3600"
1993
}
20-
});
21-
return spec;
94+
}) as OpenAPISpec;
95+
96+
// Cache the generated spec
97+
cachedSpec.current = generatedSpec;
98+
99+
return cachedSpec.current;
22100
};

next.config.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,8 @@
1-
import createNextIntlPlugin from "next-intl/plugin";
21
import type { NextConfig } from "next";
2+
import createNextIntlPlugin from "next-intl/plugin";
33

44
const withNextIntl = createNextIntlPlugin("./configs/i18n/request.ts");
55

6-
const nextConfig: NextConfig = {
7-
// Use standalone output for optimized production builds
8-
output: "standalone",
9-
10-
// Experimental features for better performance and smaller bundle size
11-
experimental: {
12-
// Enable server code minification
13-
serverMinification: true,
14-
// Optimize server components
15-
optimizeServerReact: true,
16-
// Optimize package imports
17-
optimizePackageImports: [
18-
"@radix-ui/react-icons",
19-
"@radix-ui/react-dialog",
20-
"@radix-ui/react-dropdown-menu",
21-
"lucide-react"
22-
]
23-
},
24-
25-
// Configure module transpilation
26-
transpilePackages: ["@radix-ui/react-icons"]
27-
};
6+
const nextConfig: NextConfig = {};
287

298
export default withNextIntl(nextConfig);

0 commit comments

Comments
 (0)