Skip to content

Commit aab6abf

Browse files
committed
更新部署文档,调整依赖安装策略为使用 npm install,新增依赖管理部分以提高版本兼容性和缓存优化,确保文档生成流程的稳定性。
1 parent e8efcb0 commit aab6abf

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
cache: 'npm'
4040

4141
- name: Install dependencies
42-
run: npm ci
42+
run: npm install
4343

4444
- name: Build documentation
4545
run: npm run typedoc:markdown

DEPLOYMENT.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
1. **Checkout**: 检出代码
4040
2. **Setup Node.js**: 设置 Node.js 环境
41-
3. **Install dependencies**: 安装项目依赖
41+
3. **Install dependencies**: 安装项目依赖(使用 `npm install`
4242
4. **Build documentation**: 使用 TypeDoc 生成文档
4343
5. **Setup Pages**: 配置 GitHub Pages 环境
4444
6. **Upload artifact**: 上传生成的 `docs/` 目录作为构建产物
@@ -62,6 +62,21 @@
6262
npm run typedoc:markdown
6363
```
6464

65+
## 依赖管理
66+
67+
### 安装策略
68+
69+
工作流使用 `npm install` 而不是 `npm ci`,原因如下:
70+
71+
- **兼容性**: 更好地处理 `package-lock.json` 版本不匹配的情况
72+
- **灵活性**: 自动更新 lockfile 以匹配 `package.json`
73+
- **稳定性**: 避免因版本差异导致的安装失败
74+
75+
### 缓存优化
76+
77+
- 使用 GitHub Actions 的 npm 缓存
78+
- 减少重复安装的时间
79+
6580
## 自定义配置
6681

6782
### 修改部署路径
@@ -91,7 +106,7 @@ paths:
91106
### 常见问题
92107

93108
1. **构建失败**: 检查 TypeScript 编译错误
94-
2. **依赖安装失败**: 检查 `package-lock.json` 是否最新
109+
2. **依赖安装失败**: 检查网络连接和 npm 配置
95110
3. **部署失败**: 检查 Actions 标签中的错误信息
96111
4. **页面不显示**: 确保 TypeDoc 成功生成了 `docs/` 目录
97112

@@ -121,3 +136,4 @@ python -m http.server 8000 # 或其他本地服务器
121136
- 确保 TypeScript 代码能够正常编译
122137
- `.nojekyll` 文件确保 GitHub Pages 不会使用 Jekyll 处理
123138
- 文档基于 `src/index.ts` 中的导出内容生成
139+
- 使用 `npm install` 确保依赖版本兼容性

0 commit comments

Comments
 (0)