### Setup Local Development Source: https://context7.com/gar-b-age/cooklikehoc/llms.txt Node.js development workflow for VitePress documentation. Requires Node.js v18+, includes development server and production build commands. ```bash # Clone the repository git clone https://github.com/Gar-b-age/CookLikeHOC.git cd CookLikeHOC # Install dependencies (requires Node.js v18+) npm install # Run development server with auto-generated indexes npm run docs:dev # Access at http://localhost:5173/ # Build for production npm run docs:build # Output: .vitepress/dist/ ``` -------------------------------- ### Deploy with Docker Source: https://context7.com/gar-b-age/cooklikehoc/llms.txt Multi-stage Docker build process using Node.js Alpine for compilation and nginx Alpine for runtime. Includes build commands and container startup with port mapping. ```dockerfile # Build stage FROM node:22-alpine AS dist-env WORKDIR /app COPY . . RUN npm install --loglevel verbose RUN npm run build # Runtime stage FROM nginx:1-alpine COPY default.conf /etc/nginx/conf.d/ COPY --from=dist-env /app/.vitepress/dist/ /usr/share/nginx/html EXPOSE 80 ``` ```bash # Build Docker image docker build -t cooklikehoc:0.0.1 -f docker_support/Dockerfile . # Run container docker run -d --name cooklikehoc \ -p 3001:80 \ -e HOST=0.0.0.0 \ cooklikehoc:0.0.1 # Access at http://localhost:3001/ ``` -------------------------------- ### Ingredient Preparation Markdown Template Source: https://context7.com/gar-b-age/cooklikehoc/llms.txt Provides a markdown template for documenting ingredient preparations like sauces, referenced across recipe files for consistency. No runtime dependencies; inputs are textual descriptions and ratios; outputs referenced sections in recipes. Limitations: Relies on manual updates for undisclosed official ratios, allowing personal adjustments. ```markdown # 剁椒酱 (Chopped Chili Sauce) ## 已知成分 - 剁椒、小米辣、蒜子、盐等 详细成分与配比老乡鸡官方未公布,请依据个人口味适量调整 # These ingredient files are referenced by main recipe files # Provides standardized components for consistent flavor profiles ``` -------------------------------- ### NPM Package Scripts for Build and Development Source: https://context7.com/gar-b-age/cooklikehoc/llms.txt Defines npm scripts for managing the VitePress-based documentation site, including prebuild steps for generating indexes from recipe directories. Depends on Node.js, npm, and VitePress; inputs are project directories with markdown files; outputs static site build or dev server. Limitations include reliance on custom MJS script for index generation, which must be maintained for new categories. ```json { "scripts": { "prebuild:indexes": "node ./.vitepress/scripts/generate-indexes.mjs", "docs:dev": "npm run prebuild:indexes && vitepress dev .", "docs:build": "npm run prebuild:indexes && vitepress build .", "docs:preview": "vitepress preview .", "build": "npm run docs:build", "start": "npm run docs:dev" } } ``` ```bash # All commands automatically run prebuild:indexes first npm start # Development server with hot reload npm run build # Production build npm run docs:preview # Preview production build locally ``` -------------------------------- ### Configure VitePress Documentation Source: https://context7.com/gar-b-age/cooklikehoc/llms.txt VitePress configuration optimized for Chinese recipe documentation. Sets up language, navigation, search, and build exclusions for the documentation site. ```javascript // .vitepress/config.mjs import { defineConfig } from 'vitepress' export default defineConfig({ lang: 'zh-CN', title: 'CookLikeHOC', description: '像老乡鸡那样做饭', base: '/CookLikeHOC/', themeConfig: { logo: '/logo.png', search: { provider: 'local' }, outline: [2, 3], // Show h2 and h3 in outline docFooter: { prev: '上一页', next: '下一页' }, lastUpdatedText: '上次更新', }, srcExclude: ['**/README.md'], // Exclude auto-generated indexes ignoreDeadLinks: true, cleanUrls: true, }) ``` -------------------------------- ### Recipe Category Directory Structure in Bash Source: https://context7.com/gar-b-age/cooklikehoc/llms.txt Illustrates the organization of recipe categories into directories named in Chinese, used for auto-generating navigation and indexes. No dependencies beyond file system; inputs are markdown files in subdirectories; outputs structured navigation for the site. Limitations: Manual addition of new categories requires updating any generation scripts. ```bash # Recipe categories (auto-generated navigation): 炒菜/ # Stir-fried dishes (largest category) 汤/ # Soups 蒸菜/ # Steamed dishes 炸品/ # Fried items 炖菜/ # Braised/stewed dishes 煮锅/ # Hot pot dishes 砂锅菜/ # Clay pot dishes 烫菜/ # Blanched dishes 凉拌/ # Cold dishes 卤菜/ # Braised/marinated dishes 烤类/ # Grilled/roasted items 早餐/ # Breakfast items 主食/ # Staple foods (rice, noodles) 配料/ # Ingredient preparations and sauces 饮品/ # Beverages # Each directory contains: # - README.md (auto-generated index) # - Individual recipe .md files # - Linked images in /images/ directory ``` -------------------------------- ### Generate Navigation and Sidebar Source: https://context7.com/gar-b-age/cooklikehoc/llms.txt Dynamic navigation generator that scans recipe directories and automatically builds VitePress navigation structure. Processes directory structure to create organized navigation and sidebar with Chinese character sorting. ```javascript import { generateNavAndSidebar } from './.vitepress/navSidebar.mjs' // Generates navigation and sidebar from directory structure const { nav, sidebar } = generateNavAndSidebar(process.cwd()) // Excluded directories from scanning const EXCLUDED_DIRS = new Set([ '.git', '.github', '.vitepress', 'node_modules', 'public', 'docs', 'images', 'docker_support' ]) // Directory structure automatically becomes navigation: // 炒菜/ → Stir-fry section with all .md files // 汤/ → Soup section with all .md files // Each directory gets its own sidebar with sorted entries ``` -------------------------------- ### Document Recipe Format Source: https://context7.com/gar-b-age/cooklikehoc/llms.txt Standardized markdown recipe template with ingredients (配料) and preparation steps (步骤). Supports image embedding and structured formatting for consistent recipe documentation. ```markdown # 什锦蛋炒饭 ![什锦蛋炒饭](../images/什锦蛋炒饭.png) ## 配料 - 三色杂菜(玉米、豌豆、胡萝卜) - 香肠 - 鸡蛋 - 米饭 - 大豆油 ## 步骤 - 1. 锅中下入75g 大豆油,将250g 鸡蛋液炒成蛋片; - 2. 下入150g 三色杂菜、100g 香肠丁,炒出香味; - 3. 再下入1500g 米饭、8g 盐,翻炒均匀。 ``` -------------------------------- ### Generate Category Indexes Source: https://context7.com/gar-b-age/cooklikehoc/llms.txt Automated build script that creates README.md files for recipe categories. Sorts entries by Chinese pinyin and only overwrites files marked with AUTO-GENERATED comment. ```javascript // .vitepress/scripts/generate-indexes.mjs import fs from 'node:fs' import path from 'node:path' // Run before build to generate category indexes // npm run prebuild:indexes function buildIndexContent(dirName, files) { const header = `# ${dirName}\n\n\n\n` if (files.length === 0) return header + '(暂无条目)\n' const list = files .sort((a, b) => a.localeCompare(b, 'zh-Hans-CN-u-co-pinyin')) .map((f) => `- [${f.replace(/\.md$/i, '')}](${encodeURI('./' + f)})`) .join('\n') return header + list + '\n' } // Scans all category directories and generates indexes // Only overwrites files marked with AUTO-GENERATED comment // Sorts entries by Chinese pinyin for proper ordering ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.