first commit
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
import type { AppConfig } from "@wrnexus/styles";
|
||||
|
||||
/**
|
||||
* App configuration. Optional — delete this file and the app still runs.
|
||||
*
|
||||
* `head` injects raw HTML into every page's <head>. This is the zero-build way
|
||||
* to use any CDN-delivered CSS framework. `seo` defines global metadata
|
||||
* defaults. `styles` configures the bundled global stylesheet (and lets you
|
||||
* swap in Tailwind/PostCSS/Sass via `process`). `security` configures
|
||||
* framework-level headers and optional CORS.
|
||||
*/
|
||||
const config: AppConfig = {
|
||||
head: [
|
||||
// --- Use a CSS framework via CDN (uncomment one) ---
|
||||
// Bootstrap:
|
||||
// `<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" />`,
|
||||
// Tailwind (Play CDN — dev/prototyping only):
|
||||
// `<script src="https://cdn.tailwindcss.com"></script>`,
|
||||
],
|
||||
|
||||
seo: {
|
||||
title: "WrNexus Basic App",
|
||||
titleTemplate: "%s | WrNexus",
|
||||
description:
|
||||
"A Bun-first SSR framework demo with API routes, realtime, islands, and .wrn pages.",
|
||||
siteName: "WrNexus",
|
||||
canonicalBase: "http://localhost:3000",
|
||||
robots: "index,follow",
|
||||
type: "website",
|
||||
twitterCard: "summary",
|
||||
themeColor: "#6c8cff",
|
||||
},
|
||||
|
||||
// Design-token themes. Built-in `light`/`dark` are provided; here we set the
|
||||
// default and override a couple of tokens to show customization. Users can
|
||||
// also redefine any `--wire-*` variable in their own CSS.
|
||||
theme: {
|
||||
default: "dark",
|
||||
themes: {
|
||||
light: { "color-primary": "#2563eb" },
|
||||
dark: { "color-primary": "#6c8cff" },
|
||||
},
|
||||
},
|
||||
|
||||
// Database connection for `wrnexus db` migrations (and, later, ctx.db).
|
||||
db: {
|
||||
driver: "sqlite",
|
||||
url: "file:./dev.db",
|
||||
},
|
||||
|
||||
styles: {
|
||||
entry: "app/styles/global.css",
|
||||
|
||||
// Real Tailwind v4 build. Runs once at dev-serve time (cached, re-run on a
|
||||
// restart) and at `wrnexus build`. `@tailwindcss/cli` writes to stdout by
|
||||
// default, so we just capture and return the final CSS string.
|
||||
process: async ({ entryPath, mode }) => {
|
||||
const args = ["@tailwindcss/cli", "-i", entryPath!];
|
||||
if (mode === "production") args.push("--minify");
|
||||
return await Bun.$`bunx ${args}`.text();
|
||||
},
|
||||
},
|
||||
|
||||
security: {
|
||||
// Defaults already include CSP, COOP, X-Frame-Options, Trusted Types in
|
||||
// production, strong HSTS in production, nosniff, referrer policy, and a
|
||||
// restrictive Permissions-Policy. CORS is opt-in:
|
||||
cors: {
|
||||
enabled: true,
|
||||
origin: ["http://localhost:5173", "http://localhost:3000"],
|
||||
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
|
||||
allowedHeaders: ["Content-Type", "Authorization"],
|
||||
credentials: true,
|
||||
maxAge: 600,
|
||||
},
|
||||
|
||||
// Example: allow a CDN script/style if you uncomment one in `head`.
|
||||
// contentSecurityPolicy: {
|
||||
// directives: {
|
||||
// "script-src": ["'self'", "https://cdn.tailwindcss.com"],
|
||||
// "style-src": ["'self'", "'unsafe-inline'", "https://cdn.jsdelivr.net"],
|
||||
// },
|
||||
// },
|
||||
// trustedTypes: {
|
||||
// // Optional stricter production allow-list:
|
||||
// policyNames: ["wrnexus", "default"],
|
||||
// },
|
||||
},
|
||||
|
||||
// Config profiles: select with `wrnexus dev --profile=uat` (or WRNEXUS_PROFILE).
|
||||
// Each block is DEEP-MERGED over the base config above. Combine with per-profile
|
||||
// .env files (.env.<profile>) for secrets — see `wrnexus profiles`.
|
||||
profiles: {
|
||||
// `production` also applies automatically on `wrnexus build`.
|
||||
production: {
|
||||
db: { driver: "postgres", url: process.env.DATABASE_URL ?? "postgres://localhost/app" },
|
||||
seo: { canonicalBase: "https://example.com" },
|
||||
},
|
||||
uat: {
|
||||
db: { driver: "postgres", url: process.env.DATABASE_URL ?? "postgres://localhost/uat" },
|
||||
seo: { title: "WrNexus (UAT)", robots: "noindex,nofollow" },
|
||||
},
|
||||
test: {
|
||||
db: { driver: "sqlite", url: "file:./test.db" },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user