Skip to content

Commit f165924

Browse files
committed
docs+devcontainer: 快速开始重排(在线可用/本地两步走/fork 保存进度),Codespaces 环境修复
- devcontainer: xlings 升至 v0.4.68;xlings install 加 -y(非交互环境不再挂起); postAttach 显式补 PATH;postCreate 预热 Provider,首次进入 checker 不再长时间无反馈 - README(en/zh/zh.hant): 本地流程拆为 安装 d2x 工具 -> 获取课程(d2x install / git clone 二选一) -> 开始练习;新增 fork 后用 git commit/push 保存练习进度的建议
1 parent 247f7d6 commit f165924

5 files changed

Lines changed: 86 additions & 16 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
},
1414
"remoteUser": "vscode",
1515
"postCreateCommand": "/bin/bash .devcontainer/postCreate.sh",
16-
"postAttachCommand": "d2x checker"
16+
"postAttachCommand": "/bin/bash -c 'export PATH=\"$HOME/.xlings/subos/current/bin:$PATH\"; d2x checker'"
1717
}

.devcontainer/postCreate.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
# postCreate.sh
21
#!/usr/bin/env bash
2+
# Codespaces/devcontainer 初始化:安装 xlings,再按 .xlings.json 配置课程工具链(mcpp + d2x)
33
set -euo pipefail
44

55
sudo apt-get update
66
sudo apt-get install -y ncurses-bin libtinfo6 libncursesw6 curl ca-certificates git
77

88
if ! command -v xlings >/dev/null 2>&1; then
9-
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash -s -- v0.4.14
9+
curl -fsSL https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_install.sh | bash -s "v0.4.68"
1010
fi
1111

12-
echo "xlings installed"
13-
14-
# source PATH so xlings/d2x are available in this shell
1512
export PATH="$HOME/.xlings/subos/current/bin:$PATH"
16-
[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"
1713

18-
xlings install
14+
xlings update
15+
xlings install -y
16+
17+
# 预热 Provider:把首次构建(含工具链下载)放在环境准备阶段,
18+
# 避免首次进入 d2x checker 时长时间无反馈。
19+
mcpp run -q -p d2x/buildtools -- describe > /dev/null \
20+
|| echo "warning: provider warm-up failed; d2x checker will build it on first run"
21+
22+
echo "d2mcpp environment ready"

README.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
3838
### Interactive Code Practice (Online)
3939

40-
> [**click the button below**](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=mcpp-community/d2mcpp) to automatically complete the configuration in the cloud and enter the practice code detection mode
40+
> [**click the button below**](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=mcpp-community/d2mcpp) — the cloud environment configures itself (a few minutes on first launch), then the exercise checker starts automatically
4141
4242
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=mcpp-community/d2mcpp)
4343

4444
### Interactive Code Practice (Local)
4545

46+
**Step 1 - Install the d2x tool**
47+
4648
<details>
4749
<summary>click to view xlings installation command</summary>
4850

@@ -68,8 +70,28 @@ irm https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_i
6870

6971
```bash
7072
xlings install d2x -y # exercise framework CLI
71-
d2x install d2mcpp # get the course, environment auto-configured
73+
```
74+
75+
**Step 2 - Get the course (choose one)**
76+
77+
```bash
78+
# Option A - one command: download the course, toolchain auto-configured
79+
d2x install d2mcpp
80+
cd d2mcpp
81+
```
82+
83+
```bash
84+
# Option B - git clone the source
85+
git clone https://github.com/mcpp-community/d2mcpp.git # or your fork
7286
cd d2mcpp
87+
xlings install -y # toolchain pinned by .xlings.json
88+
```
89+
90+
> Tip: fork this repo and clone your fork — `git commit / push` keeps your practice progress in your own repository.
91+
92+
**Step 3 - Start practicing**
93+
94+
```bash
7395
d2x checker # practice loop: edit -> save -> auto-check -> advance
7496
d2x status # progress overview
7597
```

README.zh.hant.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
3838
### 線上程式碼練習
3939

40-
> [**點擊下方按鈕**](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=mcpp-community/d2mcpp) 即可在雲端自動完成設定, 並進入練習程式碼偵測模式
40+
> [**點擊下方按鈕**](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=mcpp-community/d2mcpp) —— 雲端自動完成環境設定(首次啟動需幾分鐘), 隨後自動進入練習偵測模式
4141
4242
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=mcpp-community/d2mcpp)
4343

4444
### 建立本地練習環境
4545

46+
**第一步 - 安裝 d2x 工具**
47+
4648
<details>
4749
<summary>點選查看xlings安裝指令</summary>
4850

@@ -68,9 +70,29 @@ irm https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_i
6870

6971
```bash
7072
xlings install d2x -y # 練習框架 CLI
71-
d2x install d2mcpp # 一鍵獲取課程,環境自動配置
73+
```
74+
75+
**第二步 - 獲取課程(二選一)**
76+
77+
```bash
78+
# 方式 A - 一鍵安裝: 下載課程,環境自動配置
79+
d2x install d2mcpp
80+
cd d2mcpp
81+
```
82+
83+
```bash
84+
# 方式 B - git clone 原始碼
85+
git clone https://github.com/mcpp-community/d2mcpp.git # 或你 fork 後的倉庫
7286
cd d2mcpp
73-
d2x checker # 練習循環: 編輯 -> 保存 -> 自動檢測 -> 推進
87+
xlings install -y # 按 .xlings.json 安裝固定版本工具鏈
88+
```
89+
90+
> 建議: 先 fork 本倉庫再 clone 自己的 fork —— 通過 `git commit / push` 把練習進度保存到自己的倉庫裡。
91+
92+
**第三步 - 開始練習**
93+
94+
```bash
95+
d2x checker # 練習循環: 編輯 -> 保存 -> 自動偵測 -> 推進
7496
d2x status # 進度總覽
7597
```
7698

README.zh.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@
3333

3434
## 快速开始
3535

36+
> 尝试 `Code -> Book -> Video -> X -> Code`
37+
3638
### 在线代码练习
3739

38-
> [**点击下面按钮**](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=mcpp-community/d2mcpp) 即可在云端自动完成配置, 并进入练习代码检测模式
40+
> [**点击下面按钮**](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=mcpp-community/d2mcpp) —— 云端自动完成环境配置(首次启动需几分钟), 随后自动进入练习检测模式
3941
4042
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=mcpp-community/d2mcpp)
4143

4244
### 搭建本地练习环境
4345

44-
> 尝试 `Code -> Book -> Video -> X -> Code`
46+
**第一步 - 安装 d2x 工具**
4547

4648
<details>
4749
<summary>点击查看xlings安装命令</summary>
@@ -68,8 +70,28 @@ irm https://raw.githubusercontent.com/openxlings/xlings/main/tools/other/quick_i
6870

6971
```bash
7072
xlings install d2x -y # 练习框架 CLI
71-
d2x install d2mcpp # 一键获取课程,环境自动配置
73+
```
74+
75+
**第二步 - 获取课程(二选一)**
76+
77+
```bash
78+
# 方式 A - 一键安装: 下载课程,环境自动配置
79+
d2x install d2mcpp
80+
cd d2mcpp
81+
```
82+
83+
```bash
84+
# 方式 B - git clone 源码
85+
git clone https://github.com/mcpp-community/d2mcpp.git # 或你 fork 后的仓库
7286
cd d2mcpp
87+
xlings install -y # 按 .xlings.json 安装固定版本工具链
88+
```
89+
90+
> 建议: 先 fork 本仓库再 clone 自己的 fork —— 通过 `git commit / push` 把练习进度保存到自己的仓库里。
91+
92+
**第三步 - 开始练习**
93+
94+
```bash
7395
d2x checker # 练习循环: 编辑 -> 保存 -> 自动检测 -> 推进
7496
d2x status # 进度总览
7597
```

0 commit comments

Comments
 (0)