How flutterchina/flutter_in_action_2nd works
Project type and purpose
• This is a static documentation/book website built with VuePress (Node.js-based static site generator).
• Purpose: render markdown chapters (src/*.md) into a bilingual Flutter tutorial site and e-book (docs/ directory) and deploy it (e.g., GitHub Pages).
File structure
• Top-level:
• package.json / package-lock.json – Node.js dependencies & scripts.
• src/ – source markdown chapters, VuePress config (.vuepress/) and theme files.
• docs/ – generated static output: HTML, CSS, JS assets.
• app.js, doc.js, deploy.sh, doc.sh – custom build/dev/server scripts.
• Patterns: Static Site Generation (SSG) with clear separation: content (markdown) → generator (VuePress + custom scripts) → output (docs).
README for additional insights
• Confirms it’s a Flutter book (“Flutter实战·第二版”), updated via markdown in src/, deployed online.
• Encourages weekly updates and uses GitHub issues for feedback.
Main components & their interactions
a. Components
• Content Layer: Markdown files (src/**/*.md)
• SSG Engine: VuePress (src/.vuepress/, themes, layouts)
• Build Scripts: doc.js (build logic), doc.sh (build wrapper), app.js (local dev server)
• Output Layer: Static site (docs/ folder)
• Deployment: deploy.sh pushes docs/ to hosting (e.g., GitHub Pages)
• External Services: GitHub (repo, issues), GitHub Pages (hosting)
b. Relationships / Data Flow
• Developer runs npm run docs:build (calls doc.sh → doc.js)
• VuePress processes src/**/*.md through theme/layouts → emits HTML+assets into docs/
• deploy.sh takes docs/ and updates remote hosting branch
• End users load static assets via CDN/GitHub Pages
c. Architectural patterns / design principles
• Static Site Generation (SSG) – pre-rendering for performance & SEO
• Separation of concerns: content vs. presentation (theme) vs. config vs. build/deploy scripts
• Convention over configuration (VuePress folder layout)
d. Key technologies
• Node.js / npm
• VuePress (Vue.js, webpack under the hood)
• Markdown → HTML
• Shell scripts for orchestration
• GitHub Pages for hosting