A continuation of HomeBox the inventory and organization system built for the Home User
// @ts-check
import { defineConfig, svgoOptimizer } from 'astro/config';
import starlight from '@astrojs/starlight';
import starlightThemeNova from 'starlight-theme-nova';
import starlightChangelogs, { makeChangelogsSidebarLinks } from 'starlight-changelogs';
import starlightOpenAPI, { openAPISidebarGroups } from 'starlight-openapi'
import starlightGitHubAlerts from 'starlight-github-alerts';
import icon from 'astro-icon';
import starlightSidebarTopics from 'starlight-sidebar-topics';
import starlightAutoDrafts from "starlight-auto-drafts";
import cloudflare from '@astrojs/cloudflare';
import tailwindcss from "@tailwindcss/vite";
// https://astro.build/config
// @ts-ignore
export default defineConfig({
experimental: {
svgOptimizer: svgoOptimizer(),
contentIntellisense: true,
clientPrerender: true,
chromeDevtoolsWorkspace: true,
/*csp: {
algorithm: 'SHA-384',
directives: [
"img-src 'self' data: https://translate.sysadminsmedia.com;"
]
} Turn this off for now while we work on things, sort it later*/
},
prefetch: {
prefetchAll: true,
defaultStrategy: 'hover',
},
site: 'https://homebox.software',
integrations: [
starlight({
components: {
SocialIcons: './src/components/theme/SocialIcon.astro',
SiteTitle: './src/components/theme/SiteTitle.astro',
Hero: './src/components/theme/Hero.astro',
},
logo: {
src: './src/assets/lilbox.svg',
},
editLink: {
baseUrl: 'https://github.com/sysadminsmedia/homebox/edit/main/docs/',
},
lastUpdated: true,
// 404 page comes from src/content/docs/404.md via the regular docs route.
disable404Route: true,
plugins: [
starlightThemeNova({
// nav: [
// { label: 'Demos', href: 'https://demo.homebox.software' },
// { label: 'API Docs', href: '/api' },
// ],
}),
starlightGitHubAlerts(),
starlightChangelogs(),
starlightAutoDrafts(),
starlightOpenAPI([
{
base: 'en/api',
// Load the schema from this docs site so relative server URLs
// (e.g. /api) resolve against the current host.
schema: './public/api/openapi-3.0.json',
},
]),
starlightSidebarTopics(
[
{
label: { en: 'Documentation' },
link: '/quick-start/',
icon: 'open-book',
items: [
{
label: 'Getting Started',
items: [
{
label: 'Quick Start',
slug: 'quick-start',
},
{
label: 'Install',
slug: 'quick-start/install',
},
{
label: 'Configure',
items: [{ autogenerate: { directory: 'quick-start/configure' } }],
},
],
},
{
label: 'User Guide',
items: [{ autogenerate: { directory: 'user-guide' } }],
},
{
label: 'Advanced',
collapsed: true,
items: [{ autogenerate: { directory: 'advanced', collapsed: true } }],
},
{
label: 'Contributing',
badge: {
text: 'WIP',
variant: 'caution'
},
collapsed: true,
items: [
{
label: 'Getting Started',
slug: 'contribute',
},
{
label: 'Bounty Program',
slug: 'contribute/bounty-program',
},
{
label: 'Code of Conduct',
slug: 'contribute/code-of-conduct',
},
{
label: 'Security Policy',
slug: 'contribute/security',
},
{
label: 'Development',
items: [{ autogenerate: { directory: 'contribute/development', collapsed: true } }],
},
{
label: 'Translations',
items: [{ autogenerate: { directory: 'contribute/translate', collapsed: true } }],
},
{
label: 'Documentation',
items: [{ autogenerate: { directory: 'contribute/documentation', collapsed: true } }],
},
],
},
{
label: 'Analytics',
items: [
{
label: 'Purpose & Data',
slug: 'analytics',
},
{
label: 'Privacy Policy',
slug: 'analytics/privacy',
}
]
}
],
},
{
label: { en: 'Changelogs' },
link: '/changelog/',
icon: 'information',
id: "changelog",
items: makeChangelogsSidebarLinks([
{
label: 'Changelogs',
type: 'all',
base: 'changelog',
},
]),
},
{
label: { en: 'API Reference' },
// TODO: the api link is broken bc this links to /en/api/ not /api/
link: '/api/',
id: "api",
icon: 'forward-slash',
items: [...openAPISidebarGroups],
},
{
label: { en: 'Demo' },
link: 'https://demo.homebox.software',
icon: 'puzzle',
},
{
label: { en: 'Blog' },
link: 'https://blog.homebox.software',
icon: 'document',
},
],
{
topics: {
api: ["/*/api", "/*/api/**/*"],
changelog: ["/*/changelog", "/*/changelog/**/*"],
},
exclude: ['**/*'],
}
),
],
title: 'Homebox',
defaultLocale: 'en',
locales: {
en: {
label: 'English',
}
},
customCss: [
'./src/styles/global.css',
],
expressiveCode: {
removeUnusedThemes: true, // Try to reduce bundle size by removing unused themes
useThemedSelectionColors: true,
minSyntaxHighlightingColorContrast: 5.0, // Ensure the minimum contrast is at least .5 units higher than WCAG 2.2 AA
shiki: { // We set the languages we actually use to try to reduce bundle sizes
bundledLangs: ['shellscript', 'typescript', 'javascript', 'json', 'yaml', 'go', 'systemd', 'vue', 'vue-html', 'astro', 'css', 'sql'],
}
}
}),
icon({
include: { // Specify which icons to include in the final bundle (reduce bundle size)
'material-symbols': ['home-work', 'edit-document', 'family-group', 'settings', 'book-5', 'flash-on', 'lock', 'package', 'folder-open', 'label'],
'simple-icons': ['discord', 'github', 'lemmy', 'reddit', 'mastodon'],
'fluent-emoji-flat': ['label'],
}
}),
],
//adapter: cloudflare(),
vite: {
plugins: [tailwindcss()],
build: {
rolldownOptions: {
onLog(level, log, handler) {
// Astro's content-assets plugin emits a "use astro:head-inject" directive
// that Astro consumes itself; Rolldown warns about it for every MDX file
// that imports components. The warning is harmless, so drop it.
if (log.code === 'MODULE_LEVEL_DIRECTIVE' && log.message.includes('astro:head-inject')) return;
handler(level, log);
},
},
},
},
});