Tools Installation and Environment Configuration
This chapter introduces how to install the d2x tool, create a template project, and perform basic environment configuration.
1. Installing the d2x Tool
Method 1: Installation via xlings Package Manager (Recommended)
xlings is an open-source package manager that can solve inconsistent dependency issues across different environments.
Click to view xlings installation command
Linux/MacOS
curl -fsSL https://d2learn.org/xlings-install.sh | bash
Windows - PowerShell
irm https://d2learn.org/xlings-install.ps1.txt | iex
tips: xlings -> details
xlings install d2x
Method 2: Building from Source
TODO...
2. Creating a Project & Testing
Creating a Project
Create via Template (Recommended)
Click the Create New Tutorial Template button to create a new tutorial project from the template repository. Then, clone the generated repository to your local machine.
git clone git@github.com:your_name/your_repo_name.git
Local Creation
Create a new project using the d2x new xxx command.
d2x new d2hello
After running the command, a directory named d2hello will be generated. Enter/open this directory to see the basic structure of the project.
Testing
Enter the root directory of the newly created project and run commands to test completeness.
Documentation Preview Command Test
Running the following command will open the project's documentation/book in your browser.
d2x book
Code Auto-Detection Function Test
Running the checker command below will enter the real-time code detection mode in the console. When you modify the file code, the console will update automatically.
d2x checker