create-ardo 1.2.3 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ardo",
3
- "version": "1.2.3",
3
+ "version": "2.0.0",
4
4
  "description": "Scaffolding tool for Ardo documentation projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,7 +42,7 @@ jobs:
42
42
  - name: Upload artifact
43
43
  uses: actions/upload-pages-artifact@v4
44
44
  with:
45
- path: dist/client
45
+ path: build/client
46
46
 
47
47
  deploy:
48
48
  environment:
@@ -1,9 +1,7 @@
1
1
  node_modules
2
- dist
2
+ build
3
3
  .DS_Store
4
4
  *.local
5
5
 
6
- # Auto-generated by ardo (content routes derived from markdown)
7
- src/routes/guide/*.tsx
8
- !src/routes/guide/_layout.tsx
9
- src/routeTree.gen.ts
6
+ # React Router generated files
7
+ .react-router
@@ -0,0 +1,12 @@
1
+ import { startTransition, StrictMode } from "react"
2
+ import { hydrateRoot } from "react-dom/client"
3
+ import { HydratedRouter } from "react-router/dom"
4
+
5
+ startTransition(() => {
6
+ hydrateRoot(
7
+ document,
8
+ <StrictMode>
9
+ <HydratedRouter />
10
+ </StrictMode>
11
+ )
12
+ })
@@ -0,0 +1,34 @@
1
+ import type { EntryContext } from "react-router"
2
+ import { ServerRouter } from "react-router"
3
+ import { renderToReadableStream } from "react-dom/server"
4
+ import { isbot } from "isbot"
5
+
6
+ export default async function handleRequest(
7
+ request: Request,
8
+ responseStatusCode: number,
9
+ responseHeaders: Headers,
10
+ routerContext: EntryContext
11
+ ) {
12
+ const userAgent = request.headers.get("user-agent")
13
+
14
+ const stream = await renderToReadableStream(
15
+ <ServerRouter context={routerContext} url={request.url} />,
16
+ {
17
+ onError(error: unknown) {
18
+ console.error(error)
19
+ responseStatusCode = 500
20
+ },
21
+ }
22
+ )
23
+
24
+ if (userAgent && isbot(userAgent)) {
25
+ await stream.allReady
26
+ }
27
+
28
+ responseHeaders.set("Content-Type", "text/html")
29
+
30
+ return new Response(stream, {
31
+ status: responseStatusCode,
32
+ headers: responseHeaders,
33
+ })
34
+ }
@@ -0,0 +1,59 @@
1
+ import { Links, Meta, Outlet, Scripts, ScrollRestoration, useLocation } from "react-router"
2
+ import { Layout, Header, Nav, NavLink, Sidebar, SidebarGroup, SidebarLink, Footer } from "ardo/ui"
3
+ import { PressProvider } from "ardo/runtime"
4
+ import config from "virtual:ardo/config"
5
+ import sidebar from "virtual:ardo/sidebar"
6
+ import "ardo/ui/styles.css"
7
+
8
+ export function Layout({ children }: { children: React.ReactNode }) {
9
+ return (
10
+ <html lang="en" suppressHydrationWarning>
11
+ <head>
12
+ <meta charSet="utf-8" />
13
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
14
+ <Meta />
15
+ <Links />
16
+ </head>
17
+ <body suppressHydrationWarning>
18
+ {children}
19
+ <ScrollRestoration />
20
+ <Scripts />
21
+ </body>
22
+ </html>
23
+ )
24
+ }
25
+
26
+ export default function Root() {
27
+ const location = useLocation()
28
+ const isHomePage = location.pathname === "/"
29
+
30
+ return (
31
+ <PressProvider config={config} sidebar={sidebar}>
32
+ <Layout
33
+ className={isHomePage ? "ardo-layout ardo-home" : "ardo-layout"}
34
+ header={
35
+ <Header
36
+ title="{{SITE_TITLE}}"
37
+ nav={
38
+ <Nav>
39
+ <NavLink to="/guide/getting-started">Guide</NavLink>
40
+ </Nav>
41
+ }
42
+ />
43
+ }
44
+ sidebar={
45
+ isHomePage ? undefined : (
46
+ <Sidebar>
47
+ <SidebarGroup title="Guide">
48
+ <SidebarLink to="/guide/getting-started">Getting Started</SidebarLink>
49
+ </SidebarGroup>
50
+ </Sidebar>
51
+ )
52
+ }
53
+ footer={<Footer message="Built with Ardo" />}
54
+ >
55
+ <Outlet />
56
+ </Layout>
57
+ </PressProvider>
58
+ )
59
+ }
@@ -21,7 +21,7 @@ pnpm preview
21
21
 
22
22
  ## Adding Content
23
23
 
24
- Create `.md` or `.mdx` files in the `content/` directory. They will automatically become pages.
24
+ Create `.md` or `.mdx` files in the `app/routes/` directory. They will automatically become pages.
25
25
 
26
26
  ## Configuration
27
27
 
@@ -0,0 +1,36 @@
1
+ import { Hero, Features } from "ardo/ui"
2
+
3
+ export default function HomePage() {
4
+ return (
5
+ <>
6
+ <Hero
7
+ name="{{SITE_TITLE}}"
8
+ text="Documentation Made Simple"
9
+ tagline="Focus on your content, not configuration"
10
+ actions={[
11
+ { text: "Get Started", link: "/guide/getting-started", theme: "brand" },
12
+ { text: "GitHub", link: "https://github.com", theme: "alt" },
13
+ ]}
14
+ />
15
+ <Features
16
+ items={[
17
+ {
18
+ title: "Fast",
19
+ icon: "⚡",
20
+ details: "Lightning fast builds with Vite",
21
+ },
22
+ {
23
+ title: "Simple",
24
+ icon: "✨",
25
+ details: "Easy to set up and use",
26
+ },
27
+ {
28
+ title: "Flexible",
29
+ icon: "🎨",
30
+ details: "Fully customizable theme",
31
+ },
32
+ ]}
33
+ />
34
+ </>
35
+ )
36
+ }
@@ -0,0 +1,6 @@
1
+ import { type RouteConfig, index, route } from "@react-router/dev/routes"
2
+
3
+ export default [
4
+ index("routes/home.tsx"),
5
+ route("guide/getting-started", "routes/guide/getting-started.mdx"),
6
+ ] satisfies RouteConfig
@@ -0,0 +1,13 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module "virtual:ardo/config" {
4
+ import type { PressConfig } from "ardo"
5
+ const config: PressConfig
6
+ export default config
7
+ }
8
+
9
+ declare module "virtual:ardo/sidebar" {
10
+ import type { SidebarItem } from "ardo"
11
+ const sidebar: SidebarItem[]
12
+ export default sidebar
13
+ }
@@ -4,18 +4,19 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
7
- "dev": "vite",
8
- "build": "vite build",
7
+ "dev": "react-router dev",
8
+ "build": "react-router build",
9
9
  "preview": "vite preview"
10
10
  },
11
11
  "dependencies": {
12
- "@tanstack/react-router": "*",
13
- "@tanstack/react-start": "*",
14
- "ardo": "^1.1.1",
12
+ "ardo": "^1.2.0",
13
+ "isbot": "*",
15
14
  "react": "*",
16
- "react-dom": "*"
15
+ "react-dom": "*",
16
+ "react-router": "*"
17
17
  },
18
18
  "devDependencies": {
19
+ "@react-router/dev": "*",
19
20
  "@types/react": "^19.2.10",
20
21
  "@types/react-dom": "^19.2.3",
21
22
  "typescript": "^5.9.3",
@@ -0,0 +1,6 @@
1
+ import type { Config } from "@react-router/dev/config"
2
+
3
+ export default {
4
+ ssr: false,
5
+ prerender: true,
6
+ } satisfies Config
@@ -13,6 +13,6 @@
13
13
  "forceConsistentCasingInFileNames": true,
14
14
  "jsx": "react-jsx"
15
15
  },
16
- "include": ["src/**/*", "*.ts", "*.config.ts"],
17
- "exclude": ["node_modules", "dist"]
16
+ "include": ["app/**/*", "*.ts", "*.config.ts"],
17
+ "exclude": ["node_modules", "build"]
18
18
  }
@@ -1,18 +0,0 @@
1
- ---
2
- title: Welcome
3
- hero:
4
- name: '{{SITE_TITLE}}'
5
- text: Documentation Made Simple
6
- tagline: Focus on your content, not configuration
7
- actions:
8
- - text: Get Started
9
- link: /guide/getting-started
10
- theme: brand
11
- features:
12
- - title: Zero Config
13
- details: Just write markdown. No framework knowledge required.
14
- - title: Fast
15
- details: Powered by Vite and React 19.
16
- - title: Beautiful
17
- details: Clean design out of the box.
18
- ---
@@ -1,18 +0,0 @@
1
- import { createRouter } from '@tanstack/react-router'
2
- import { routeTree } from './routeTree.gen'
3
-
4
- export function getRouter() {
5
- return createRouter({
6
- routeTree,
7
- scrollRestoration: true,
8
- defaultPreloadStaleTime: 0,
9
- })
10
- }
11
-
12
- export type AppRouter = ReturnType<typeof getRouter>
13
-
14
- declare module '@tanstack/react-router' {
15
- interface Register {
16
- router: AppRouter
17
- }
18
- }
@@ -1,34 +0,0 @@
1
- import { createRootRoute, HeadContent, Outlet, Scripts } from '@tanstack/react-router'
2
- import config from 'virtual:ardo/config'
3
- import 'ardo/theme/styles.css'
4
-
5
- export const Route = createRootRoute({
6
- head: () => ({
7
- meta: [
8
- { charSet: 'utf-8' },
9
- { name: 'viewport', content: 'width=device-width, initial-scale=1' },
10
- { title: config.title },
11
- { name: 'description', content: config.description },
12
- ],
13
- }),
14
- component: RootComponent,
15
- shellComponent: RootDocument,
16
- })
17
-
18
- function RootComponent() {
19
- return <Outlet />
20
- }
21
-
22
- function RootDocument({ children }: { children: React.ReactNode }) {
23
- return (
24
- <html lang="en" suppressHydrationWarning>
25
- <head>
26
- <HeadContent />
27
- </head>
28
- <body suppressHydrationWarning>
29
- {children}
30
- <Scripts />
31
- </body>
32
- </html>
33
- )
34
- }
@@ -1,19 +0,0 @@
1
- import { createFileRoute, Outlet } from '@tanstack/react-router'
2
- import { Layout } from 'ardo/theme'
3
- import { PressProvider } from 'ardo/runtime'
4
- import config from 'virtual:ardo/config'
5
- import sidebar from 'virtual:ardo/sidebar'
6
-
7
- export const Route = createFileRoute('/guide/_layout')({
8
- component: GuideLayoutComponent,
9
- })
10
-
11
- function GuideLayoutComponent() {
12
- return (
13
- <PressProvider config={config} sidebar={sidebar}>
14
- <Layout>
15
- <Outlet />
16
- </Layout>
17
- </PressProvider>
18
- )
19
- }
@@ -1,40 +0,0 @@
1
- import { createFileRoute } from '@tanstack/react-router'
2
- import { HomePage } from 'ardo/theme'
3
- import { PressProvider } from 'ardo/runtime'
4
- import config from 'virtual:ardo/config'
5
- import sidebar from 'virtual:ardo/sidebar'
6
- import { frontmatter, toc } from '../../content/index.md'
7
-
8
- export const Route = createFileRoute('/')({
9
- head: () => ({
10
- meta: [
11
- {
12
- title: (frontmatter.title as string)
13
- ? `${frontmatter.title} | ${config.title}`
14
- : config.title,
15
- },
16
- ...(frontmatter.description
17
- ? [{ name: 'description', content: frontmatter.description as string }]
18
- : []),
19
- ],
20
- }),
21
- component: HomeComponent,
22
- })
23
-
24
- function HomeComponent() {
25
- const pageData = {
26
- title: (frontmatter.title as string) || 'Home',
27
- description: frontmatter.description as string | undefined,
28
- frontmatter,
29
- content: '',
30
- toc,
31
- filePath: 'index.md',
32
- relativePath: 'index.md',
33
- }
34
-
35
- return (
36
- <PressProvider config={config} sidebar={sidebar} currentPage={pageData}>
37
- <HomePage />
38
- </PressProvider>
39
- )
40
- }
@@ -1,23 +0,0 @@
1
- /// <reference types="vite/client" />
2
-
3
- declare module 'virtual:ardo/config' {
4
- import type { PressConfig } from 'ardo'
5
- const config: PressConfig
6
- export default config
7
- }
8
-
9
- declare module 'virtual:ardo/sidebar' {
10
- import type { SidebarItem } from 'ardo'
11
- const sidebar: SidebarItem[]
12
- export default sidebar
13
- }
14
-
15
- declare module '*.md' {
16
- import type { ComponentType } from 'react'
17
- import type { PageFrontmatter, TOCItem } from 'ardo'
18
-
19
- export const frontmatter: PageFrontmatter
20
- export const toc: TOCItem[]
21
- const component: ComponentType
22
- export default component
23
- }