- добавлен генератор llms-full.txt: вся документация локали в одном
файле с мета-якорями, порядок повторяет sidebar
- архив теперь содержит README.md как точку входа: карта документации
с относительными ссылками, описаниями и метаинфо сборки
- ссылки /ru/... в .md-файлах архива преобразуются в относительные
пути (через path.relative) — внутренняя навигация работает локально
- веб-index.md удаляется из архива (его роль выполняет README.md)
- llms-full.txt добавлен в архив для одноразового чтения LLM
- в sidebar добавлен пункт «Главная» / «Home» со ссылкой на корень локали
- карточка «Ассистенту» на лендинге: две кнопки llms.txt и llms-full.txt
с открытием в новой вкладке
- активирована карточка «Скачать правила» (ru) с ссылкой на zip-архив
- удалён устаревший блок «Для ассистентов» из docs/{ru,en}/index.md
- обновлены описания на главных локалей и заменён FSD на SLM в EN
- в манифесте появилось поле llmsFull рядом с llms
171 lines
8.2 KiB
TypeScript
171 lines
8.2 KiB
TypeScript
import { defineConfig } from 'vitepress';
|
||
|
||
const ruSidebar = [
|
||
{
|
||
text: 'Главная',
|
||
link: '/ru/',
|
||
},
|
||
{
|
||
text: 'Workflow',
|
||
link: '/ru/workflow',
|
||
},
|
||
{
|
||
text: 'Базовые правила',
|
||
items: [
|
||
{ text: 'Технологии и библиотеки', link: '/ru/basics/tech-stack' },
|
||
{ text: 'Именование', link: '/ru/basics/naming' },
|
||
{
|
||
text: 'Архитектура',
|
||
collapsed: true,
|
||
items: [
|
||
{ text: 'Обзор', link: '/ru/basics/architecture/' },
|
||
{ text: 'Слои', link: '/ru/basics/architecture/reference/layers' },
|
||
{ text: 'Модули', link: '/ru/basics/architecture/reference/modules' },
|
||
{ text: 'Сегменты', link: '/ru/basics/architecture/reference/segments' },
|
||
],
|
||
},
|
||
{ text: 'Стиль кода', link: '/ru/basics/code-style' },
|
||
{ text: 'Документирование', link: '/ru/basics/documentation' },
|
||
{ text: 'Типизация', link: '/ru/basics/typing' },
|
||
],
|
||
},
|
||
{
|
||
text: 'Прикладные разделы',
|
||
items: [
|
||
{ text: 'Структура проекта', link: '/ru/applied/project-structure' },
|
||
{ text: 'Компоненты', link: '/ru/applied/components' },
|
||
{ text: 'Страницы (App Router)', link: '/ru/applied/page-level' },
|
||
{ text: 'Шаблоны и генерация кода', link: '/ru/applied/templates-generation' },
|
||
{ text: 'Стили', link: '/ru/applied/styles' },
|
||
{ text: 'Изображения', link: '/ru/applied/images-sprites' },
|
||
{ text: 'SVG-спрайты', link: '/ru/applied/svg-sprites' },
|
||
{ text: 'Видео', link: '/ru/applied/video' },
|
||
{ text: 'API', link: '/ru/applied/api' },
|
||
{ text: 'Stores', link: '/ru/applied/stores' },
|
||
{ text: 'Хуки', link: '/ru/applied/hooks' },
|
||
{ text: 'Шрифты', link: '/ru/applied/fonts' },
|
||
{ text: 'Локализация', link: '/ru/applied/localization' },
|
||
{ text: 'Настройка VS Code', link: '/ru/applied/vscode' },
|
||
],
|
||
},
|
||
];
|
||
|
||
const enSidebar = [
|
||
{
|
||
text: 'Home',
|
||
link: '/en/',
|
||
},
|
||
{
|
||
text: 'Processes',
|
||
items: [
|
||
{ text: 'Getting Started', link: '/en/workflow/getting-started' },
|
||
{ text: 'Creating an App', link: '/en/workflow/creating-app' },
|
||
{ text: 'Creating Pages', link: '/en/workflow/creating-pages' },
|
||
{ text: 'Creating Components', link: '/en/workflow/creating-components' },
|
||
{ text: 'Styling', link: '/en/workflow/styling' },
|
||
{ text: 'Data Fetching', link: '/en/workflow/data-fetching' },
|
||
{ text: 'State Management', link: '/en/workflow/state-management' },
|
||
{ text: 'Localization', link: '/en/workflow/localization' },
|
||
],
|
||
},
|
||
{
|
||
text: 'Basic Rules',
|
||
items: [
|
||
{ text: 'Tech Stack', link: '/en/basics/tech-stack' },
|
||
{ text: 'Architecture', link: '/en/basics/architecture' },
|
||
{ text: 'Code Style', link: '/en/basics/code-style' },
|
||
{ text: 'Naming', link: '/en/basics/naming' },
|
||
{ text: 'Documentation', link: '/en/basics/documentation' },
|
||
{ text: 'Typing', link: '/en/basics/typing' },
|
||
],
|
||
},
|
||
{
|
||
text: 'Applied Sections',
|
||
items: [
|
||
{ text: 'VS Code Setup', link: '/en/applied/vscode' },
|
||
{ text: 'Project Structure', link: '/en/applied/project-structure' },
|
||
{ text: 'Components', link: '/en/applied/components' },
|
||
{ text: 'Page-level Components', link: '/en/applied/page-level' },
|
||
{ text: 'Templates & Code Generation', link: '/en/applied/templates-generation' },
|
||
{ text: 'Styles', link: '/en/applied/styles' },
|
||
{ text: 'Images', link: '/en/applied/images-sprites' },
|
||
{ text: 'SVG Sprites', link: '/en/applied/svg-sprites' },
|
||
{ text: 'Video', link: '/en/applied/video' },
|
||
{ text: 'API', link: '/en/applied/api' },
|
||
{ text: 'Stores', link: '/en/applied/stores' },
|
||
{ text: 'Hooks', link: '/en/applied/hooks' },
|
||
{ text: 'Fonts', link: '/en/applied/fonts' },
|
||
{ text: 'Localization', link: '/en/applied/localization' },
|
||
],
|
||
},
|
||
];
|
||
|
||
/**
|
||
* 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();
|
||
});
|
||
},
|
||
};
|
||
|
||
export default defineConfig({
|
||
srcDir: 'docs',
|
||
// `docs/public/` содержит сгенерированные `.md`-копии и `llms.txt` для LLM
|
||
// (попадают в корень `dist/` как статика). Исключаем из сканирования
|
||
// страниц, иначе VitePress рендерит их как HTML-страницы.
|
||
srcExclude: ['public/**'],
|
||
title: 'NextJS Style Guide',
|
||
description: 'Правила и стандарты разработки на NextJS и TypeScript',
|
||
|
||
vite: {
|
||
plugins: [utf8TextPlugin],
|
||
define: {
|
||
__BUILD_VERSION__: JSON.stringify(process.env.BUILD_VERSION || 'dev'),
|
||
},
|
||
},
|
||
|
||
locales: {
|
||
root: {
|
||
label: 'Languages',
|
||
lang: 'en',
|
||
},
|
||
ru: {
|
||
label: 'Русский',
|
||
lang: 'ru-RU',
|
||
link: '/',
|
||
description: 'Стандарты разработки на Next.js + TypeScript с архитектурой SLM',
|
||
themeConfig: {
|
||
sidebar: ruSidebar,
|
||
},
|
||
// Расширенный блок описания для llms.txt — даёт LLM полный
|
||
// технический контекст: стек, методология, охват тем.
|
||
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.',
|
||
},
|
||
en: {
|
||
label: 'English',
|
||
lang: 'en-US',
|
||
link: '/',
|
||
description: 'Next.js + TypeScript development standards with SLM architecture',
|
||
themeConfig: {
|
||
sidebar: enSidebar,
|
||
},
|
||
llmsBlockquote:
|
||
'Frontend development standards for Next.js (App Router) + TypeScript + React projects with SLM architecture (Scoped Layered Module Design — a modular architecture with responsibility layers, where each module contains everything it needs: components, hooks, stores, types, styles).',
|
||
llmsContext:
|
||
'Stack: React, TypeScript, Next.js App Router, Mantine UI, SWR, Zustand, i18next, PostCSS Modules, Vitest, clsx.\n\nThe documentation covers SLM architecture (layers, modules, segments, dependency direction, public API), code conventions (naming, formatting, imports, typing, JSDoc), component and hook implementation, App Router usage, code generation from templates, styling (Mobile First, design tokens), API and socket integration, state management via Zustand, localization, assets (fonts, images, SVG sprites), and VS Code setup.',
|
||
},
|
||
},
|
||
});
|