chore: replace canary branch references with main (#8808)

Co-authored-by: Maxwell <145994855+ping-maxwell@users.noreply.github.com>
This commit is contained in:
Taesu
2026-04-01 10:29:47 +09:00
committed by GitHub
parent df7f8dda9f
commit 82409d2ede
14 changed files with 22 additions and 176 deletions

View File

@@ -8,7 +8,6 @@ on:
push:
branches:
- main
- canary
merge_group:
env:

View File

@@ -8,7 +8,6 @@ on:
push:
branches:
- main
- canary
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}

View File

@@ -1,7 +1,7 @@
name: E2E
on:
push:
branches: [ main, canary ]
branches: [ main ]
merge_group:
pull_request:

View File

@@ -206,7 +206,7 @@ pnpm lint:fix
8. Push your branch to your fork
9. Open a pull request against the **canary** branch. In your PR description:
9. Open a pull request against the **main** branch. In your PR description:
* Clearly describe what changes you made and why
* Include any relevant context or background
* List any breaking changes or deprecations

View File

@@ -129,7 +129,7 @@ Create Auth endpoints wraps around `createEndpoint` from Better Call. Inside the
- `trustedOrigins`: This is the list of trusted origins that you specified via `options.trustedOrigins`.
- `isTrustedOrigin`: This is a helper function that allows you to quickly check whether a given url or path is trusted based on the trusted origins configuration.
For other properties, you can check the <Link href="https://github.com/bekacru/better-call">Better Call</Link> documentation and the <Link href="https://github.com/better-auth/better-auth/blob/canary/packages/better-auth/src/context/create-context.ts">source code </Link>.
For other properties, you can check the <Link href="https://github.com/bekacru/better-call">Better Call</Link> documentation and the <Link href="https://github.com/better-auth/better-auth/blob/main/packages/better-auth/src/context/create-context.ts">source code </Link>.
**Rules for Endpoints**

View File

@@ -763,6 +763,6 @@ You may have extended the database models or implemented additional logic in Aut
## Wrapping Up
Now you're ready to migrate from Auth.js to Better Auth. For a complete implementation with multiple authentication methods, check out the [Next.js Demo App](https://github.com/better-auth/better-auth/tree/canary/demo/nextjs). Better Auth offers greater flexibility and more features, so be sure to explore the [documentation](/docs) to unlock its full potential.
Now you're ready to migrate from Auth.js to Better Auth. For a complete implementation with multiple authentication methods, check out the [Next.js Demo App](https://github.com/better-auth/better-auth/tree/main/demo/nextjs). Better Auth offers greater flexibility and more features, so be sure to explore the [documentation](/docs) to unlock its full potential.
If you need help with migration, join our [community](/community) or reach out to [contact@better-auth.com](mailto:contact@better-auth.com).

View File

@@ -77,11 +77,11 @@ Once you have an idea of what you want to contribute, you can start making chang
# Add upstream remote (if not already added)
git remote add upstream https://github.com/better-auth/better-auth.git
# Make sure you're on canary
git checkout canary
# Make sure you're on main
git checkout main
# Pull latest changes
git pull upstream canary
git pull upstream main
# Create and switch to a new branch
git checkout -b feature/your-feature-name

View File

@@ -49,7 +49,7 @@ All collected data is fully anonymous and only useful in aggregate. It cannot be
- **No PII or secrets**: We do not collect emails, usernames, tokens, secrets, client IDs, client secrets, or database URLs.
- **No full config**: We never send your full `betterAuth` configuration. Instead we send a reduced, redacted snapshot of nonsensitive toggles and counts.
- **Redaction by design**: See [detect-auth-config.ts](https://github.com/better-auth/better-auth/blob/canary/packages/telemetry/src/detectors/detect-auth-config.ts) in the Better Auth source for the exact shape of what is included. It purposely converts sensitive values to booleans, counts, or generic identifiers.
- **Redaction by design**: See [detect-auth-config.ts](https://github.com/better-auth/better-auth/blob/main/packages/telemetry/src/detectors/detect-auth-config.ts) in the Better Auth source for the exact shape of what is included. It purposely converts sensitive values to booleans, counts, or generic identifiers.
## How can I enable it?

View File

@@ -25,20 +25,16 @@ import {
} from "@/components/docs/mdx-components";
import { Callout } from "@/components/ui/callout";
import { createMetadata } from "@/lib/metadata";
import { getSource } from "@/lib/source";
import { source } from "@/lib/source";
import { cn } from "@/lib/utils";
import { LLMCopyButton, ViewOptions } from "./page.client";
export default async function Page({
params,
searchParams,
}: {
params: Promise<{ slug?: string[] }>;
searchParams: Promise<{ branch?: string }>;
}) {
const { slug } = await params;
const { branch } = await searchParams;
const source = getSource(branch);
const page = source.getPage(slug);
if (!page) {
@@ -46,7 +42,6 @@ export default async function Page({
}
const { body: MDX, toc } = await page.data.load();
const gitBranch = branch === "canary" ? "canary" : "main";
return (
<DocsPage
@@ -59,7 +54,7 @@ export default async function Page({
editOnGithub={{
owner: "better-auth",
repo: "better-auth",
sha: gitBranch,
sha: "main",
path: `docs/content/docs/${page.path}`,
}}
>
@@ -67,11 +62,11 @@ export default async function Page({
<DocsTitle className="mb-0">{page.data.title}</DocsTitle>
<div className="flex items-center gap-2 not-prose shrink-0">
<LLMCopyButton
rawUrl={`https://raw.githubusercontent.com/better-auth/better-auth/${gitBranch}/docs/content/docs/${page.path}`}
rawUrl={`https://raw.githubusercontent.com/better-auth/better-auth/main/docs/content/docs/${page.path}`}
/>
<ViewOptions
markdownUrl={`${page.url}.mdx`}
githubUrl={`https://github.com/better-auth/better-auth/blob/${gitBranch}/docs/content/docs/${page.path}`}
githubUrl={`https://github.com/better-auth/better-auth/blob/main/docs/content/docs/${page.path}`}
rawMdUrl={`/llms.txt${page.url}.md`}
/>
</div>
@@ -142,20 +137,15 @@ export default async function Page({
}
export async function generateStaticParams() {
const source = getSource();
return source.generateParams();
}
export async function generateMetadata({
params,
searchParams,
}: {
params: Promise<{ slug?: string[] }>;
searchParams: Promise<{ branch?: string }>;
}) {
const { slug } = await params;
const { branch } = await searchParams;
const source = getSource(branch);
const page = source.getPage(slug);
if (!page) return notFound();

View File

@@ -2,9 +2,9 @@
import { AnimatePresence, MotionConfig, motion } from "framer-motion";
import { useSearchContext } from "fumadocs-ui/contexts/search";
import { ChevronDownIcon, GitBranch, Search } from "lucide-react";
import { ChevronDownIcon, Search } from "lucide-react";
import Link from "next/link";
import { usePathname, useRouter, useSearchParams } from "next/navigation";
import { usePathname } from "next/navigation";
import type { ReactNode } from "react";
import { useEffect, useRef, useState } from "react";
import type { ListItem } from "@/components/sidebar-content";
@@ -17,14 +17,10 @@ type Section = (typeof contents)[number];
export function DocsSidebar() {
const pathname = usePathname();
const searchParams = useSearchParams();
const branch = searchParams.get("branch");
const { setOpenSearch } = useSearchContext();
const [currentOpen, setCurrentOpen] = useState(0);
const navRef = useRef<HTMLElement>(null);
const branchQuery = branch === "canary" ? "?branch=canary" : "";
const getDefaultOpen = (sections: Section[]) => {
const defaultValue = sections.findIndex((item) =>
item.list.some(
@@ -73,12 +69,9 @@ export function DocsSidebar() {
transition={{ duration: 0.28, ease: "easeOut" }}
className="fixed left-0 top-(--landing-topbar-height) bottom-0 w-[22vw] max-w-[300px] hidden lg:flex flex-col z-30 bg-background border-r border-foreground/5 transition-[width] duration-300 ease-out"
>
{/* Branch switcher */}
<BranchSwitcher />
<button
type="button"
className="flex w-full items-center gap-2 px-4 py-2.5 border-b border-foreground/5 text-sm text-foreground/55 hover:text-foreground/80 hover:bg-foreground/3 transition-colors"
className="flex w-full items-center gap-2 px-4 py-[9px] border-y border-foreground/5 text-sm text-foreground/55 hover:text-foreground/80 hover:bg-foreground/3 transition-colors"
onClick={() => setOpenSearch(true)}
>
<Search className="size-4 shrink-0" />
@@ -134,11 +127,7 @@ export function DocsSidebar() {
className="relative overflow-hidden"
>
<motion.div className="text-sm">
<SidebarSection
section={section}
pathname={pathname}
branchQuery={branchQuery}
/>
<SidebarSection section={section} pathname={pathname} />
</motion.div>
</motion.div>
)}
@@ -175,128 +164,19 @@ export function DocsSidebar() {
);
}
// ─── Branch Switcher ──────────────────────────────────────────────────────────
function BranchSwitcher() {
const router = useRouter();
const pathname = usePathname();
const searchParams = useSearchParams();
const branch = searchParams.get("branch") === "canary" ? "canary" : "main";
const [open, setOpen] = useState(false);
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
function handleClickOutside(e: MouseEvent) {
if (ref.current && !ref.current.contains(e.target as Node)) {
setOpen(false);
}
}
document.addEventListener("mousedown", handleClickOutside);
return () => document.removeEventListener("mousedown", handleClickOutside);
}, []);
const switchBranch = (target: "main" | "canary") => {
setOpen(false);
if (target === branch) return;
const params = new URLSearchParams(searchParams.toString());
if (target === "canary") {
params.set("branch", "canary");
} else {
params.delete("branch");
}
const qs = params.toString();
router.push(qs ? `${pathname}?${qs}` : pathname);
};
return (
<div ref={ref} className="relative border-b border-foreground/5">
<button
type="button"
className="flex h-10 w-full items-center gap-2 px-4 text-left hover:bg-foreground/2 transition-colors"
onClick={() => setOpen((v) => !v)}
>
<GitBranch className="size-3.5 text-foreground/60 shrink-0" />
<div className="grow text-left min-w-0">
<p className="block text-[12px] leading-none uppercase tracking-wider text-foreground/60">
{branch}{" "}
<span className="text-[9px] text-foreground/40 ">
{branch === "main" ? "" : "pre-release"}
</span>
</p>
</div>
<div className="flex flex-col items-center shrink-0 text-foreground/45">
<ChevronDownIcon className="size-3 rotate-180 -mb-[3px]" />
<ChevronDownIcon className="size-3 -mt-[3px]" />
</div>
</button>
<AnimatePresence>
{open && (
<motion.div
initial={{ opacity: 0, y: -4 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0, y: -4 }}
transition={{ duration: 0.15 }}
className="absolute left-2 right-2 lg:left-3 lg:right-3 top-full mt-1 z-50 rounded-md border border-foreground/10 bg-background shadow-md overflow-hidden"
>
<button
type="button"
className={cn(
"flex w-full items-center gap-2 px-3 py-2 text-[12px] transition-colors",
branch === "main"
? "text-foreground bg-foreground/5"
: "text-foreground/60 hover:text-foreground hover:bg-foreground/3",
)}
onClick={() => switchBranch("main")}
>
<span className="grow text-left">main</span>
<span className="text-[10px] text-foreground/45 uppercase tracking-wider">
Stable
</span>
</button>
<button
type="button"
className={cn(
"flex w-full items-center gap-2 px-3 py-2 text-[12px] transition-colors",
branch === "canary"
? "text-foreground bg-foreground/5"
: "text-foreground/60 hover:text-foreground hover:bg-foreground/3",
)}
onClick={() => switchBranch("canary")}
>
<span className="grow text-left">canary</span>
<Badge
className="pointer-events-none no-underline! border-dashed decoration-transparent! rounded-none px-1.5 py-0 text-[9px] uppercase tracking-wider text-foreground/55 border-foreground/25"
variant="outline"
>
Pre-release
</Badge>
</button>
</motion.div>
)}
</AnimatePresence>
</div>
);
}
// ─── Collapsible Section ──────────────────────────────────────────────────────
function SidebarSection({
section,
pathname,
branchQuery,
}: {
section: Section;
pathname: string;
branchQuery: string;
}) {
return (
<div className="pt-0 pb-1">
{section.href && (
<SidebarLink
href={`${section.href}${branchQuery}`}
active={pathname === section.href}
>
<SidebarLink href={section.href} active={pathname === section.href}>
Overview
</SidebarLink>
)}
@@ -344,7 +224,6 @@ function SidebarSection({
item={item}
active={active}
pathname={pathname}
branchQuery={branchQuery}
hasSubpages={hasSubpages}
/>
);
@@ -359,13 +238,11 @@ function SidebarItemWithSubpages({
item,
active,
pathname,
branchQuery,
hasSubpages,
}: {
item: ListItem;
active: boolean;
pathname: string;
branchQuery: string;
hasSubpages: boolean | undefined;
}) {
const showSubpages = hasSubpages && active;
@@ -373,7 +250,7 @@ function SidebarItemWithSubpages({
return (
<div>
<SidebarLink
href={`${item.href}${branchQuery}`}
href={item.href}
active={active}
icon={
<span className="min-w-5 [&>svg]:size-[14px]">
@@ -412,7 +289,7 @@ function SidebarItemWithSubpages({
return (
<SubpageLink
key={subpage.href}
href={`${subpage.href}${branchQuery}`}
href={subpage.href}
active={pathname === subpage.href}
icon={
subpage.icon ? (

View File

@@ -314,7 +314,7 @@ export function StaggeredNavFiles() {
initial={{ y: -10, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
transition={{ duration: 0.28, delay: 0.04, ease: "easeOut" }}
className={`flex-1 hidden lg:flex h-(--landing-topbar-height) items-stretch border-b bg-background pointer-events-auto min-w-0 ${navBottomBorderClass}`}
className={`flex-1 hidden lg:flex h-[calc(var(--landing-topbar-height)+1px)] items-stretch border-b bg-background pointer-events-auto min-w-0 ${navBottomBorderClass}`}
>
{/* Inline logo when left pane is hidden */}
{!isKnownPage && (

View File

@@ -195,7 +195,7 @@ async function githubSearchCode(query: string, path?: string) {
};
}
async function githubGetFileContent(path: string, ref = "canary") {
async function githubGetFileContent(path: string, ref = "main") {
const url = `${GITHUB_API}/repos/${GITHUB_REPO}/contents/${encodeURIComponent(path)}?ref=${ref}`;
const res = await fetch(url, {

View File

@@ -1,21 +1,12 @@
import { loader } from "fumadocs-core/source";
import { toFumadocsSource } from "fumadocs-mdx/runtime/server";
import { blogCollection, canaryDocs, docs } from "@/.source/server";
import { blogCollection, docs } from "@/.source/server";
export const source = loader({
baseUrl: "/docs",
source: docs.toFumadocsSource(),
});
export const canarySource = loader({
baseUrl: "/docs",
source: canaryDocs.toFumadocsSource(),
});
export function getSource(branch?: string) {
return branch === "canary" ? canarySource : source;
}
export const blogs = loader({
baseUrl: "/blog",
source: toFumadocsSource(blogCollection, []),

View File

@@ -21,16 +21,6 @@ export const docs = defineDocs({
},
});
export const canaryDocs = defineDocs({
dir: "../docs/content/docs",
docs: {
postprocess: {
includeProcessedMarkdown: true,
},
async: true,
},
});
export const blogCollection = defineCollections({
type: "doc",
dir: "../docs/content/blogs",