create-thexjs-app 0.1.1 → 0.1.3
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/dist/index.js +42 -20
- package/package.json +3 -8
- package/templates/basic/src/components/Link.tsx +6 -12
- package/templates/basic/src/pages/placeholder.tsx +2 -1
- package/templates/default/src/layouts/main.tsx +0 -3
- package/templates/default/src/pages/index.tsx +2 -2
- package/templates/default/src/styles/globals.css +1 -1
- package/templates/landing/src/components/code-block.tsx +104 -10
- package/templates/landing/src/layouts/main.tsx +48 -18
- package/templates/landing/src/pages/docs/_layout.tsx +26 -14
- package/templates/landing/src/pages/docs/api-routes.tsx +1 -1
- package/templates/landing/src/pages/docs/build-deploy.tsx +1 -1
- package/templates/landing/src/pages/docs/configuration.tsx +1 -1
- package/templates/landing/src/pages/docs/content-collections.tsx +1 -1
- package/templates/landing/src/pages/docs/data-layer.tsx +1 -1
- package/templates/landing/src/pages/docs/getting-started.tsx +4 -4
- package/templates/landing/src/pages/docs/installation.tsx +16 -20
- package/templates/landing/src/pages/docs/introduction.tsx +8 -11
- package/templates/landing/src/pages/docs/layouts.tsx +1 -1
- package/templates/landing/src/pages/docs/middleware.tsx +1 -1
- package/templates/landing/src/pages/docs/packages/cli.tsx +10 -7
- package/templates/landing/src/pages/docs/packages/core.tsx +7 -3
- package/templates/landing/src/pages/docs/packages/env.tsx +3 -3
- package/templates/landing/src/pages/docs/pages.tsx +1 -1
- package/templates/landing/src/pages/docs/routing.tsx +1 -1
- package/templates/landing/src/pages/docs/server-functions.tsx +1 -1
- package/templates/landing/src/pages/index.tsx +91 -126
- package/templates/landing/src/styles/globals.css +81 -45
- package/templates/saas/src/pages/dashboard/settings.tsx +2 -2
package/dist/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { spawnSync } from "child_process";
|
|
5
|
-
import { existsSync, mkdirSync, readdirSync, writeFileSync
|
|
6
|
-
import { createInterface } from "readline/promises";
|
|
5
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, writeFileSync } from "fs";
|
|
7
6
|
import { dirname, join, resolve } from "path";
|
|
7
|
+
import { createInterface } from "readline/promises";
|
|
8
8
|
import { fileURLToPath } from "url";
|
|
9
9
|
|
|
10
10
|
// src/templates.ts
|
|
@@ -116,6 +116,35 @@ var TEMPLATES = {
|
|
|
116
116
|
};
|
|
117
117
|
var TEMPLATE_NAMES = Object.keys(TEMPLATES);
|
|
118
118
|
|
|
119
|
+
// src/terminal.ts
|
|
120
|
+
var reset = "\x1B[0m";
|
|
121
|
+
var muted = "\x1B[2m";
|
|
122
|
+
var bold = "\x1B[1m";
|
|
123
|
+
var amber = "\x1B[38;2;232;149;47m";
|
|
124
|
+
var cyan = "\x1B[38;2;61;214;198m";
|
|
125
|
+
var green = "\x1B[38;2;78;201;120m";
|
|
126
|
+
function banner() {
|
|
127
|
+
console.log("");
|
|
128
|
+
console.log(` ${amber}${bold}create-thexjs-app${reset}`);
|
|
129
|
+
console.log(` ${muted}Scaffold a new x project${reset}`);
|
|
130
|
+
console.log("");
|
|
131
|
+
}
|
|
132
|
+
function step(message) {
|
|
133
|
+
console.log(`${amber}\u2192${reset} ${message}`);
|
|
134
|
+
}
|
|
135
|
+
function success(message) {
|
|
136
|
+
console.log(`${green}\u2713${reset} ${message}`);
|
|
137
|
+
}
|
|
138
|
+
function command(cmd) {
|
|
139
|
+
console.log(` ${cyan}${cmd}${reset}`);
|
|
140
|
+
}
|
|
141
|
+
function dim(message) {
|
|
142
|
+
console.log(`${muted}${message}${reset}`);
|
|
143
|
+
}
|
|
144
|
+
function dimText(message) {
|
|
145
|
+
return `${muted}${message}${reset}`;
|
|
146
|
+
}
|
|
147
|
+
|
|
119
148
|
// src/index.ts
|
|
120
149
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
121
150
|
var TEMPLATES_ROOT = join(__dirname, "..", "templates");
|
|
@@ -146,15 +175,12 @@ async function prompt(question, fallback) {
|
|
|
146
175
|
return answer.trim() || fallback || "";
|
|
147
176
|
}
|
|
148
177
|
function printBanner() {
|
|
149
|
-
|
|
150
|
-
console.log(" create-thexjs-app");
|
|
151
|
-
console.log(" ------------------");
|
|
152
|
-
console.log("");
|
|
178
|
+
banner();
|
|
153
179
|
}
|
|
154
180
|
function printTemplateList() {
|
|
155
181
|
for (const name of TEMPLATE_NAMES) {
|
|
156
182
|
const meta = TEMPLATES[name];
|
|
157
|
-
const tag = meta.recommended ? " (recommended)" : "";
|
|
183
|
+
const tag = meta.recommended ? dimText(" (recommended)") : "";
|
|
158
184
|
console.log(` ${name.padEnd(8)} ${meta.description}${tag}`);
|
|
159
185
|
}
|
|
160
186
|
}
|
|
@@ -179,10 +205,7 @@ async function main() {
|
|
|
179
205
|
console.log("\n Available templates:\n");
|
|
180
206
|
printTemplateList();
|
|
181
207
|
console.log("");
|
|
182
|
-
templateArg = await prompt(
|
|
183
|
-
`Choose a template (${TEMPLATE_NAMES.join("/")})`,
|
|
184
|
-
DEFAULT_TEMPLATE
|
|
185
|
-
);
|
|
208
|
+
templateArg = await prompt(`Choose a template (${TEMPLATE_NAMES.join("/")})`, DEFAULT_TEMPLATE);
|
|
186
209
|
}
|
|
187
210
|
if (!TEMPLATES[templateArg]) {
|
|
188
211
|
console.error(`
|
|
@@ -191,11 +214,10 @@ async function main() {
|
|
|
191
214
|
}
|
|
192
215
|
const meta = TEMPLATES[templateArg];
|
|
193
216
|
const templateDir = join(TEMPLATES_ROOT, templateArg);
|
|
194
|
-
|
|
195
|
-
[create-thexjs-app] Scaffolding "${slug}" from the "${templateArg}" template...`);
|
|
217
|
+
step(`Scaffolding "${slug}" from the "${templateArg}" template...`);
|
|
196
218
|
mkdirSync(targetDir, { recursive: true });
|
|
197
219
|
cpSync(templateDir, targetDir, { recursive: true });
|
|
198
|
-
|
|
220
|
+
step("Resolving latest @thexjs package versions...");
|
|
199
221
|
const coreVersion = await fetchLatestVersion("@thexjs/core") ?? FALLBACK_CORE_VERSION;
|
|
200
222
|
const cliVersion = await fetchLatestVersion("@thexjs/cli") ?? FALLBACK_CORE_VERSION;
|
|
201
223
|
const pkgJson = {
|
|
@@ -218,10 +240,10 @@ async function main() {
|
|
|
218
240
|
};
|
|
219
241
|
writeFileSync(join(targetDir, "package.json"), `${JSON.stringify(pkgJson, null, 2)}
|
|
220
242
|
`);
|
|
221
|
-
|
|
243
|
+
success(`Created ${slug}/`);
|
|
222
244
|
const hasBun = spawnSync("bun", ["--version"], { stdio: "ignore" }).status === 0;
|
|
223
245
|
if (hasBun) {
|
|
224
|
-
|
|
246
|
+
step("Installing dependencies with bun install...");
|
|
225
247
|
const result = spawnSync("bun", ["install"], { cwd: targetDir, stdio: "inherit" });
|
|
226
248
|
if (result.status !== 0) {
|
|
227
249
|
console.warn("[create-thexjs-app] bun install failed \u2014 you can retry manually.");
|
|
@@ -232,11 +254,11 @@ async function main() {
|
|
|
232
254
|
);
|
|
233
255
|
}
|
|
234
256
|
console.log("");
|
|
235
|
-
|
|
257
|
+
dim("Done! Next steps:");
|
|
236
258
|
console.log("");
|
|
237
|
-
|
|
238
|
-
if (!hasBun)
|
|
239
|
-
|
|
259
|
+
command(`cd ${slug}`);
|
|
260
|
+
if (!hasBun) command("bun install");
|
|
261
|
+
command("bun run dev");
|
|
240
262
|
console.log("");
|
|
241
263
|
}
|
|
242
264
|
main().catch((err) => {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-thexjs-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Scaffold a new x framework app (npm create thexjs-app@latest).",
|
|
5
|
-
"keywords": [
|
|
5
|
+
"keywords": [
|
|
6
6
|
"react",
|
|
7
7
|
"bun",
|
|
8
8
|
"bunjs",
|
|
@@ -42,12 +42,7 @@
|
|
|
42
42
|
"bin": {
|
|
43
43
|
"create-thexjs-app": "./dist/index.js"
|
|
44
44
|
},
|
|
45
|
-
"files": [
|
|
46
|
-
"dist",
|
|
47
|
-
"templates",
|
|
48
|
-
"README.md",
|
|
49
|
-
"LICENSE"
|
|
50
|
-
],
|
|
45
|
+
"files": ["dist", "templates", "README.md", "LICENSE"],
|
|
51
46
|
"publishConfig": {
|
|
52
47
|
"access": "public"
|
|
53
48
|
},
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
+
import { Link as XLink, type LinkProps as XLinkProps } from "@thexjs/core";
|
|
1
2
|
import type { ReactNode } from "react";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
href: string;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
className?: string;
|
|
7
|
-
prefetch?: boolean;
|
|
8
|
-
}
|
|
4
|
+
type LinkProps = XLinkProps;
|
|
9
5
|
|
|
10
|
-
export default function Link(
|
|
11
|
-
return
|
|
12
|
-
<a href={href} className={className} data-no-nav={prefetch ? undefined : ""}>
|
|
13
|
-
{children}
|
|
14
|
-
</a>
|
|
15
|
-
);
|
|
6
|
+
export default function Link(props: LinkProps) {
|
|
7
|
+
return <XLink {...props} />;
|
|
16
8
|
}
|
|
9
|
+
|
|
10
|
+
export type { LinkProps };
|
|
@@ -5,7 +5,8 @@ export default function PlaceholderPage() {
|
|
|
5
5
|
{"{"}JSON{"}"} Placeholder
|
|
6
6
|
</h1>
|
|
7
7
|
<p className="text-muted-foreground">
|
|
8
|
-
Free fake API powered by <strong>@thexjs/core</strong> — in-memory data, sub-ms response
|
|
8
|
+
Free fake API powered by <strong>@thexjs/core</strong> — in-memory data, sub-ms response
|
|
9
|
+
times.
|
|
9
10
|
</p>
|
|
10
11
|
|
|
11
12
|
<div className="overflow-x-auto rounded-lg border border-border">
|
|
@@ -20,9 +20,6 @@ export default function MainLayout({ children }: { children: ReactNode }) {
|
|
|
20
20
|
<polygon points="19,5 21,3 5,21 3,19" fill="currentColor" opacity="0.45" />
|
|
21
21
|
</svg>
|
|
22
22
|
</span>
|
|
23
|
-
<span className="font-display text-sm font-bold tracking-tight text-foreground/90 transition-colors group-hover:text-primary">
|
|
24
|
-
x
|
|
25
|
-
</span>
|
|
26
23
|
</a>
|
|
27
24
|
</header>
|
|
28
25
|
<main className="relative z-10 flex flex-1 flex-col">{children}</main>
|
|
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
|
|
|
2
2
|
|
|
3
3
|
export const mode = "static";
|
|
4
4
|
|
|
5
|
-
export default function HomePage(
|
|
5
|
+
export default function HomePage(_props: RouteProps) {
|
|
6
6
|
return (
|
|
7
7
|
<div className="flex flex-1 flex-col items-center justify-center px-6 pb-20 pt-8 sm:px-10">
|
|
8
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">
|
|
@@ -47,7 +47,7 @@ export default function HomePage({}: RouteProps) {
|
|
|
47
47
|
|
|
48
48
|
<div className="mt-10 flex flex-wrap items-center justify-center gap-4">
|
|
49
49
|
<a
|
|
50
|
-
href="https://
|
|
50
|
+
href="https://thexjs.vercel.app/docs"
|
|
51
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
52
|
>
|
|
53
53
|
Read the docs
|
|
@@ -5,20 +5,114 @@ interface CodeBlockProps {
|
|
|
5
5
|
label: string;
|
|
6
6
|
code: string;
|
|
7
7
|
lang?: string;
|
|
8
|
+
/** Terminal-style output with prompt prefixes and scanline texture. */
|
|
9
|
+
variant?: "code" | "terminal";
|
|
8
10
|
}
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
function TerminalBody({ code, lang }: { code: string; lang: string }) {
|
|
13
|
+
const lines = code.split("\n");
|
|
14
|
+
|
|
11
15
|
return (
|
|
12
|
-
<div className="
|
|
13
|
-
<div
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
<div className="relative font-mono text-[13px] leading-[1.65]">
|
|
17
|
+
<div
|
|
18
|
+
className="pointer-events-none absolute inset-0 opacity-[0.04]"
|
|
19
|
+
style={{
|
|
20
|
+
backgroundImage:
|
|
21
|
+
"repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,255,255,0.15) 2px, rgba(255,255,255,0.15) 4px)",
|
|
22
|
+
}}
|
|
23
|
+
/>
|
|
24
|
+
<pre className="relative overflow-x-auto p-5">
|
|
25
|
+
{lines.map((line, i) => {
|
|
26
|
+
const isPrompt = line.startsWith("$") || line.startsWith(">");
|
|
27
|
+
const isOutput = line.startsWith(" ") && !line.startsWith(" ");
|
|
28
|
+
const isDim = line.trim() === "" || line.includes("(recommended)");
|
|
29
|
+
|
|
30
|
+
if (lang === "bash" && isPrompt) {
|
|
31
|
+
const [, ...rest] = line.split(/(?<=\$|\>)\s?/);
|
|
32
|
+
const cmd = rest.join("") || line.slice(1).trim();
|
|
33
|
+
return (
|
|
34
|
+
<div key={`${i}-${line.slice(0, 8)}`} className="flex gap-3">
|
|
35
|
+
<span className="shrink-0 select-none text-[var(--terminal-prompt)]">
|
|
36
|
+
{line.startsWith("$") ? "$" : ">"}
|
|
37
|
+
</span>
|
|
38
|
+
<code className="text-[var(--terminal-text)]">{cmd}</code>
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (isOutput) {
|
|
44
|
+
return (
|
|
45
|
+
<div key={`${i}-${line.slice(0, 8)}`} className="pl-5 text-[var(--terminal-muted)]">
|
|
46
|
+
{line.trimStart()}
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
key={`${i}-${line.slice(0, 8)}`}
|
|
54
|
+
className={isDim ? "text-[var(--terminal-muted)]/80" : "text-[var(--terminal-text)]"}
|
|
55
|
+
>
|
|
56
|
+
{lang === "bash" ? line : highlight(line, lang)}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
59
|
+
})}
|
|
21
60
|
</pre>
|
|
22
61
|
</div>
|
|
23
62
|
);
|
|
24
63
|
}
|
|
64
|
+
|
|
65
|
+
export function CodeBlock({ label, code, lang = "tsx", variant = "code" }: CodeBlockProps) {
|
|
66
|
+
const isTerminal = variant === "terminal" || lang === "bash" || lang === "tree";
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
className={`code-block mt-6 overflow-hidden rounded-2xl border shadow-2xl ${
|
|
71
|
+
isTerminal
|
|
72
|
+
? "border-[var(--terminal-border)] bg-[var(--terminal-bg)] shadow-[var(--terminal-glow)]"
|
|
73
|
+
: "border-border/50 bg-[#0a0e14] shadow-black/40"
|
|
74
|
+
}`}
|
|
75
|
+
>
|
|
76
|
+
<div
|
|
77
|
+
className={`flex items-center justify-between gap-3 border-b px-4 py-2.5 ${
|
|
78
|
+
isTerminal
|
|
79
|
+
? "border-[var(--terminal-border)] bg-[var(--terminal-bar)]"
|
|
80
|
+
: "border-white/[0.06] bg-[#121820]"
|
|
81
|
+
}`}
|
|
82
|
+
>
|
|
83
|
+
<div className="flex items-center gap-1.5">
|
|
84
|
+
<span className="h-2.5 w-2.5 rounded-full bg-[#ff5f56]" />
|
|
85
|
+
<span className="h-2.5 w-2.5 rounded-full bg-[#ffbd2e]" />
|
|
86
|
+
<span className="h-2.5 w-2.5 rounded-full bg-[#27c93f]" />
|
|
87
|
+
</div>
|
|
88
|
+
<span
|
|
89
|
+
className={`truncate font-mono text-[11px] tracking-wide ${
|
|
90
|
+
isTerminal ? "text-[var(--terminal-label)]" : "text-[#7d8da6]"
|
|
91
|
+
}`}
|
|
92
|
+
>
|
|
93
|
+
{label}
|
|
94
|
+
</span>
|
|
95
|
+
<span className="hidden w-12 sm:block" />
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
{isTerminal ? (
|
|
99
|
+
<TerminalBody code={code} lang={lang} />
|
|
100
|
+
) : (
|
|
101
|
+
<pre className="overflow-x-auto p-5 text-sm leading-relaxed">
|
|
102
|
+
<code className="font-mono text-[#e8edf5]">{highlight(code, lang)}</code>
|
|
103
|
+
</pre>
|
|
104
|
+
)}
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Shorthand for bash/CLI snippets. */
|
|
110
|
+
export function TerminalBlock({
|
|
111
|
+
label,
|
|
112
|
+
code,
|
|
113
|
+
}: {
|
|
114
|
+
label: string;
|
|
115
|
+
code: string;
|
|
116
|
+
}): ReactNode {
|
|
117
|
+
return <CodeBlock label={label} code={code} lang="bash" variant="terminal" />;
|
|
118
|
+
}
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
|
|
3
|
+
function LogoMark() {
|
|
4
|
+
return (
|
|
5
|
+
<svg viewBox="0 0 24 24" className="h-5 w-5" fill="none" aria-hidden="true">
|
|
6
|
+
<title>x logo</title>
|
|
7
|
+
<polygon points="3,5 5,3 21,19 19,21" fill="currentColor" />
|
|
8
|
+
<polygon points="19,5 21,3 5,21 3,19" fill="currentColor" opacity="0.45" />
|
|
9
|
+
</svg>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
export default function RootLayout({ children }: { children: ReactNode }) {
|
|
4
14
|
return (
|
|
5
15
|
<div className="flex min-h-screen flex-col bg-background">
|
|
6
|
-
<header className="fixed top-0 z-[99] w-full border-b border-border/
|
|
7
|
-
<div className="mx-auto flex h-
|
|
16
|
+
<header className="fixed top-0 z-[99] w-full border-b border-border/50 bg-background/70 backdrop-blur-xl">
|
|
17
|
+
<div className="mx-auto flex h-14 max-w-6xl items-center justify-between px-6">
|
|
8
18
|
<a
|
|
9
19
|
href="/"
|
|
10
|
-
className="flex items-center text-primary transition-
|
|
20
|
+
className="group flex items-center gap-2.5 text-primary transition-opacity hover:opacity-90"
|
|
11
21
|
aria-label="x home"
|
|
12
22
|
>
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
23
|
+
<span className="flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-card">
|
|
24
|
+
<LogoMark />
|
|
25
|
+
</span>
|
|
26
|
+
<span className="font-display text-sm font-bold tracking-tight text-foreground/90">
|
|
27
|
+
x
|
|
28
|
+
</span>
|
|
17
29
|
</a>
|
|
18
|
-
<nav className="flex items-center gap-
|
|
30
|
+
<nav className="flex items-center gap-6 text-sm font-medium text-muted-foreground">
|
|
19
31
|
<a href="/docs" className="transition-colors hover:text-foreground">
|
|
20
32
|
Docs
|
|
21
33
|
</a>
|
|
@@ -26,21 +38,39 @@ export default function RootLayout({ children }: { children: ReactNode }) {
|
|
|
26
38
|
href="https://github.com/abdelkabirouadoukou/x"
|
|
27
39
|
target="_blank"
|
|
28
40
|
rel="noopener noreferrer"
|
|
29
|
-
className="
|
|
30
|
-
aria-label="GitHub repository"
|
|
41
|
+
className="hidden items-center gap-1.5 transition-colors hover:text-foreground sm:flex"
|
|
31
42
|
>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
GitHub
|
|
44
|
+
</a>
|
|
45
|
+
<a
|
|
46
|
+
href="/docs/installation"
|
|
47
|
+
className="inline-flex h-8 items-center rounded-lg bg-primary px-3.5 text-xs font-semibold text-primary-foreground transition-colors hover:bg-primary/90"
|
|
48
|
+
>
|
|
49
|
+
Install
|
|
36
50
|
</a>
|
|
37
51
|
</nav>
|
|
38
52
|
</div>
|
|
39
53
|
</header>
|
|
40
|
-
<main className="flex-1 pt-
|
|
41
|
-
<footer className="border-t border-border/
|
|
42
|
-
<div className="mx-auto max-w-6xl px-6 py-
|
|
43
|
-
<
|
|
54
|
+
<main className="flex-1 pt-14">{children}</main>
|
|
55
|
+
<footer className="border-t border-border/50">
|
|
56
|
+
<div className="mx-auto flex max-w-6xl flex-col items-center justify-between gap-3 px-6 py-10 text-sm text-muted-foreground sm:flex-row">
|
|
57
|
+
<p>
|
|
58
|
+
<span className="font-display font-bold text-foreground">x</span> — fullstack framework
|
|
59
|
+
for Bun
|
|
60
|
+
</p>
|
|
61
|
+
<div className="flex gap-5">
|
|
62
|
+
<a href="/docs" className="transition-colors hover:text-foreground">
|
|
63
|
+
Documentation
|
|
64
|
+
</a>
|
|
65
|
+
<a
|
|
66
|
+
href="https://github.com/abdelkabirouadoukou/x"
|
|
67
|
+
target="_blank"
|
|
68
|
+
rel="noopener noreferrer"
|
|
69
|
+
className="transition-colors hover:text-foreground"
|
|
70
|
+
>
|
|
71
|
+
GitHub
|
|
72
|
+
</a>
|
|
73
|
+
</div>
|
|
44
74
|
</div>
|
|
45
75
|
</footer>
|
|
46
76
|
</div>
|
|
@@ -17,6 +17,7 @@ const sidebarSections = [
|
|
|
17
17
|
{ href: "/docs/packages/core", label: "@thexjs/core" },
|
|
18
18
|
{ href: "/docs/packages/cli", label: "@thexjs/cli" },
|
|
19
19
|
{ href: "/docs/packages/env", label: "@thexjs/env" },
|
|
20
|
+
{ href: "/docs/packages/adapter-vercel", label: "@thexjs/adapter-vercel" },
|
|
20
21
|
],
|
|
21
22
|
},
|
|
22
23
|
{
|
|
@@ -32,6 +33,8 @@ const sidebarSections = [
|
|
|
32
33
|
{ href: "/docs/data-layer", label: "Data Layer" },
|
|
33
34
|
{ href: "/docs/build-deploy", label: "Build & Deploy" },
|
|
34
35
|
{ href: "/docs/configuration", label: "Configuration" },
|
|
36
|
+
{ href: "/docs/security", label: "Security" },
|
|
37
|
+
{ href: "/docs/observability", label: "Observability" },
|
|
35
38
|
],
|
|
36
39
|
},
|
|
37
40
|
];
|
|
@@ -40,16 +43,17 @@ function SidebarNav() {
|
|
|
40
43
|
return (
|
|
41
44
|
<>
|
|
42
45
|
{sidebarSections.map((section) => (
|
|
43
|
-
<div key={section.title} className="mb-
|
|
44
|
-
<p className="mb-
|
|
46
|
+
<div key={section.title} className="mb-7 last:mb-0">
|
|
47
|
+
<p className="mb-2 font-mono text-[10px] uppercase tracking-[0.18em] text-primary/80">
|
|
45
48
|
{section.title}
|
|
46
49
|
</p>
|
|
47
|
-
<ul className="space-y-
|
|
50
|
+
<ul className="space-y-0.5">
|
|
48
51
|
{section.links.map((link) => (
|
|
49
52
|
<li key={link.href}>
|
|
50
53
|
<a
|
|
51
54
|
href={link.href}
|
|
52
|
-
|
|
55
|
+
data-doc-link={link.href}
|
|
56
|
+
className="doc-nav-link block rounded-lg border border-transparent px-3 py-2 text-[13px] text-muted-foreground transition-colors hover:border-border/60 hover:bg-muted/50 hover:text-foreground"
|
|
53
57
|
>
|
|
54
58
|
{link.label}
|
|
55
59
|
</a>
|
|
@@ -64,41 +68,49 @@ function SidebarNav() {
|
|
|
64
68
|
|
|
65
69
|
export default function DocsLayout({ children }: { children: ReactNode }) {
|
|
66
70
|
return (
|
|
67
|
-
<div className="mx-auto flex min-h-[calc(100vh-
|
|
71
|
+
<div className="mx-auto flex min-h-[calc(100vh-3.5rem)] w-full max-w-6xl px-4 sm:px-6">
|
|
68
72
|
<button
|
|
69
73
|
id="sidebar-btn"
|
|
70
74
|
type="button"
|
|
71
|
-
className="fixed left-4 top-
|
|
75
|
+
className="fixed left-4 top-[4.25rem] z-50 flex h-8 w-8 items-center justify-center rounded-lg border border-border bg-background text-muted-foreground shadow-sm transition-colors hover:bg-muted hover:text-foreground lg:hidden"
|
|
72
76
|
aria-label="Toggle sidebar"
|
|
73
77
|
>
|
|
74
78
|
<Menu className="h-4 w-4 btn-icon-open" />
|
|
75
79
|
<X className="hidden h-4 w-4 btn-icon-close" />
|
|
76
80
|
</button>
|
|
77
81
|
|
|
78
|
-
<div id="sidebar-overlay" className="fixed inset-0 z-40 hidden bg-black/
|
|
82
|
+
<div id="sidebar-overlay" className="fixed inset-0 z-40 hidden bg-black/60 lg:hidden" />
|
|
79
83
|
|
|
80
84
|
<aside
|
|
81
85
|
id="sidebar-panel"
|
|
82
|
-
className="fixed left-0 top-
|
|
86
|
+
className="fixed left-0 top-14 z-50 hidden h-[calc(100vh-3.5rem)] w-60 overflow-y-auto border-r border-border/50 bg-background lg:hidden"
|
|
83
87
|
>
|
|
84
|
-
<nav className="px-
|
|
88
|
+
<nav className="px-3 pb-6 pt-4">
|
|
85
89
|
<SidebarNav />
|
|
86
90
|
</nav>
|
|
87
91
|
</aside>
|
|
88
92
|
|
|
89
|
-
<aside className="hidden w-
|
|
90
|
-
<nav className="sticky top-
|
|
93
|
+
<aside className="hidden w-60 shrink-0 border-r border-border/50 lg:block">
|
|
94
|
+
<nav className="sticky top-14 max-h-[calc(100vh-3.5rem)] overflow-y-auto px-3 pb-8 pt-2">
|
|
91
95
|
<SidebarNav />
|
|
92
96
|
</nav>
|
|
93
97
|
</aside>
|
|
98
|
+
|
|
94
99
|
<div className="min-w-0 flex-1">
|
|
95
|
-
<div className="mx-auto max-w-
|
|
100
|
+
<div className="doc-content mx-auto max-w-3xl px-4 py-10 sm:px-8 sm:py-12">{children}</div>
|
|
96
101
|
</div>
|
|
97
102
|
|
|
98
103
|
<script
|
|
99
104
|
dangerouslySetInnerHTML={{
|
|
100
105
|
__html: `
|
|
101
106
|
(function(){
|
|
107
|
+
var path=location.pathname.replace(/\\/$/,"")||"/docs";
|
|
108
|
+
document.querySelectorAll("[data-doc-link]").forEach(function(a){
|
|
109
|
+
var href=a.getAttribute("data-doc-link").replace(/\\/$/,"")||"/docs";
|
|
110
|
+
if(href===path||(path!=="/docs"&&href!=="/docs"&&path.indexOf(href)===0)){
|
|
111
|
+
a.classList.add("border-primary/30","bg-primary/10","text-primary");
|
|
112
|
+
}
|
|
113
|
+
});
|
|
102
114
|
var btn=document.getElementById("sidebar-btn");
|
|
103
115
|
var panel=document.getElementById("sidebar-panel");
|
|
104
116
|
var overlay=document.getElementById("sidebar-overlay");
|
|
@@ -109,7 +121,7 @@ export default function DocsLayout({ children }: { children: ReactNode }) {
|
|
|
109
121
|
overlay.addEventListener("click",close);
|
|
110
122
|
panel.querySelectorAll("a").forEach(function(a){a.addEventListener("click",close)});
|
|
111
123
|
})();
|
|
112
|
-
|
|
124
|
+
`.trim(),
|
|
113
125
|
}}
|
|
114
126
|
/>
|
|
115
127
|
<style
|
|
@@ -119,7 +131,7 @@ export default function DocsLayout({ children }: { children: ReactNode }) {
|
|
|
119
131
|
#sidebar-btn.open .btn-icon-open{display:none}
|
|
120
132
|
#sidebar-btn.open .btn-icon-close{display:block}
|
|
121
133
|
}
|
|
122
|
-
|
|
134
|
+
`.trim(),
|
|
123
135
|
}}
|
|
124
136
|
/>
|
|
125
137
|
</div>
|
|
@@ -2,7 +2,7 @@ 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 default function DocPage(
|
|
5
|
+
export default function DocPage(_props: RouteProps) {
|
|
6
6
|
return (
|
|
7
7
|
<div>
|
|
8
8
|
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">API Routes</p>
|
|
@@ -2,7 +2,7 @@ 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 default function DocPage(
|
|
5
|
+
export default function DocPage(_props: RouteProps) {
|
|
6
6
|
return (
|
|
7
7
|
<div>
|
|
8
8
|
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">
|
|
@@ -2,7 +2,7 @@ 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 default function DocPage(
|
|
5
|
+
export default function DocPage(_props: RouteProps) {
|
|
6
6
|
return (
|
|
7
7
|
<div>
|
|
8
8
|
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Configuration</p>
|
|
@@ -2,7 +2,7 @@ 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 default function DocPage(
|
|
5
|
+
export default function DocPage(_props: RouteProps) {
|
|
6
6
|
return (
|
|
7
7
|
<div>
|
|
8
8
|
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">
|
|
@@ -2,7 +2,7 @@ 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 default function DocPage(
|
|
5
|
+
export default function DocPage(_props: RouteProps) {
|
|
6
6
|
return (
|
|
7
7
|
<div>
|
|
8
8
|
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Data Layer</p>
|
|
@@ -4,7 +4,7 @@ import { CodeBlock } from "../../components/code-block";
|
|
|
4
4
|
|
|
5
5
|
export const mode = "static";
|
|
6
6
|
|
|
7
|
-
export default function DocPage(
|
|
7
|
+
export default function DocPage(_props: RouteProps) {
|
|
8
8
|
return (
|
|
9
9
|
<div>
|
|
10
10
|
<p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">
|
|
@@ -31,9 +31,9 @@ cd my-app
|
|
|
31
31
|
bun run dev`}
|
|
32
32
|
/>
|
|
33
33
|
<p className="mt-4 text-muted-foreground">
|
|
34
|
-
Press Enter at the template prompt to use{" "}
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
Press Enter at the template prompt to use <span className="text-foreground">default</span>{" "}
|
|
35
|
+
(recommended) — a single home page. Your app will be running at{" "}
|
|
36
|
+
<span className="text-foreground">http://localhost:3000</span>.
|
|
37
37
|
</p>
|
|
38
38
|
|
|
39
39
|
<h2 className="mt-12 text-xl font-bold tracking-tight">Manual setup</h2>
|