262 lines
12 KiB
JavaScript
262 lines
12 KiB
JavaScript
// @ts-check
|
|
import { defineConfig } from 'astro/config';
|
|
|
|
import starlight from '@astrojs/starlight';
|
|
import starlightThemeNova from 'starlight-theme-nova';
|
|
import starlightLinksValidator from 'starlight-links-validator';
|
|
import vue from '@astrojs/vue';
|
|
import mdx from '@astrojs/mdx';
|
|
import { unified } from '@astrojs/markdown-remark';
|
|
import { remarkMermaid } from './src/plugins/remark-mermaid.ts';
|
|
import { remarkFrenchTypography } from './src/plugins/remark-french-typography.ts';
|
|
import gramGrammar from '@gram-lang/parser/textmate';
|
|
import { UMAMI_WEBSITE_ID, UMAMI_SCRIPT_SRC, FR_REDIRECT_SCRIPT, GLOBAL_TRACKING_SCRIPT } from './src/lib/head-scripts.ts';
|
|
|
|
const isProd = process.env.NODE_ENV === 'production';
|
|
const SITE_URL = 'https://gram-lang.org';
|
|
|
|
// https://astro.build/config
|
|
export default defineConfig({
|
|
site: 'https://gram-lang.org',
|
|
redirects: {
|
|
'/docs/explanation/mise-en-place-and-planning': '/docs/explanation/planning',
|
|
'/docs/explanation/planning-in-real-time': '/docs/explanation/planning',
|
|
'/fr/docs/explanation/mise-en-place-and-planning': '/fr/docs/explanation/planning',
|
|
'/fr/docs/explanation/planning-in-real-time': '/fr/docs/explanation/planning'
|
|
},
|
|
devToolbar: {
|
|
enabled: false
|
|
},
|
|
markdown: {
|
|
processor: unified({ remarkPlugins: [remarkMermaid, remarkFrenchTypography] }),
|
|
shikiConfig: {
|
|
langs: [{ ...gramGrammar, name: 'gram' }]
|
|
}
|
|
},
|
|
integrations: [
|
|
vue(),
|
|
starlight({
|
|
plugins: [
|
|
starlightThemeNova(),
|
|
starlightLinksValidator({
|
|
errorOnFallbackPages: false,
|
|
errorOnInconsistentLocale: true,
|
|
exclude: [
|
|
'/play', '/play/', '/fr/play', '/fr/play/',
|
|
'/docs', '/docs/', '/fr/docs', '/fr/docs/', '/en/docs', '/en/docs/',
|
|
'/blog', '/blog/', '/blog/**', '/fr/blog', '/fr/blog/', '/fr/blog/**'
|
|
]
|
|
})
|
|
],
|
|
title: 'Gram',
|
|
disable404Route: true,
|
|
customCss: [
|
|
'./src/styles/global.css',
|
|
],
|
|
components: {
|
|
Footer: './src/components/Footer.astro',
|
|
SiteTitle: './src/components/SiteTitle.astro',
|
|
ThemeSelect: './src/components/ThemeSelect.astro'
|
|
},
|
|
locales: {
|
|
root: { label: 'English', lang: 'en' },
|
|
fr: { label: 'Français', lang: 'fr' }
|
|
},
|
|
sidebar: [
|
|
{
|
|
label: 'Introduction',
|
|
collapsed: false,
|
|
items: [
|
|
{ label: 'What is Gram?', translations: { fr: "C'est quoi Gram ?" }, slug: 'docs/explanation/philosophy' },
|
|
{ label: 'Getting started', translations: { fr: 'Premiers pas' }, slug: 'docs/tutorials/getting-started' },
|
|
{ label: 'Your first recipe', translations: { fr: 'Votre première recette' }, slug: 'docs/tutorials/first-recipe' }
|
|
]
|
|
},
|
|
{
|
|
label: 'How-to guides',
|
|
translations: { fr: 'Guides pratiques' },
|
|
collapsed: false,
|
|
items: [
|
|
{ label: 'Organize modular recipes', translations: { fr: 'Organiser des recettes modulaires' }, slug: 'docs/how-to/organize-modular-recipes', badge: { text: 'v1.2.0', variant: 'default' } },
|
|
{ label: 'Scale recipes dynamically', translations: { fr: 'Ajuster les proportions' }, slug: 'docs/how-to/scale-recipes' },
|
|
{ label: 'Plan a meal', translations: { fr: 'Planifier un repas' }, slug: 'docs/how-to/plan-a-meal', badge: { text: 'v1.4.0', variant: 'default' } },
|
|
{ label: 'Generate shopping list', translations: { fr: 'Générer la liste de courses' }, slug: 'docs/how-to/weekly-shopping-list' },
|
|
{ label: 'Configure AI provider', translations: { fr: "Configurer l'IA" }, slug: 'docs/how-to/configure-ai' },
|
|
{ label: 'Manage database', translations: { fr: 'Gérer la base de données' }, slug: 'docs/how-to/manage-database' },
|
|
{ label: 'How to build a custom UI', translations: { fr: 'Créer une UI personnalisée' }, slug: 'docs/how-to/build-custom-ui' },
|
|
{ label: 'Deprecated features', translations: { fr: 'Fonctionnalités dépréciées' }, slug: 'docs/how-to/deprecations' }
|
|
]
|
|
},
|
|
{
|
|
label: 'Language reference',
|
|
translations: { fr: 'Référence du langage' },
|
|
collapsed: false,
|
|
items: [
|
|
{ label: 'Document structure', translations: { fr: 'Structure du document' }, slug: 'docs/reference/syntax/document-structure' },
|
|
{ label: 'Module imports', translations: { fr: 'Imports de modules' }, slug: 'docs/reference/syntax/modules', badge: { text: 'v1.2.0', variant: 'default' } },
|
|
{ label: 'Ingredients', translations: { fr: 'Ingrédients' }, slug: 'docs/reference/syntax/ingredients' },
|
|
{ label: 'Cookware', translations: { fr: 'Matériel' }, slug: 'docs/reference/syntax/cookware' },
|
|
{ label: 'Times', translations: { fr: 'Temps' }, slug: 'docs/reference/syntax/times' },
|
|
{ label: 'Temperatures', translations: { fr: 'Températures' }, slug: 'docs/reference/syntax/temperatures' },
|
|
{ label: 'Intermediate variables', translations: { fr: 'Variables intermédiaires' }, slug: 'docs/reference/syntax/intermediate-variables' },
|
|
{ label: 'Relative quantities', translations: { fr: 'Quantités relatives' }, slug: 'docs/reference/syntax/relative-quantities' },
|
|
{ label: 'Composite ingredients', translations: { fr: 'Ingrédients composites' }, slug: 'docs/reference/syntax/composite-ingredients' },
|
|
{ label: 'Cheatsheet', translations: { fr: 'Antisèche' }, slug: 'docs/reference/syntax/cheatsheet' },
|
|
{ label: 'Writing Gram programmatically', translations: { fr: 'Génération automatisée de Gram' }, slug: 'docs/reference/syntax/ai-generation-notes' }
|
|
]
|
|
},
|
|
{
|
|
label: 'Tooling reference',
|
|
translations: { fr: 'Référence des outils' },
|
|
collapsed: false,
|
|
items: [
|
|
{ label: 'CLI commands', translations: { fr: 'Commandes CLI' }, slug: 'docs/reference/tooling/cli' },
|
|
{ label: 'VS Code extension', translations: { fr: 'Extension VS Code' }, slug: 'docs/reference/tooling/vscode-extension' },
|
|
{ label: 'Language server', slug: 'docs/reference/tooling/language-server' }
|
|
]
|
|
},
|
|
{
|
|
label: 'API reference',
|
|
translations: { fr: 'Référence API' },
|
|
collapsed: true,
|
|
items: [
|
|
{ label: 'Overview', translations: { fr: "Vue d'ensemble" }, slug: 'docs/reference/api' },
|
|
{ label: '@gram-lang/parser', slug: 'docs/reference/api/parser' },
|
|
{ label: '@gram-lang/modules', slug: 'docs/reference/api/modules', badge: { text: 'v1.2.0', variant: 'default' } },
|
|
{ label: '@gram-lang/kitchen', slug: 'docs/reference/api/kitchen' },
|
|
{ label: '@gram-lang/scheduler', slug: 'docs/reference/api/scheduler', badge: { text: 'v1.4.0', variant: 'default' } },
|
|
{ label: '@gram-lang/analyzer', slug: 'docs/reference/api/analyzer' },
|
|
{ label: '@gram-lang/renderer', slug: 'docs/reference/api/renderer' },
|
|
{ label: '@gram-lang/format', slug: 'docs/reference/api/format' },
|
|
{ label: '@gram-lang/i18n', slug: 'docs/reference/api/i18n' },
|
|
{ label: 'Data formats', translations: { fr: 'Formats de données' }, slug: 'docs/reference/api/data-formats' },
|
|
{ label: 'Warnings', translations: { fr: 'Avertissements' }, slug: 'docs/reference/api/warnings' }
|
|
]
|
|
},
|
|
{
|
|
label: 'Gram engine',
|
|
translations: { fr: 'Moteur Gram' },
|
|
collapsed: true,
|
|
items: [
|
|
{ label: 'The Gram lifecycle', translations: { fr: 'Cycle de vie' }, slug: 'docs/explanation/engine/lifecycle' },
|
|
{ label: 'Parsing & AST', slug: 'docs/explanation/engine/parser' },
|
|
{ label: 'Module resolution & composition', translations: { fr: 'Résolution & composition' }, slug: 'docs/explanation/engine/modules', badge: { text: 'v1.2.0', variant: 'default' } },
|
|
{ label: 'Compilation & structure', translations: { fr: 'Compilation & structure' }, slug: 'docs/explanation/engine/kitchen' },
|
|
{ label: 'The scheduling engine', translations: { fr: "Le moteur d'ordonnancement" }, slug: 'docs/explanation/engine/scheduler', badge: { text: 'v1.4.0', variant: 'default' } },
|
|
{ label: 'Semantic analysis', translations: { fr: 'Analyse sémantique' }, slug: 'docs/explanation/engine/analyzer' },
|
|
{ label: 'Rendering & output', translations: { fr: 'Rendu & sortie' }, slug: 'docs/explanation/engine/renderer' }
|
|
]
|
|
},
|
|
{
|
|
label: 'Deep dives',
|
|
translations: { fr: 'Analyses approfondies' },
|
|
collapsed: true,
|
|
items: [
|
|
{ label: 'ALAP scheduling', translations: { fr: 'Ordonnancement ALAP' }, slug: 'docs/explanation/alap-scheduling' },
|
|
{ label: 'Mass & yield', translations: { fr: 'Masse & rendement' }, slug: 'docs/explanation/mass-and-yield' },
|
|
{ label: 'Nutrition', slug: 'docs/explanation/nutrition' },
|
|
{ label: 'Shopping lists', translations: { fr: 'Liste de courses' }, slug: 'docs/explanation/shopping-list-aggregation' },
|
|
{ label: 'Scaling', translations: { fr: "Ajustement des proportions" }, slug: 'docs/explanation/scaling' },
|
|
{ label: 'Planning & run sheet', translations: { fr: 'Planification & plan de marche' }, slug: 'docs/explanation/planning', badge: { text: 'v1.4.0', variant: 'default' } }
|
|
]
|
|
},
|
|
{ label: 'Changelog', translations: { fr: 'Changelog' }, slug: 'docs/changelog' }
|
|
],
|
|
head: [
|
|
{
|
|
tag: 'meta',
|
|
attrs: {
|
|
property: 'og:image',
|
|
content: `${SITE_URL}/gram-social-wide.png`
|
|
}
|
|
},
|
|
{
|
|
tag: 'meta',
|
|
attrs: {
|
|
property: 'og:image:width',
|
|
content: '1200'
|
|
}
|
|
},
|
|
{
|
|
tag: 'meta',
|
|
attrs: {
|
|
property: 'og:image:height',
|
|
content: '630'
|
|
}
|
|
},
|
|
{
|
|
tag: 'meta',
|
|
attrs: {
|
|
name: 'twitter:image',
|
|
content: `${SITE_URL}/gram-social-wide.png`
|
|
}
|
|
},
|
|
...(isProd ? [{
|
|
tag: /** @type {'script'} */ ('script'),
|
|
attrs: {
|
|
defer: true,
|
|
src: UMAMI_SCRIPT_SRC,
|
|
'data-website-id': UMAMI_WEBSITE_ID
|
|
}
|
|
}, {
|
|
tag: /** @type {'script'} */ ('script'),
|
|
content: GLOBAL_TRACKING_SCRIPT
|
|
}] : []),
|
|
{
|
|
tag: 'script',
|
|
content: FR_REDIRECT_SCRIPT
|
|
}
|
|
],
|
|
social: [
|
|
{
|
|
label: 'Forgejo (Primary repository)',
|
|
icon: 'seti:git',
|
|
href: 'https://git.gram-lang.org/gram-lang/gram'
|
|
},
|
|
{
|
|
label: 'Codeberg Mirror',
|
|
icon: 'codeberg',
|
|
href: 'https://codeberg.org/gram-lang/gram'
|
|
},
|
|
{
|
|
label: 'GitHub Mirror',
|
|
icon: 'github',
|
|
href: 'https://github.com/gram-lang/gram'
|
|
}
|
|
]
|
|
}),
|
|
mdx(),
|
|
{
|
|
name: 'override-shiki-themes',
|
|
hooks: {
|
|
'astro:config:setup': ({ updateConfig }) => {
|
|
updateConfig({
|
|
markdown: {
|
|
shikiConfig: {
|
|
themes: {
|
|
light: 'github-light',
|
|
dark: 'github-dark'
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
],
|
|
vite: {
|
|
build: {
|
|
target: 'esnext'
|
|
},
|
|
esbuild: {
|
|
target: 'esnext'
|
|
},
|
|
optimizeDeps: {
|
|
rolldownOptions: {
|
|
transform: {
|
|
target: 'esnext'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|