feat: rename project to TTTK

- Update package name and CLI binary to 'tttk'
- Revise documentation to reflect new name
- Add default serve behavior when no subcommand is given
- Add directory existence check in serve command
- Refactor inline comments to Chinese
This commit is contained in:
hyper
2026-07-09 14:14:45 +08:00
parent c38d9bdc4f
commit 06c3916a95
8 changed files with 111 additions and 95 deletions
+16 -16
View File
@@ -1,18 +1,18 @@
# CLI 使用说明
TTRPG Tools 提供一个 CLI 工具,用于将目录内的各种 TTRPG 文档编译为 HTML。
TTTK 提供一个 CLI 工具,用于将目录内的各种 TTRPG 文档编译为 HTML。
## 安装
```bash
# 克隆仓库后安装依赖
npm install
# 无需安装,直接运行
npx tttk serve ./content
# 全局链接 CLI 工具
npm link
# 全局安装
npm install -g tttk
```
安装完成后,可在任意目录使用 `ttrpg` 命令。
安装完成后,可在任意目录使用 `tttk` 命令。
## 命令
@@ -23,7 +23,7 @@ CLI 使用子命令组织:
运行一个 Web 服务器预览目录中的内容,并实时监听文件更新。
```bash
ttrpg serve [dir] -p 3000
tttk serve [dir] -p 3000
```
**参数:**
@@ -50,13 +50,13 @@ ttrpg serve [dir] -p 3000
```bash
# 预览当前目录
ttrpg serve
tttk serve
# 预览指定目录
ttrpg serve ./my-ttrpg-content
tttk serve ./my-ttrpg-content
# 指定端口
ttrpg serve ./docs -p 8080
tttk serve ./docs -p 8080
```
### compile - 编译模式
@@ -64,7 +64,7 @@ ttrpg serve ./docs -p 8080
将目录中的内容输出为带 hash 路由、单个 HTML 入口的 Web 应用。
```bash
ttrpg compile [dir] -o ./dist/output
tttk compile [dir] -o ./dist/output
```
**参数:**
@@ -90,13 +90,13 @@ ttrpg compile [dir] -o ./dist/output
```bash
# 编译当前目录
ttrpg compile
tttk compile
# 编译指定目录并输出到指定位置
ttrpg compile ./content -o ./build
tttk compile ./content -o ./build
# 编译并部署
ttrpg compile ./docs -o ./public && npm run preview
tttk compile ./docs -o ./public && npm run preview
```
## 输入文件
@@ -162,7 +162,7 @@ my-ttrpg-content/
```bash
# 使用其他端口
ttrpg serve -p 8080
tttk serve -p 8080
```
### 编译输出为空
@@ -174,5 +174,5 @@ ttrpg serve -p 8080
ls -R ./content
# 重新编译
ttrpg compile ./content -o ./dist/output
tttk compile ./content -o ./dist/output
```