Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
JavaScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237// @ts-checkimport { fileURLToPath } from "node:url";import { defineConfig } from "astro/config";import starlight from "@astrojs/starlight";import starlightLlmActions from "starlight-llm-actions";import starlightLinksValidator from "starlight-links-validator";import sitemap from "@astrojs/sitemap";import svelte from "@astrojs/svelte";import tailwindcss from "@tailwindcss/vite";import Icons from "unplugin-icons/vite";
// the ui components are shared with the web app, imported straight from its// source rather than published as a packageconst webLib = fileURLToPath(new URL("../web/src/lib", import.meta.url));
const svelteStyleFallback = { name: "svelte-style-fallback", enforce: "pre", transform(code, id) { if (!id.includes("svelte&type=style&lang.css")) return; if (!code.includes("<style")) return; const match = code.match(/<style[^>]*>([\s\S]*?)<\/style>/i); return { code: match ? match[1] : "", map: null }; },};
export default defineConfig({ site: "https://docs.tangled.org", integrations: [ starlight({ title: "Tangled Docs", titleDelimiter: "·", disable404Route: true, routeMiddleware: ["./src/starlightRouteData.ts"], tableOfContents: { minHeadingLevel: 2, maxHeadingLevel: 2 }, plugins: [ starlightLlmActions({ renderMarkdown: "simple", linkAlternate: true, llmsTxt: { exclude: ["index"] }, }), starlightLinksValidator(), ], description: "Documentation for Tangled — decentralized code collaboration built on the AT Protocol.", social: [ { icon: "x.com", label: "X", href: "https://x.com/tangled_org" }, { icon: "blueSky", label: "Bluesky", href: "https://bsky.app/profile/tangled.org", }, ], favicon: "/favicon.svg", head: [ { tag: "link", attrs: { rel: "apple-touch-icon", href: "/apple-touch-icon.png" }, }, ], logo: { light: "./src/assets/logotype-light.svg", dark: "./src/assets/logotype-dark.svg", replacesTitle: true, }, editLink: { baseUrl: "https://tangled.org/@tangled.org/core/blob/master/docs/", }, customCss: [ "./src/styles/global.css", "./src/styles/tangled.css", "./src/styles/custom.css", "./src/styles/diagrams.css", ], components: { Header: "./src/components/Header.astro", Hero: "./src/components/Hero.astro", MarkdownContent: "./src/components/MarkdownContent.astro", MobileMenuFooter: "./src/components/MobileMenuFooter.astro", PageTitle: "./src/components/PageTitle.astro", Sidebar: "./src/components/Sidebar.astro", ThemeSelect: "./src/components/ThemeToggle.astro", }, expressiveCode: { // same palettes as the web app's syntax tokens themes: ["catppuccin-macchiato", "catppuccin-latte"], // a plain bordered block like tangled.org's, no editor or terminal chrome defaultProps: { frame: "none" }, styleOverrides: { // expressive-code adds borderWidth to this for the outer // radius, so subtract it to land on --radius-md exactly borderRadius: "calc(var(--radius-md) - 1px)", borderColor: "var(--color-border-default)", borderWidth: "1px", codeBackground: "var(--color-background-canvas)", codeFontFamily: "var(--font-mono)", codeFontSize: "0.8125rem", codeLineHeight: "1.5385", codePaddingBlock: "0.75rem", codePaddingInline: "0.75rem", frames: { shadowColor: "transparent", frameBoxShadowCssValue: "none", }, }, }, sidebar: [ { label: "Getting started", items: [ "introduction", "quick-start", "comparison-with-github", "migrating-from-github", "why-atproto", ], }, { label: "Using Tangled", items: [ "guides/profile", "guides/repositories", "guides/pull-requests", "guides/access", "guides/vouching", "guides/notifications", "guides/organizations", "guides/signing-commits", "guides/importing", "sites", "troubleshooting", ], }, { label: "CI", items: [ "spindles", "spindles/writing-workflows", "spindles/workflows", "spindles/secrets", "spindles/runs", "spindles/webhooks", ], }, { label: "Components", items: [ { label: "Knot", slug: "knots" }, { label: "Spindle", slug: "spindles/architecture" }, { label: "Bobbin", slug: "components/bobbin" }, { label: "Gitmirror", slug: "components/gitmirror" }, { label: "Other services", slug: "components/other-services" }, ], }, { label: "Self-hosting", items: [ "self-hosting", "self-hosting/knot", "self-hosting/spindle", "self-hosting/frontend", "self-hosting/indexer", "self-hosting/openbao", "self-hosting/backups", "self-hosting/network", ], }, { label: "Upgrading", items: ["upgrading/knots-and-spindles", "upgrading/knot-2"], }, { label: "Architecture", items: [ "architecture/overview", "architecture/federation", "architecture/identity", "architecture/data-model", "architecture/data-flow", "architecture/security", ], }, { label: "API", items: [], }, { label: "Reference", items: [ "reference/glossary", "reference/records", "reference/xrpc", "reference/identifiers", "reference/knot-config", "reference/spindle-config", "reference/bobbin", "reference/webhooks", ], }, { label: "Contributing", items: ["contributing/hacking", "contributing/guide", "status"], }, ], }), sitemap(), svelte(), ], vite: { plugins: [svelteStyleFallback, tailwindcss(), Icons({ compiler: "svelte" })], resolve: { // same aliases the web app's components import through alias: { $lib: webLib, // the web app's own imports (sveltekit 3 subpath imports) "#lib": webLib, "$icon/": "~icons/lucide/", // routing and environment are sveltekit-only; components that build hrefs or // guard browser apis import them "$app/paths": fileURLToPath(new URL("./src/stubs/app-paths.ts", import.meta.url)), "$app/env": fileURLToPath(new URL("./src/stubs/app-env.ts", import.meta.url)), }, // web/ has no node_modules in the nix build: resolve the components' // runtime deps (and svelte itself, which must be a single copy) from here dedupe: ["svelte", "tailwind-variants", "tailwind-merge"], }, server: { fs: { allow: [ fileURLToPath(new URL(".", import.meta.url)), fileURLToPath(new URL("../web/src", import.meta.url)), ], }, }, },});