docs: make 2.x the default version (#3369)
This commit is contained in:
@@ -63,7 +63,7 @@ export function FormsSection() {
|
||||
<a href="https://deno.com" class="underline">Deno</a>, it's built on
|
||||
web standards.
|
||||
</p>
|
||||
<FancyLink href="/docs/concepts/forms" class="mt-2">
|
||||
<FancyLink href="/docs/advanced/forms" class="mt-2">
|
||||
Forms in Fresh
|
||||
</FancyLink>
|
||||
</div>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { FancyLink } from "../../components/FancyLink.tsx";
|
||||
import LemonTop from "../../islands/LemonTop.tsx";
|
||||
import LemonBottom from "../../islands/LemonBottom.tsx";
|
||||
|
||||
export function Hero(props: { origin: string }) {
|
||||
export function Hero() {
|
||||
return (
|
||||
<>
|
||||
<div class="bg-green-300 mt-0 pt-32 md:pt-48 !mb-0 bg-gradient-to-br from-blue-100 via-green-200 to-yellow-100">
|
||||
@@ -14,7 +14,7 @@ export function Hero(props: { origin: string }) {
|
||||
</h2>
|
||||
<div class="mt-12 flex flex-wrap justify-center items-stretch md:justify-start gap-4">
|
||||
<FancyLink href="/docs/getting-started">Get started</FancyLink>
|
||||
<CopyArea code={`deno run -A -r ${props.origin}`} />
|
||||
<CopyArea code={`deno run -Ar jsr:@fresh/init`} />
|
||||
</div>
|
||||
</div>
|
||||
<div class="md:col-span-2 flex justify-center items-end">
|
||||
|
||||
@@ -70,7 +70,7 @@ export function PartialsSection() {
|
||||
page, without a full page reload—perfect for interactive elements
|
||||
and dynamic apps.
|
||||
</p>
|
||||
<FancyLink href="/docs/concepts/partials" class="mt-4">
|
||||
<FancyLink href="/docs/advanced/partials" class="mt-4">
|
||||
Learn more about Partials
|
||||
</FancyLink>
|
||||
</div>
|
||||
|
||||
+6
-13
@@ -1,4 +1,3 @@
|
||||
import VERSIONS from "../versions.json" with { type: "json" };
|
||||
import {
|
||||
withBrowser,
|
||||
withChildProcessServer,
|
||||
@@ -55,15 +54,9 @@ Deno.test({
|
||||
}));
|
||||
});
|
||||
|
||||
expect(options).toEqual([
|
||||
{
|
||||
value: "canary",
|
||||
label: "canary",
|
||||
},
|
||||
{
|
||||
value: "latest",
|
||||
label: VERSIONS[0],
|
||||
},
|
||||
expect(options.map((item) => item.value)).toEqual([
|
||||
"latest",
|
||||
"1.x",
|
||||
]);
|
||||
|
||||
const selectValue = await page
|
||||
@@ -76,7 +69,7 @@ Deno.test({
|
||||
const el = document.querySelector(
|
||||
"#version",
|
||||
) as HTMLSelectElement;
|
||||
el.value = "canary";
|
||||
el.value = "1.x";
|
||||
el.dispatchEvent(new Event("change"));
|
||||
});
|
||||
|
||||
@@ -86,11 +79,11 @@ Deno.test({
|
||||
const selectValue2 = await page
|
||||
.locator<HTMLSelectElement>("#version")
|
||||
.evaluate((el) => el.value);
|
||||
expect(selectValue2).toEqual("canary");
|
||||
expect(selectValue2).toEqual("1.x");
|
||||
|
||||
await page.waitForFunction(() => {
|
||||
const url = new URL(window.location.href);
|
||||
return url.pathname === "/docs/canary/introduction";
|
||||
return url.pathname === "/docs/1.x/introduction";
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -39,6 +39,9 @@ export default function ErrorPage(props: PageProps) {
|
||||
}
|
||||
}
|
||||
|
||||
// deno-lint-ignore no-console
|
||||
console.error(error);
|
||||
|
||||
return ServerCodePage({
|
||||
serverCode: 500,
|
||||
codeDescription: "Oops! Something went wrong.",
|
||||
|
||||
@@ -3,8 +3,8 @@ import type { Context } from "fresh";
|
||||
const REDIRECTS: Record<string, string> = {
|
||||
"/docs/getting-started/fetching-data":
|
||||
"/docs/getting-started/custom-handlers",
|
||||
"/docs/canary/examples/modifying-the-head": "/docs/canary/advanced/head",
|
||||
"/docs/canary/concepts/builder": "/docs/canary/advanced/builder",
|
||||
"/docs/canary/examples/modifying-the-head": "/docs/advanced/head",
|
||||
"/docs/canary/concepts/builder": "/docs/advanced/builder",
|
||||
};
|
||||
|
||||
export async function handler<T>(ctx: Context<T>) {
|
||||
|
||||
@@ -47,9 +47,7 @@ export const handler = define.handlers({
|
||||
},
|
||||
});
|
||||
|
||||
export default define.page<typeof handler>(function MainPage(props) {
|
||||
const origin = `${props.url.protocol}//${props.url.host}`;
|
||||
|
||||
export default define.page<typeof handler>(function MainPage() {
|
||||
return (
|
||||
<div class="flex flex-col min-h-screen bg-white">
|
||||
<div class="bg-transparent flex flex-col relative z-10">
|
||||
@@ -57,7 +55,7 @@ export default define.page<typeof handler>(function MainPage(props) {
|
||||
<Header title="" active="/" />
|
||||
</div>
|
||||
<div class="flex flex-col -mt-20 relative">
|
||||
<Hero origin={origin} />
|
||||
<Hero />
|
||||
<Simple />
|
||||
<RenderingSection />
|
||||
<IslandsSection />
|
||||
|
||||
+6
-2
@@ -4,6 +4,7 @@ import tailwindcss from "@tailwindcss/vite";
|
||||
import inspect from "vite-plugin-inspect";
|
||||
import { copy } from "@std/fs";
|
||||
import * as path from "@std/path";
|
||||
import { pathWithRoot } from "../packages/plugin-vite/src/utils.ts";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
@@ -20,10 +21,13 @@ function copyDocs(): Plugin {
|
||||
return {
|
||||
name: "fresh:copy-docs",
|
||||
configResolved(config) {
|
||||
serverOutDir = config.environments.ssr.build.outDir;
|
||||
serverOutDir = pathWithRoot(
|
||||
config.environments.ssr.build.outDir,
|
||||
config.root,
|
||||
);
|
||||
},
|
||||
async writeBundle() {
|
||||
const branches = ["canary", "latest"];
|
||||
const branches = ["canary", "latest", "1.x"];
|
||||
|
||||
for (const branch of branches) {
|
||||
const source = path.join(import.meta.dirname!, "..", "docs", branch);
|
||||
|
||||
Reference in New Issue
Block a user