create-thexjs-app 0.1.0 → 0.1.2
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/README.md +6 -4
- package/dist/index.js +23 -2
- package/package.json +36 -1
- package/templates/default/components.json +19 -0
- package/templates/default/src/layouts/main.tsx +28 -0
- package/templates/default/src/pages/index.tsx +66 -0
- package/templates/default/src/styles/globals.css +55 -0
- package/templates/default/src/x-routes.ts +17 -0
- package/templates/default/tsconfig.json +5 -0
- package/templates/default/x.config.ts +6 -0
- package/templates/landing/src/pages/docs/_layout.tsx +62 -44
- package/templates/landing/src/pages/docs/getting-started.tsx +19 -9
- package/templates/landing/src/pages/docs/index.tsx +86 -22
- package/templates/landing/src/pages/docs/installation.tsx +147 -0
- package/templates/landing/src/pages/docs/introduction.tsx +117 -0
- package/templates/landing/src/pages/docs/packages/cli.tsx +130 -0
- package/templates/landing/src/pages/docs/packages/core.tsx +172 -0
- package/templates/landing/src/pages/docs/packages/env.tsx +128 -0
- package/templates/landing/src/pages/index.tsx +51 -32
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="#">
|
|
3
|
-
<img src="
|
|
3
|
+
<img src="https://github.com/abdelkabirouadoukou/x/raw/main/examples/landing/public/favicon.ico" alt="x framework logo" width="120" height="120">
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
@@ -48,14 +48,16 @@ Create a new x project, learn the project structure, and build your first page.
|
|
|
48
48
|
|
|
49
49
|
### Installation
|
|
50
50
|
|
|
51
|
-
The fastest way to start is with the
|
|
51
|
+
The fastest way to start is with the project scaffolder. Make sure you have [Bun](https://bun.sh) installed, then run:
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
bun create
|
|
54
|
+
bun create thexjs-app@latest my-app
|
|
55
55
|
cd my-app
|
|
56
|
-
|
|
56
|
+
bun run dev
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
When prompted for a template, press Enter to accept **default** (recommended) — a single home page to start from.
|
|
60
|
+
|
|
59
61
|
Your app will be running at `http://localhost:3000`.
|
|
60
62
|
|
|
61
63
|
### Manual setup
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,24 @@ import { dirname, join, resolve } from "path";
|
|
|
8
8
|
import { fileURLToPath } from "url";
|
|
9
9
|
|
|
10
10
|
// src/templates.ts
|
|
11
|
+
var DEFAULT_TEMPLATE = "default";
|
|
11
12
|
var TEMPLATES = {
|
|
13
|
+
default: {
|
|
14
|
+
label: "Default",
|
|
15
|
+
description: "Blank slate with a single home page \u2014 the fastest way to start.",
|
|
16
|
+
recommended: true,
|
|
17
|
+
dependencies: {
|
|
18
|
+
react: "^19.1.0",
|
|
19
|
+
"react-dom": "^19.1.0"
|
|
20
|
+
},
|
|
21
|
+
devDependencies: {
|
|
22
|
+
"@tailwindcss/cli": "^4.3.3",
|
|
23
|
+
"@types/react": "^19.1.0",
|
|
24
|
+
"@types/react-dom": "^19.1.0",
|
|
25
|
+
tailwindcss: "^4.3.3",
|
|
26
|
+
typescript: "^5.8.0"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
12
29
|
basic: {
|
|
13
30
|
label: "Basic",
|
|
14
31
|
description: "Minimal starter: pages, an API route, auth, and a dashboard.",
|
|
@@ -137,7 +154,8 @@ function printBanner() {
|
|
|
137
154
|
function printTemplateList() {
|
|
138
155
|
for (const name of TEMPLATE_NAMES) {
|
|
139
156
|
const meta = TEMPLATES[name];
|
|
140
|
-
|
|
157
|
+
const tag = meta.recommended ? " (recommended)" : "";
|
|
158
|
+
console.log(` ${name.padEnd(8)} ${meta.description}${tag}`);
|
|
141
159
|
}
|
|
142
160
|
}
|
|
143
161
|
async function main() {
|
|
@@ -161,7 +179,10 @@ async function main() {
|
|
|
161
179
|
console.log("\n Available templates:\n");
|
|
162
180
|
printTemplateList();
|
|
163
181
|
console.log("");
|
|
164
|
-
templateArg = await prompt(
|
|
182
|
+
templateArg = await prompt(
|
|
183
|
+
`Choose a template (${TEMPLATE_NAMES.join("/")})`,
|
|
184
|
+
DEFAULT_TEMPLATE
|
|
185
|
+
);
|
|
165
186
|
}
|
|
166
187
|
if (!TEMPLATES[templateArg]) {
|
|
167
188
|
console.error(`
|
package/package.json
CHANGED
|
@@ -1,7 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-thexjs-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Scaffold a new x framework app (npm create thexjs-app@latest).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"bun",
|
|
8
|
+
"bunjs",
|
|
9
|
+
"framework",
|
|
10
|
+
"fullstack",
|
|
11
|
+
"full-stack",
|
|
12
|
+
"meta-framework",
|
|
13
|
+
"ssr",
|
|
14
|
+
"ssg",
|
|
15
|
+
"static-site-generator",
|
|
16
|
+
"islands-architecture",
|
|
17
|
+
"selective-hydration",
|
|
18
|
+
"create-app",
|
|
19
|
+
"cli",
|
|
20
|
+
"scaffold",
|
|
21
|
+
"starter",
|
|
22
|
+
"generator",
|
|
23
|
+
"template",
|
|
24
|
+
"thexjs",
|
|
25
|
+
"x-framework",
|
|
26
|
+
"typescript",
|
|
27
|
+
"file-based-routing",
|
|
28
|
+
"server-functions",
|
|
29
|
+
"server-actions",
|
|
30
|
+
"api-routes",
|
|
31
|
+
"loaders",
|
|
32
|
+
"middleware",
|
|
33
|
+
"content-collections",
|
|
34
|
+
"markdown",
|
|
35
|
+
"sqlite",
|
|
36
|
+
"postgres",
|
|
37
|
+
"zero-config",
|
|
38
|
+
"ultra-fast"
|
|
39
|
+
],
|
|
5
40
|
"license": "MIT",
|
|
6
41
|
"type": "module",
|
|
7
42
|
"bin": {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "base-nova",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/styles/globals.css",
|
|
9
|
+
"baseColor": "neutral",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"aliases": {
|
|
14
|
+
"components": "@/components",
|
|
15
|
+
"utils": "@/lib/utils",
|
|
16
|
+
"lib": "@/lib"
|
|
17
|
+
},
|
|
18
|
+
"iconLibrary": "lucide"
|
|
19
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export default function MainLayout({ children }: { children: ReactNode }) {
|
|
4
|
+
return (
|
|
5
|
+
<div className="relative flex min-h-screen flex-col overflow-hidden bg-background">
|
|
6
|
+
<div
|
|
7
|
+
className="pointer-events-none absolute inset-0 opacity-[0.35]"
|
|
8
|
+
style={{
|
|
9
|
+
backgroundImage:
|
|
10
|
+
"linear-gradient(to right, #1c2433 1px, transparent 1px), linear-gradient(to bottom, #1c2433 1px, transparent 1px)",
|
|
11
|
+
backgroundSize: "48px 48px",
|
|
12
|
+
maskImage: "radial-gradient(ellipse 70% 60% at 50% 40%, black 20%, transparent 100%)",
|
|
13
|
+
}}
|
|
14
|
+
/>
|
|
15
|
+
<header className="relative z-10 flex h-16 items-center px-6 sm:px-10">
|
|
16
|
+
<a href="/" className="group flex items-center gap-2.5" aria-label="Home">
|
|
17
|
+
<span className="flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-surface">
|
|
18
|
+
<svg viewBox="0 0 24 24" className="h-4 w-4 text-primary" fill="none">
|
|
19
|
+
<polygon points="3,5 5,3 21,19 19,21" fill="currentColor" />
|
|
20
|
+
<polygon points="19,5 21,3 5,21 3,19" fill="currentColor" opacity="0.45" />
|
|
21
|
+
</svg>
|
|
22
|
+
</span>
|
|
23
|
+
</a>
|
|
24
|
+
</header>
|
|
25
|
+
<main className="relative z-10 flex flex-1 flex-col">{children}</main>
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { RouteProps } from "@thexjs/core";
|
|
2
|
+
|
|
3
|
+
export const mode = "static";
|
|
4
|
+
|
|
5
|
+
export default function HomePage({}: RouteProps) {
|
|
6
|
+
return (
|
|
7
|
+
<div className="flex flex-1 flex-col items-center justify-center px-6 pb-20 pt-8 sm:px-10">
|
|
8
|
+
<div className="mb-10 flex w-full max-w-md items-center gap-3 rounded-xl border border-border bg-surface/80 px-4 py-3 font-mono text-xs backdrop-blur-sm sm:text-sm">
|
|
9
|
+
<span className="shrink-0 text-muted-foreground">src/pages/</span>
|
|
10
|
+
<span className="text-primary">index.tsx</span>
|
|
11
|
+
<span className="route-line mx-1 h-px flex-1 animate-route-pulse bg-gradient-to-r from-transparent via-primary to-transparent" />
|
|
12
|
+
<span className="shrink-0 rounded-md bg-primary/10 px-2 py-0.5 font-semibold text-primary">
|
|
13
|
+
/
|
|
14
|
+
</span>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div className="max-w-2xl text-center">
|
|
18
|
+
<p className="font-mono text-[11px] uppercase tracking-[0.28em] text-primary/90">
|
|
19
|
+
Your app is running
|
|
20
|
+
</p>
|
|
21
|
+
<h1 className="font-display mt-5 text-[clamp(2.5rem,8vw,4.5rem)] font-extrabold leading-[0.95] tracking-tight">
|
|
22
|
+
Start
|
|
23
|
+
<span className="text-primary"> here.</span>
|
|
24
|
+
</h1>
|
|
25
|
+
<p className="mx-auto mt-6 max-w-lg text-base leading-relaxed text-muted-foreground sm:text-lg">
|
|
26
|
+
This is your home page — the only route in the default template. Edit{" "}
|
|
27
|
+
<code className="rounded bg-muted px-1.5 py-0.5 font-mono text-sm text-foreground">
|
|
28
|
+
src/pages/index.tsx
|
|
29
|
+
</code>{" "}
|
|
30
|
+
and save. The dev server reloads instantly.
|
|
31
|
+
</p>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<div className="mt-14 w-full max-w-lg overflow-hidden rounded-2xl border border-border bg-surface shadow-[0_24px_80px_-24px_rgba(240,160,48,0.15)]">
|
|
35
|
+
<div className="flex items-center gap-2 border-b border-border px-4 py-3">
|
|
36
|
+
<span className="h-2.5 w-2.5 rounded-full bg-[#ff5f57]" />
|
|
37
|
+
<span className="h-2.5 w-2.5 rounded-full bg-[#febc2e]" />
|
|
38
|
+
<span className="h-2.5 w-2.5 rounded-full bg-[#28c840]" />
|
|
39
|
+
<span className="ml-2 font-mono text-[10px] text-muted-foreground">terminal</span>
|
|
40
|
+
</div>
|
|
41
|
+
<pre className="overflow-x-auto p-5 font-mono text-[13px] leading-relaxed text-muted-foreground">
|
|
42
|
+
<span className="text-foreground">$</span> bun run dev{"\n"}
|
|
43
|
+
<span className="text-primary/80">→</span> dev server at{" "}
|
|
44
|
+
<span className="text-foreground">http://localhost:3000</span>
|
|
45
|
+
</pre>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div className="mt-10 flex flex-wrap items-center justify-center gap-4">
|
|
49
|
+
<a
|
|
50
|
+
href="https://thexjs.vercel.app/docs"
|
|
51
|
+
className="inline-flex h-11 items-center rounded-xl bg-primary px-5 text-sm font-semibold text-primary-foreground transition-transform hover:scale-[1.02] active:scale-[0.98]"
|
|
52
|
+
>
|
|
53
|
+
Read the docs
|
|
54
|
+
</a>
|
|
55
|
+
<a
|
|
56
|
+
href="https://github.com/abdelkabirouadoukou/x"
|
|
57
|
+
target="_blank"
|
|
58
|
+
rel="noopener noreferrer"
|
|
59
|
+
className="inline-flex h-11 items-center rounded-xl border border-border px-5 text-sm font-medium text-foreground transition-colors hover:bg-muted"
|
|
60
|
+
>
|
|
61
|
+
View on GitHub
|
|
62
|
+
</a>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600&family=JetBrains+Mono:wght@400;500&family=Syne:wght@600;700;800&display=swap");
|
|
2
|
+
|
|
3
|
+
@import "tailwindcss";
|
|
4
|
+
|
|
5
|
+
@theme inline {
|
|
6
|
+
--font-display: "Syne", ui-sans-serif, system-ui, sans-serif;
|
|
7
|
+
--font-sans: "DM Sans", ui-sans-serif, system-ui, sans-serif;
|
|
8
|
+
--font-mono: "JetBrains Mono", ui-monospace, monospace;
|
|
9
|
+
--color-background: var(--background);
|
|
10
|
+
--color-foreground: var(--foreground);
|
|
11
|
+
--color-muted: var(--muted);
|
|
12
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
13
|
+
--color-primary: var(--primary);
|
|
14
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
15
|
+
--color-border: var(--border);
|
|
16
|
+
--color-surface: var(--surface);
|
|
17
|
+
--animate-route-pulse: route-pulse 2.4s ease-in-out infinite;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:root {
|
|
21
|
+
--background: #070a10;
|
|
22
|
+
--foreground: #e6eaf2;
|
|
23
|
+
--muted: #121824;
|
|
24
|
+
--muted-foreground: #7b879c;
|
|
25
|
+
--primary: oklch(0.72 0.18 35);
|
|
26
|
+
--primary-foreground: #0a0d14;
|
|
27
|
+
--border: #1c2433;
|
|
28
|
+
--surface: #0d111a;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@layer base {
|
|
32
|
+
* {
|
|
33
|
+
@apply border-border;
|
|
34
|
+
}
|
|
35
|
+
body {
|
|
36
|
+
@apply bg-background text-foreground font-sans antialiased;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@keyframes route-pulse {
|
|
41
|
+
0%,
|
|
42
|
+
100% {
|
|
43
|
+
opacity: 0.35;
|
|
44
|
+
}
|
|
45
|
+
50% {
|
|
46
|
+
opacity: 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@media (prefers-reduced-motion: reduce) {
|
|
51
|
+
.route-line {
|
|
52
|
+
animation: none !important;
|
|
53
|
+
opacity: 0.7;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Auto-generated by @thexjs/core -- do not edit
|
|
2
|
+
export type RouteMap = {
|
|
3
|
+
"/": Record<string, never>;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
export function href<T extends keyof RouteMap & string>(
|
|
7
|
+
path: T,
|
|
8
|
+
...[params]: RouteMap[T] extends Record<string, never> ? [] : [RouteMap[T]]
|
|
9
|
+
): string {
|
|
10
|
+
if (!params) return path;
|
|
11
|
+
let result: string = path;
|
|
12
|
+
for (const [key, value] of Object.entries(params)) {
|
|
13
|
+
result = result.replace(new RegExp(`:${key}(?=/|$)`), encodeURIComponent(String(value)));
|
|
14
|
+
}
|
|
15
|
+
result = result.replace(/\*+$/, "");
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
@@ -1,21 +1,67 @@
|
|
|
1
1
|
import { Menu, X } from "lucide-react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
|
|
4
|
-
const
|
|
5
|
-
{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
{
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
const sidebarSections = [
|
|
5
|
+
{
|
|
6
|
+
title: "Start here",
|
|
7
|
+
links: [
|
|
8
|
+
{ href: "/docs", label: "Overview" },
|
|
9
|
+
{ href: "/docs/introduction", label: "Introduction" },
|
|
10
|
+
{ href: "/docs/installation", label: "Installation" },
|
|
11
|
+
{ href: "/docs/getting-started", label: "Getting Started" },
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
title: "Packages",
|
|
16
|
+
links: [
|
|
17
|
+
{ href: "/docs/packages/core", label: "@thexjs/core" },
|
|
18
|
+
{ href: "/docs/packages/cli", label: "@thexjs/cli" },
|
|
19
|
+
{ href: "/docs/packages/env", label: "@thexjs/env" },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: "Guides",
|
|
24
|
+
links: [
|
|
25
|
+
{ href: "/docs/routing", label: "Routing" },
|
|
26
|
+
{ href: "/docs/pages", label: "Pages & Loaders" },
|
|
27
|
+
{ href: "/docs/layouts", label: "Layouts" },
|
|
28
|
+
{ href: "/docs/api-routes", label: "API Routes" },
|
|
29
|
+
{ href: "/docs/server-functions", label: "Server Functions" },
|
|
30
|
+
{ href: "/docs/content-collections", label: "Content Collections" },
|
|
31
|
+
{ href: "/docs/middleware", label: "Middleware" },
|
|
32
|
+
{ href: "/docs/data-layer", label: "Data Layer" },
|
|
33
|
+
{ href: "/docs/build-deploy", label: "Build & Deploy" },
|
|
34
|
+
{ href: "/docs/configuration", label: "Configuration" },
|
|
35
|
+
],
|
|
36
|
+
},
|
|
17
37
|
];
|
|
18
38
|
|
|
39
|
+
function SidebarNav() {
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
{sidebarSections.map((section) => (
|
|
43
|
+
<div key={section.title} className="mb-6 last:mb-0">
|
|
44
|
+
<p className="mb-3 text-[10px] font-semibold uppercase tracking-[0.15em] text-muted-foreground">
|
|
45
|
+
{section.title}
|
|
46
|
+
</p>
|
|
47
|
+
<ul className="space-y-1">
|
|
48
|
+
{section.links.map((link) => (
|
|
49
|
+
<li key={link.href}>
|
|
50
|
+
<a
|
|
51
|
+
href={link.href}
|
|
52
|
+
className="block rounded-lg px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
|
53
|
+
>
|
|
54
|
+
{link.label}
|
|
55
|
+
</a>
|
|
56
|
+
</li>
|
|
57
|
+
))}
|
|
58
|
+
</ul>
|
|
59
|
+
</div>
|
|
60
|
+
))}
|
|
61
|
+
</>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
19
65
|
export default function DocsLayout({ children }: { children: ReactNode }) {
|
|
20
66
|
return (
|
|
21
67
|
<div className="mx-auto flex min-h-[calc(100vh-4rem)] w-full max-w-6xl px-6">
|
|
@@ -35,42 +81,14 @@ export default function DocsLayout({ children }: { children: ReactNode }) {
|
|
|
35
81
|
id="sidebar-panel"
|
|
36
82
|
className="fixed left-0 top-16 z-50 hidden h-[calc(100vh-4rem)] w-56 overflow-y-auto border-r border-border/40 bg-background lg:hidden"
|
|
37
83
|
>
|
|
38
|
-
<nav className="px-4 pb-4 pt-
|
|
39
|
-
<
|
|
40
|
-
Docs
|
|
41
|
-
</p>
|
|
42
|
-
<ul className="space-y-1">
|
|
43
|
-
{sidebarLinks.map((link) => (
|
|
44
|
-
<li key={link.href}>
|
|
45
|
-
<a
|
|
46
|
-
href={link.href}
|
|
47
|
-
className="block rounded-lg px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
|
48
|
-
>
|
|
49
|
-
{link.label}
|
|
50
|
-
</a>
|
|
51
|
-
</li>
|
|
52
|
-
))}
|
|
53
|
-
</ul>
|
|
84
|
+
<nav className="px-4 pb-4 pt-3">
|
|
85
|
+
<SidebarNav />
|
|
54
86
|
</nav>
|
|
55
87
|
</aside>
|
|
56
88
|
|
|
57
89
|
<aside className="hidden w-56 shrink-0 border-r border-border/40 lg:block">
|
|
58
90
|
<nav className="sticky top-16 px-4 pb-4 pt-0">
|
|
59
|
-
<
|
|
60
|
-
Docs
|
|
61
|
-
</p>
|
|
62
|
-
<ul className="space-y-1">
|
|
63
|
-
{sidebarLinks.map((link) => (
|
|
64
|
-
<li key={link.href}>
|
|
65
|
-
<a
|
|
66
|
-
href={link.href}
|
|
67
|
-
className="block rounded-lg px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted hover:text-foreground"
|
|
68
|
-
>
|
|
69
|
-
{link.label}
|
|
70
|
-
</a>
|
|
71
|
-
</li>
|
|
72
|
-
))}
|
|
73
|
-
</ul>
|
|
91
|
+
<SidebarNav />
|
|
74
92
|
</nav>
|
|
75
93
|
</aside>
|
|
76
94
|
<div className="min-w-0 flex-1">
|
|
@@ -2,6 +2,8 @@ import type { RouteProps } from "@thexjs/core";
|
|
|
2
2
|
import { ArrowRight } from "lucide-react";
|
|
3
3
|
import { CodeBlock } from "../../components/code-block";
|
|
4
4
|
|
|
5
|
+
export const mode = "static";
|
|
6
|
+
|
|
5
7
|
export default function DocPage({}: RouteProps) {
|
|
6
8
|
return (
|
|
7
9
|
<div>
|
|
@@ -13,23 +15,25 @@ export default function DocPage({}: RouteProps) {
|
|
|
13
15
|
Create a new x project, learn the project structure, and build your first page.
|
|
14
16
|
</p>
|
|
15
17
|
|
|
16
|
-
<h2 className="mt-12 text-xl font-bold tracking-tight">
|
|
18
|
+
<h2 className="mt-12 text-xl font-bold tracking-tight">Create a project</h2>
|
|
17
19
|
<p className="mt-3 text-muted-foreground">
|
|
18
|
-
The fastest way to start is with the
|
|
19
|
-
<a href="
|
|
20
|
-
|
|
20
|
+
The fastest way to start is with the project scaffolder. See{" "}
|
|
21
|
+
<a href="/docs/installation" className="text-primary underline underline-offset-2">
|
|
22
|
+
Installation
|
|
21
23
|
</a>{" "}
|
|
22
|
-
|
|
24
|
+
for prerequisites and template options. Quick version:
|
|
23
25
|
</p>
|
|
24
26
|
<CodeBlock
|
|
25
27
|
label="terminal"
|
|
26
28
|
lang="bash"
|
|
27
|
-
code={`bun create
|
|
29
|
+
code={`bun create thexjs-app@latest my-app
|
|
28
30
|
cd my-app
|
|
29
|
-
|
|
31
|
+
bun run dev`}
|
|
30
32
|
/>
|
|
31
33
|
<p className="mt-4 text-muted-foreground">
|
|
32
|
-
|
|
34
|
+
Press Enter at the template prompt to use{" "}
|
|
35
|
+
<span className="text-foreground">default</span> (recommended) — a single home page. Your
|
|
36
|
+
app will be running at <span className="text-foreground">http://localhost:3000</span>.
|
|
33
37
|
</p>
|
|
34
38
|
|
|
35
39
|
<h2 className="mt-12 text-xl font-bold tracking-tight">Manual setup</h2>
|
|
@@ -106,7 +110,13 @@ EOF`}
|
|
|
106
110
|
automatically reloads when files change.
|
|
107
111
|
</p>
|
|
108
112
|
|
|
109
|
-
<div className="mt-16 border-t border-border pt-8">
|
|
113
|
+
<div className="mt-16 flex flex-wrap gap-6 border-t border-border pt-8">
|
|
114
|
+
<a
|
|
115
|
+
href="/docs/routing"
|
|
116
|
+
className="inline-flex items-center gap-1 text-sm font-medium text-primary transition-colors hover:text-primary/80"
|
|
117
|
+
>
|
|
118
|
+
Routing <ArrowRight className="h-3.5 w-3.5" />
|
|
119
|
+
</a>
|
|
110
120
|
<a
|
|
111
121
|
href="/docs"
|
|
112
122
|
className="inline-flex items-center gap-1 text-sm text-muted-foreground transition-colors hover:text-foreground"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ArrowRight,
|
|
3
3
|
BookOpen,
|
|
4
|
+
Box,
|
|
4
5
|
Code2,
|
|
5
6
|
Cog,
|
|
6
7
|
Database,
|
|
@@ -8,18 +9,56 @@ import {
|
|
|
8
9
|
Globe,
|
|
9
10
|
Layers,
|
|
10
11
|
Layout,
|
|
12
|
+
Package,
|
|
11
13
|
Rocket,
|
|
12
14
|
Shield,
|
|
15
|
+
Terminal,
|
|
13
16
|
Zap,
|
|
14
17
|
} from "lucide-react";
|
|
15
18
|
|
|
16
|
-
const
|
|
19
|
+
const startSections = [
|
|
17
20
|
{
|
|
18
21
|
icon: BookOpen,
|
|
22
|
+
title: "Introduction",
|
|
23
|
+
desc: "What x is, how the packages fit together, and a minimal page.",
|
|
24
|
+
href: "/docs/introduction",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
icon: Terminal,
|
|
28
|
+
title: "Installation",
|
|
29
|
+
desc: "Prerequisites, create command, templates, and manual setup.",
|
|
30
|
+
href: "/docs/installation",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
icon: Rocket,
|
|
19
34
|
title: "Getting Started",
|
|
20
|
-
desc: "
|
|
35
|
+
desc: "Project structure, your first page, and running the dev server.",
|
|
21
36
|
href: "/docs/getting-started",
|
|
22
37
|
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
const packageSections = [
|
|
41
|
+
{
|
|
42
|
+
icon: Package,
|
|
43
|
+
title: "@thexjs/core",
|
|
44
|
+
desc: "Rendering engine — routing, SSR/SSG, islands, server functions, data layer.",
|
|
45
|
+
href: "/docs/packages/core",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
icon: Terminal,
|
|
49
|
+
title: "@thexjs/cli",
|
|
50
|
+
desc: "The x command — dev, build, start, and deployment output.",
|
|
51
|
+
href: "/docs/packages/cli",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
icon: Box,
|
|
55
|
+
title: "@thexjs/env",
|
|
56
|
+
desc: "Type-safe environment variable validation with fail-fast errors.",
|
|
57
|
+
href: "/docs/packages/env",
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
const guideSections = [
|
|
23
62
|
{
|
|
24
63
|
icon: Globe,
|
|
25
64
|
title: "Routing",
|
|
@@ -82,6 +121,37 @@ const sections = [
|
|
|
82
121
|
},
|
|
83
122
|
];
|
|
84
123
|
|
|
124
|
+
function SectionGrid({
|
|
125
|
+
sections,
|
|
126
|
+
}: {
|
|
127
|
+
sections: typeof startSections;
|
|
128
|
+
}) {
|
|
129
|
+
return (
|
|
130
|
+
<div className="grid gap-4 sm:grid-cols-2">
|
|
131
|
+
{sections.map((s) => (
|
|
132
|
+
<a
|
|
133
|
+
key={s.title}
|
|
134
|
+
href={s.href}
|
|
135
|
+
className="group rounded-2xl border border-border bg-card p-6 transition-all hover:border-primary/30 hover:shadow-lg hover:shadow-primary/5"
|
|
136
|
+
>
|
|
137
|
+
<div className="flex h-10 w-10 items-center justify-center rounded-xl bg-primary/10 text-primary transition-colors group-hover:bg-primary/20">
|
|
138
|
+
<s.icon className="h-5 w-5" />
|
|
139
|
+
</div>
|
|
140
|
+
<h3 className="mt-4 text-lg font-semibold transition-colors group-hover:text-primary">
|
|
141
|
+
{s.title}
|
|
142
|
+
</h3>
|
|
143
|
+
<p className="mt-1 text-sm text-muted-foreground">{s.desc}</p>
|
|
144
|
+
<span className="mt-3 inline-flex items-center gap-1 text-xs font-medium text-primary opacity-0 transition-opacity group-hover:opacity-100">
|
|
145
|
+
Read more <ArrowRight className="h-3 w-3" />
|
|
146
|
+
</span>
|
|
147
|
+
</a>
|
|
148
|
+
))}
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export const mode = "static";
|
|
154
|
+
|
|
85
155
|
export default function DocsHubPage() {
|
|
86
156
|
return (
|
|
87
157
|
<div className="py-12">
|
|
@@ -98,26 +168,20 @@ export default function DocsHubPage() {
|
|
|
98
168
|
</p>
|
|
99
169
|
</div>
|
|
100
170
|
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<span className="mt-3 inline-flex items-center gap-1 text-xs font-medium text-primary opacity-0 transition-opacity group-hover:opacity-100">
|
|
116
|
-
Read more <ArrowRight className="h-3 w-3" />
|
|
117
|
-
</span>
|
|
118
|
-
</a>
|
|
119
|
-
))}
|
|
120
|
-
</div>
|
|
171
|
+
<h2 className="mb-4 text-sm font-semibold uppercase tracking-[0.15em] text-muted-foreground">
|
|
172
|
+
Start here
|
|
173
|
+
</h2>
|
|
174
|
+
<SectionGrid sections={startSections} />
|
|
175
|
+
|
|
176
|
+
<h2 className="mb-4 mt-12 text-sm font-semibold uppercase tracking-[0.15em] text-muted-foreground">
|
|
177
|
+
Packages
|
|
178
|
+
</h2>
|
|
179
|
+
<SectionGrid sections={packageSections} />
|
|
180
|
+
|
|
181
|
+
<h2 className="mb-4 mt-12 text-sm font-semibold uppercase tracking-[0.15em] text-muted-foreground">
|
|
182
|
+
Guides
|
|
183
|
+
</h2>
|
|
184
|
+
<SectionGrid sections={guideSections} />
|
|
121
185
|
</div>
|
|
122
186
|
);
|
|
123
187
|
}
|