Welcome to the YSYX Project Website repository! This project serves as the new main page for the YSYX project study material, available at YSYX Project. The website is built using Docusaurus, a modern static website generator.
To ensure a consistent development environment, we use a Docker development container. This approach provides several benefits:
- Consistency: All developers work in the same environment, eliminating "it works on my machine" issues.
- Isolation: Keeps the development environment isolated from the host system, preventing conflicts with other projects or dependencies.
- Ease of Setup: Simplifies the setup process by providing a pre-configured environment with all necessary dependencies.
- Portability: Allows the development environment to be easily shared and replicated across different machines.
Here’s how to get started:
-
Update
TAG
in the Makefile: Set the desired release tag (default is the latest release). -
Start the container and development server:
docker compose run -P docusaurus make pull npm run start -- --host 0.0.0.0
-
Access the website: Open your host browser and navigate to the local development server.
To build the Docker development container, run:
docker compose build
To start the Docker development container, run:
docker compose run -P docusaurus
The -P
flag exposes the port for the web server, allowing you to connect to the website hosted inside the container from your host browser.
If using Docker, start the development server with:
npm run start -- --host 0.0.0.0
This command starts a local development server and opens a browser window. Most changes are reflected live without having to restart the server.
pull_content
is a Python script used to sync content from a GitHub release of the documentation content. It can be run directly or via make
. Usually, developers should run:
make pull
This invokes the following command:
pull_content --repo oscc-web/ysyx-docs-content --tag latest --map zh:docs --map en:i18n/en/docusaurus-plugin-content-docs/current
The script can be used from the command line with the following syntax:
pull_content.py [--map <source:destination>]...
--repo
: The GitHub repository in the formatowner/repo
.--tag
: The release tag to download.--map
or-m
: Mapping in the formatsource:destination
. This argument can be provided multiple times.
Example 1: Basic Download and Extraction
Download and extract a release from the repository oscc-web/ysyx-docs-content
with the tag latest
.
pull_content.py oscc-web/ysyx-docs-content latest
Example 2: Mapping Folders
Download the release and map the zh
and en
folders to specific destinations.
pull_content.py oscc-web/ysyx-docs-content latest --map zh:./zh --map en:./en
The content synchronization process involves pulling the latest documentation from the GitHub repository and mapping it to the appropriate directories in the project. Here is a visual representation of the process:
The docs
directory contains the documentation files organized in a hierarchical format. Each Markdown file represents a documentation page, and these files can be grouped into subdirectories to create a structured documentation hierarchy. The docs
directory is essential for organizing and managing the content of your documentation site.
The i18n
directory is used for internationalization (i18n) support. It contains translation files for different locales, allowing the website to be translated into multiple languages. Each locale has its own subdirectory within the i18n
directory, and each subdirectory contains the necessary translation files for that locale. This structure enables the website to support multiple languages and provides a flexible translation workflow.
To generate static content into the build
directory, run:
npm run build
This content can be served using any static content hosting service.
To be determined (TBD)