2026-01-29 16:00:19 +03:00
import { defineConfig } from 'vitepress' ;
2026-04-26 15:04:10 +03:00
const sidebar = [
2026-04-25 19:56:44 +03:00
{
text : 'Главная' ,
2026-04-26 15:04:10 +03:00
link : '/docs/' ,
2026-04-25 19:56:44 +03:00
} ,
2026-03-28 21:15:15 +03:00
{
text : 'Workflow' ,
2026-04-26 15:04:10 +03:00
link : '/docs/workflow' ,
2026-03-28 21:15:15 +03:00
} ,
{
text : 'Базовые правила' ,
items : [
2026-04-26 15:04:10 +03:00
{ text : 'Технологии и библиотеки' , link : '/docs/basics/tech-stack' } ,
{ text : 'Именование' , link : '/docs/basics/naming' } ,
2026-04-20 11:40:49 +03:00
{
text : 'Архитектура' ,
2026-04-20 11:44:27 +03:00
collapsed : true ,
2026-04-20 11:40:49 +03:00
items : [
2026-04-26 15:04:10 +03:00
{ text : 'Обзор' , link : '/docs/basics/architecture/' } ,
{ text : 'Слои' , link : '/docs/basics/architecture/reference/layers' } ,
{ text : 'Модули' , link : '/docs/basics/architecture/reference/modules' } ,
{ text : 'Сегменты' , link : '/docs/basics/architecture/reference/segments' } ,
2026-04-20 11:40:49 +03:00
] ,
} ,
2026-04-26 15:04:10 +03:00
{ text : 'Стиль кода' , link : '/docs/basics/code-style' } ,
{ text : 'Документирование' , link : '/docs/basics/documentation' } ,
{ text : 'Типизация' , link : '/docs/basics/typing' } ,
2026-03-28 21:15:15 +03:00
] ,
} ,
{
2026-04-27 00:54:26 +03:00
text : 'Установка и настройка' ,
2026-03-28 21:15:15 +03:00
items : [
2026-04-27 00:54:26 +03:00
{ text : 'Алиасы' , link : '/docs/setup/aliases' } ,
{ text : 'Biome' , link : '/docs/setup/biome' } ,
{ text : 'PostCSS' , link : '/docs/setup/postcss' } ,
{ text : 'SVG-спрайты' , link : '/docs/setup/svg-sprites' } ,
{ text : 'VS Code' , link : '/docs/setup/vscode' } ,
] ,
} ,
{
text : 'Использование' ,
items : [
{ text : 'Структура проекта' , link : '/docs/usage/project-structure' } ,
{ text : 'Компоненты' , link : '/docs/usage/components' } ,
{ text : 'Страницы (App Router)' , link : '/docs/usage/page-level' } ,
{ text : 'Шаблоны и генерация кода' , link : '/docs/usage/templates-generation' } ,
{ text : 'Стили' , link : '/docs/usage/styles' } ,
{ text : 'Изображения' , link : '/docs/usage/images-sprites' } ,
{ text : 'SVG-спрайты' , link : '/docs/usage/svg-sprites' } ,
{ text : 'Видео' , link : '/docs/usage/video' } ,
2026-04-26 22:50:51 +03:00
{
2026-04-27 00:54:26 +03:00
text : 'Данные' ,
2026-04-26 22:50:51 +03:00
collapsed : true ,
items : [
2026-04-27 00:54:26 +03:00
{ text : 'Введение' , link : '/docs/usage/data/' } ,
{
text : 'REST' ,
collapsed : true ,
items : [
{
text : 'Клиенты' ,
collapsed : true ,
items : [
{ text : 'Автоматическая генерация' , link : '/docs/usage/data/rest/clients/auto' } ,
{ text : 'Ручная генерация' , link : '/docs/usage/data/rest/clients/manual' } ,
] ,
} ,
{
text : 'Получение данных' ,
collapsed : true ,
items : [
{ text : 'Серверные компоненты' , link : '/docs/usage/data/rest/fetching/server' } ,
{ text : 'Клиентские компоненты' , link : '/docs/usage/data/rest/fetching/client' } ,
] ,
} ,
] ,
} ,
{ text : 'Realtime' , link : '/docs/usage/data/realtime' } ,
2026-04-26 22:50:51 +03:00
] ,
} ,
2026-04-27 00:54:26 +03:00
{ text : 'Stores' , link : '/docs/usage/stores' } ,
{ text : 'Хуки' , link : '/docs/usage/hooks' } ,
{ text : 'Шрифты' , link : '/docs/usage/fonts' } ,
{ text : 'Локализация' , link : '/docs/usage/localization' } ,
2026-03-28 21:15:15 +03:00
] ,
} ,
2026-04-27 00:54:26 +03:00
2026-03-28 21:15:15 +03:00
] ;
2026-04-25 18:06:27 +03:00
/ * *
* Vite - плагин : отдаёт ` .txt ` и ` .md ` с я в н о й к о д и р о в к о й UTF - 8 .
* Б е з э т о г о б р а у з е р д е к о д и р у е т к а к ISO - 8859 - 1 и к и р и л л и ц а л о м а е т с я .
* /
const utf8TextPlugin = {
name : 'utf8-text-files' ,
configureServer ( server : any ) {
server . middlewares . use ( ( req : any , res : any , next : any ) = > {
const url : string = req . url || '' ;
if ( url . endsWith ( '.txt' ) || url . endsWith ( '.md' ) ) {
res . setHeader ( 'Content-Type' , 'text/plain; charset=utf-8' ) ;
}
next ( ) ;
} ) ;
} ,
} ;
2026-03-28 21:15:15 +03:00
export default defineConfig ( {
srcDir : 'docs' ,
2026-04-25 18:06:27 +03:00
// `docs/public/` содержит сгенерированные `.md`-копии и `llms.txt` для LLM
// (попадают в корень `dist/` как статика). Исключаем из сканирования
// страниц, иначе VitePress рендерит их как HTML-страницы.
srcExclude : [ 'public/**' ] ,
2026-04-26 15:04:10 +03:00
lang : 'ru-RU' ,
2026-03-28 21:15:15 +03:00
title : 'NextJS Style Guide' ,
2026-04-26 15:04:10 +03:00
description : 'Стандарты разработки на Next.js + TypeScript с архитектурой SLM' ,
2026-03-28 21:15:15 +03:00
2026-04-25 18:06:27 +03:00
vite : {
plugins : [ utf8TextPlugin ] ,
define : {
__BUILD_VERSION__ : JSON.stringify ( process . env . BUILD_VERSION || 'dev' ) ,
} ,
2026-03-28 21:15:15 +03:00
} ,
2026-04-26 15:04:10 +03:00
themeConfig : {
sidebar ,
socialLinks : [
{ icon : 'github' , link : 'https://gromlab.ru/docs/nextjs-style-guide' } ,
] ,
2026-01-29 16:00:19 +03:00
} ,
2026-04-26 15:04:10 +03:00
// Расширенный блок описания для llms.txt — даёт LLM полный
// технический контекст: стек, методология, охват тем.
// Используется в generate-llms.ts.
llmsBlockquote :
'Стандарты разработки frontend-приложений на Next.js (App Router) + TypeScript + React с архитектурой SLM (Scoped Layered Module Design — модульная архитектура с о слоями ответственности, где каждый модуль содержит всё необходимое: компоненты, хуки, сторы, типы, стили).' ,
llmsContext :
'Стек: React, TypeScript, Next.js App Router, Mantine UI, SWR, Zustand, i18next, PostCSS Modules, Vitest, clsx.\n\nДо ку ме нта ция покрывает архитектуру SLM (слои, модули, сегменты, направление зависимостей, публичный API), правила оформления кода (именование, форматирование, импорты, типизация, JSDoc), реализацию компонентов и хуков, работу с App Router, кодогенерацию из шаблонов, стилизацию (Mobile First, токены), работу с API и сокетами, управление состоянием через Zustand, локализацию, ассеты (шрифты, изображения, SVG-спрайты) и настройку VS Code.' ,
} as any ) ;