From 3c162b2b4a17b70af4e318f583815001cca3737b Mon Sep 17 00:00:00 2001
From: Alex Yang <himself65@outlook.com>
Date: Mon, 4 Nov 2024 09:54:54 -0800
Subject: [PATCH] docs: direct to legacy docs (#1431)

---
 apps/next/.gitignore                |   1 +
 apps/next/src/app/(home)/page.tsx   |   3 +-
 apps/next/src/app/layout.config.tsx |  16 +---
 apps/next/types/cache-life.d.ts     | 135 ----------------------------
 apps/next/types/package.json        |   3 -
 5 files changed, 6 insertions(+), 152 deletions(-)
 delete mode 100644 apps/next/types/cache-life.d.ts
 delete mode 100644 apps/next/types/package.json

diff --git a/apps/next/.gitignore b/apps/next/.gitignore
index 27829797e..fd8c1c3dd 100644
--- a/apps/next/.gitignore
+++ b/apps/next/.gitignore
@@ -29,3 +29,4 @@ next-env.d.ts
 
 # build
 /src/content/docs/cloud/api
+./types
diff --git a/apps/next/src/app/(home)/page.tsx b/apps/next/src/app/(home)/page.tsx
index 50b1192e5..3a3d891b0 100644
--- a/apps/next/src/app/(home)/page.tsx
+++ b/apps/next/src/app/(home)/page.tsx
@@ -11,6 +11,7 @@ import { NpmInstall } from "@/components/npm-install";
 import { TextEffect } from "@/components/text-effect";
 import { Button } from "@/components/ui/button";
 import { Skeleton } from "@/components/ui/skeleton";
+import { LEGACY_DOCUMENT_URL } from "@/lib/const";
 import { SiStackblitz } from "@icons-pack/react-simple-icons";
 import {
   CodeBlock as FumaCodeBlock,
@@ -37,7 +38,7 @@ export default function HomePage() {
       </div>
 
       <div className="flex flex-wrap justify-center gap-4">
-        <Link href="/docs/llamaindex">
+        <Link href={LEGACY_DOCUMENT_URL}>
           <Button variant="outline">Get Started</Button>
         </Link>
         <NpmInstall />
diff --git a/apps/next/src/app/layout.config.tsx b/apps/next/src/app/layout.config.tsx
index cc2d7c769..05855cd02 100644
--- a/apps/next/src/app/layout.config.tsx
+++ b/apps/next/src/app/layout.config.tsx
@@ -1,4 +1,4 @@
-import { Badge } from "@/components/ui/badge";
+import { LEGACY_DOCUMENT_URL } from "@/lib/const";
 import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared";
 import Image from "next/image";
 
@@ -27,18 +27,8 @@ export const baseOptions: BaseLayoutProps = {
   githubUrl: "https://github.com/run-llama/LlamaIndexTS",
   links: [
     {
-      text: (
-        <div className="relative">
-          Docs
-          <Badge
-            variant="outline"
-            className="text-blue-500 absolute -top-5 -left-5 bg-fd-background hover:scale-125 transition-transform -rotate-3 hover:-rotate-12"
-          >
-            new
-          </Badge>
-        </div>
-      ),
-      url: "/docs/llamaindex",
+      text: "Docs",
+      url: LEGACY_DOCUMENT_URL,
       active: "nested-url",
     },
   ],
diff --git a/apps/next/types/cache-life.d.ts b/apps/next/types/cache-life.d.ts
deleted file mode 100644
index 5970926f8..000000000
--- a/apps/next/types/cache-life.d.ts
+++ /dev/null
@@ -1,135 +0,0 @@
-// Type definitions for Next.js cacheLife configs
-
-declare module "next/cache" {
-  export { cacheTag as unstable_cacheTag } from "next/dist/server/use-cache/cache-tag";
-  export {
-    revalidatePath,
-    revalidateTag,
-  } from "next/dist/server/web/spec-extension/revalidate";
-  export { unstable_cache } from "next/dist/server/web/spec-extension/unstable-cache";
-  export { unstable_noStore } from "next/dist/server/web/spec-extension/unstable-no-store";
-
-  /**
-   * Cache this `"use cache"` for a timespan defined by the `"default"` profile.
-   * ```
-   *   stale:      300 seconds (5 minutes)
-   *   revalidate: 900 seconds (15 minutes)
-   *   expire:     never
-   * ```
-   *
-   * This cache may be stale on clients for 5 minutes before checking with the server.
-   * If the server receives a new request after 15 minutes, start revalidating new values in the background.
-   * It lives for the maximum age of the server cache. If this entry has no traffic for a while, it may serve an old value the next request.
-   */
-  export function unstable_cacheLife(profile: "default"): void;
-
-  /**
-   * Cache this `"use cache"` for a timespan defined by the `"seconds"` profile.
-   * ```
-   *   stale:      0 seconds
-   *   revalidate: 1 seconds
-   *   expire:     1 seconds
-   * ```
-   *
-   * This cache may be stale on clients for 0 seconds before checking with the server.
-   * This cache will expire after 1 seconds. The next request will recompute it.
-   */
-  export function unstable_cacheLife(profile: "seconds"): void;
-
-  /**
-   * Cache this `"use cache"` for a timespan defined by the `"minutes"` profile.
-   * ```
-   *   stale:      300 seconds (5 minutes)
-   *   revalidate: 60 seconds (1 minute)
-   *   expire:     3600 seconds (1 hour)
-   * ```
-   *
-   * This cache may be stale on clients for 5 minutes before checking with the server.
-   * If the server receives a new request after 1 minute, start revalidating new values in the background.
-   * If this entry has no traffic for 1 hour it will expire. The next request will recompute it.
-   */
-  export function unstable_cacheLife(profile: "minutes"): void;
-
-  /**
-   * Cache this `"use cache"` for a timespan defined by the `"hours"` profile.
-   * ```
-   *   stale:      300 seconds (5 minutes)
-   *   revalidate: 3600 seconds (1 hour)
-   *   expire:     86400 seconds (1 day)
-   * ```
-   *
-   * This cache may be stale on clients for 5 minutes before checking with the server.
-   * If the server receives a new request after 1 hour, start revalidating new values in the background.
-   * If this entry has no traffic for 1 day it will expire. The next request will recompute it.
-   */
-  export function unstable_cacheLife(profile: "hours"): void;
-
-  /**
-   * Cache this `"use cache"` for a timespan defined by the `"days"` profile.
-   * ```
-   *   stale:      300 seconds (5 minutes)
-   *   revalidate: 86400 seconds (1 day)
-   *   expire:     604800 seconds (1 week)
-   * ```
-   *
-   * This cache may be stale on clients for 5 minutes before checking with the server.
-   * If the server receives a new request after 1 day, start revalidating new values in the background.
-   * If this entry has no traffic for 1 week it will expire. The next request will recompute it.
-   */
-  export function unstable_cacheLife(profile: "days"): void;
-
-  /**
-   * Cache this `"use cache"` for a timespan defined by the `"weeks"` profile.
-   * ```
-   *   stale:      300 seconds (5 minutes)
-   *   revalidate: 604800 seconds (1 week)
-   *   expire:     2592000 seconds (30 days)
-   * ```
-   *
-   * This cache may be stale on clients for 5 minutes before checking with the server.
-   * If the server receives a new request after 1 week, start revalidating new values in the background.
-   * If this entry has no traffic for 30 days it will expire. The next request will recompute it.
-   */
-  export function unstable_cacheLife(profile: "weeks"): void;
-
-  /**
-   * Cache this `"use cache"` for a timespan defined by the `"max"` profile.
-   * ```
-   *   stale:      300 seconds (5 minutes)
-   *   revalidate: 2592000 seconds (30 days)
-   *   expire:     never
-   * ```
-   *
-   * This cache may be stale on clients for 5 minutes before checking with the server.
-   * If the server receives a new request after 30 days, start revalidating new values in the background.
-   * It lives for the maximum age of the server cache. If this entry has no traffic for a while, it may serve an old value the next request.
-   */
-  export function unstable_cacheLife(profile: "max"): void;
-
-  /**
-   * Cache this `"use cache"` using a custom timespan.
-   * ```
-   *   stale: ... // seconds
-   *   revalidate: ... // seconds
-   *   expire: ... // seconds
-   * ```
-   *
-   * This is similar to Cache-Control: max-age=`stale`,s-max-age=`revalidate`,stale-while-revalidate=`expire-revalidate`
-   *
-   * If a value is left out, the lowest of other cacheLife() calls or the default, is used instead.
-   */
-  export function unstable_cacheLife(profile: {
-    /**
-     * This cache may be stale on clients for ... seconds before checking with the server.
-     */
-    stale?: number;
-    /**
-     * If the server receives a new request after ... seconds, start revalidating new values in the background.
-     */
-    revalidate?: number;
-    /**
-     * If this entry has no traffic for ... seconds it will expire. The next request will recompute it.
-     */
-    expire?: number;
-  }): void;
-}
diff --git a/apps/next/types/package.json b/apps/next/types/package.json
deleted file mode 100644
index 3dbc1ca59..000000000
--- a/apps/next/types/package.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
-  "type": "module"
-}
-- 
GitLab