mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-24 08:01:56 -05:00
docs: use local source instead of fetch script (#8231)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
10
docs/package.json
Normal file
10
docs/package.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "@better-auth/docs-content",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"fumadocs-ui": "16.6.7",
|
||||
"lucide-react": "^0.575.0",
|
||||
"react": "^19.1.0"
|
||||
}
|
||||
}
|
||||
4
landing/.gitignore
vendored
4
landing/.gitignore
vendored
@@ -1,9 +1,5 @@
|
||||
.next
|
||||
node_modules
|
||||
.source
|
||||
content/docs
|
||||
content/docs-canary
|
||||
content/blogs
|
||||
.tmp-docs-fetch
|
||||
.env
|
||||
.DS_Store
|
||||
2
landing/next-env.d.ts
vendored
2
landing/next-env.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
import "./.next/dev/types/routes.d.ts";
|
||||
import "./.next/types/routes.d.ts";
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"fetch-docs": "bash scripts/fetch-docs.sh",
|
||||
"postinstall": "pnpm run fetch-docs && fumadocs-mdx",
|
||||
"postinstall": "fumadocs-mdx",
|
||||
"dev": "next dev --turbopack --port 3000",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Fetches docs and blog content from better-auth/better-auth repo
|
||||
# Runs before fumadocs-mdx to ensure content is available at build time
|
||||
|
||||
set -e
|
||||
|
||||
REPO="https://github.com/better-auth/better-auth.git"
|
||||
CONTENT_DIR="content"
|
||||
TEMP_DIR=".tmp-docs-fetch"
|
||||
|
||||
# ─── Fetch a single branch ──────────────────────────────────────────────────────
|
||||
# Usage: fetch_branch <branch> <docs_dest>
|
||||
fetch_branch() {
|
||||
local branch="$1"
|
||||
local docs_dest="$2"
|
||||
|
||||
echo "Fetching docs from branch '$branch'..."
|
||||
|
||||
rm -rf "$TEMP_DIR"
|
||||
git clone --depth 1 --filter=blob:none --sparse --branch "$branch" "$REPO" "$TEMP_DIR" 2>/dev/null
|
||||
cd "$TEMP_DIR"
|
||||
git sparse-checkout set docs/content docs/components
|
||||
cd ..
|
||||
|
||||
rm -rf "$docs_dest"
|
||||
mkdir -p "$docs_dest"
|
||||
cp -r "$TEMP_DIR/docs/content/docs/." "$docs_dest/"
|
||||
|
||||
# Copy blog content only from the main branch
|
||||
if [ "$branch" = "main" ]; then
|
||||
rm -rf "$CONTENT_DIR/blogs"
|
||||
mkdir -p "$CONTENT_DIR"
|
||||
cp -r "$TEMP_DIR/docs/content/blogs" "$CONTENT_DIR/blogs"
|
||||
|
||||
# Copy doc-specific components referenced by MDX files
|
||||
DOC_COMPONENTS=(
|
||||
"community-plugins-table.tsx"
|
||||
"resource-section.tsx"
|
||||
"resource-card.tsx"
|
||||
)
|
||||
for comp in "${DOC_COMPONENTS[@]}"; do
|
||||
if [ -f "$TEMP_DIR/docs/components/$comp" ]; then
|
||||
cp "$TEMP_DIR/docs/components/$comp" "components/$comp"
|
||||
fi
|
||||
done
|
||||
|
||||
# Rewrite relative image paths in blog frontmatter to absolute URLs
|
||||
DOCS_SITE="https://www.better-auth.com"
|
||||
for mdx in "$CONTENT_DIR/blogs"/*.mdx; do
|
||||
if [ -f "$mdx" ]; then
|
||||
tmp_file="${mdx}.tmp"
|
||||
sed "s|^image: \"/|image: \"${DOCS_SITE}/|" "$mdx" > "$tmp_file" && mv "$tmp_file" "$mdx"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
rm -rf "$TEMP_DIR"
|
||||
echo "Branch '$branch' fetched into $docs_dest."
|
||||
}
|
||||
|
||||
# ─── Main ────────────────────────────────────────────────────────────────────────
|
||||
|
||||
fetch_branch "main" "$CONTENT_DIR/docs"
|
||||
fetch_branch "canary" "$CONTENT_DIR/docs-canary"
|
||||
|
||||
echo "All docs content fetched successfully."
|
||||
@@ -6,16 +6,16 @@ import {
|
||||
import * as z from "zod";
|
||||
|
||||
export const docs = defineDocs({
|
||||
dir: "./content/docs",
|
||||
dir: "../docs/content/docs",
|
||||
});
|
||||
|
||||
export const canaryDocs = defineDocs({
|
||||
dir: "./content/docs-canary",
|
||||
dir: "../docs/content/docs",
|
||||
});
|
||||
|
||||
export const blogCollection = defineCollections({
|
||||
type: "doc",
|
||||
dir: "./content/blogs",
|
||||
dir: "../docs/content/blogs",
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string(),
|
||||
|
||||
14
pnpm-lock.yaml
generated
14
pnpm-lock.yaml
generated
@@ -692,6 +692,18 @@ importers:
|
||||
specifier: ^5.9.3
|
||||
version: 5.9.3
|
||||
|
||||
docs:
|
||||
dependencies:
|
||||
fumadocs-ui:
|
||||
specifier: 16.6.7
|
||||
version: 16.6.7(@types/react-dom@19.2.3(@types/react@19.2.14))(@types/react@19.2.14)(fumadocs-core@16.6.7(@mdx-js/mdx@3.1.1)(@oramacloud/client@2.1.4)(@tanstack/react-router@1.163.2(react-dom@19.2.4(react@19.2.4))(react@19.2.4))(@types/estree-jsx@1.0.5)(@types/hast@3.0.4)(@types/mdast@4.0.4)(@types/react@19.2.14)(algoliasearch@5.46.2)(lucide-react@0.575.0(react@19.2.4))(next@16.1.6(@babel/core@7.29.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.58.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(sass@1.97.1))(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(zod@4.3.6))(next@16.1.6(@babel/core@7.29.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.58.2)(babel-plugin-react-compiler@1.0.0)(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(sass@1.97.1))(react-dom@19.2.4(react@19.2.4))(react@19.2.4)(tailwindcss@4.2.1)
|
||||
lucide-react:
|
||||
specifier: ^0.575.0
|
||||
version: 0.575.0(react@19.2.4)
|
||||
react:
|
||||
specifier: ^19.1.0
|
||||
version: 19.2.4
|
||||
|
||||
e2e/adapter:
|
||||
dependencies:
|
||||
deepmerge:
|
||||
@@ -27256,7 +27268,7 @@ snapshots:
|
||||
|
||||
better-call@1.1.8(zod@4.3.6):
|
||||
dependencies:
|
||||
'@better-auth/utils': 0.3.0
|
||||
'@better-auth/utils': 0.3.1
|
||||
'@better-fetch/fetch': 1.1.21
|
||||
rou3: 0.7.12
|
||||
set-cookie-parser: 2.7.2
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
packages:
|
||||
- packages/**
|
||||
- landing
|
||||
- docs
|
||||
- demo/*
|
||||
- e2e/**
|
||||
- test
|
||||
|
||||
Reference in New Issue
Block a user