Skip to content

Commit fa51de5

Browse files
committed
fix 错误
1 parent 8dd5044 commit fa51de5

File tree

98 files changed

+1112
-844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+1112
-844
lines changed

.github/workflows/fix-code-blocks.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Fix Code Blocks Daily
2+
3+
on:
4+
schedule:
5+
# 每天北京时间上午 9:00 执行 (UTC+8 = UTC 01:00)
6+
- cron: '0 1 * * *'
7+
workflow_dispatch:
8+
# 允许手动触发
9+
push:
10+
branches:
11+
- main
12+
paths:
13+
- 'docs/**/*.md'
14+
- 'content/**/*.md'
15+
16+
jobs:
17+
fix-code-blocks:
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: write
21+
pull-requests: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Setup Bun
30+
uses: oven-sh/setup-bun@v1
31+
with:
32+
bun-version: latest
33+
34+
- name: Install dependencies
35+
run: bun install
36+
37+
- name: Fix code blocks
38+
run: |
39+
echo "开始修复代码块..." >> $GITHUB_STEP_SUMMARY
40+
bun run fix-code-blocks 2>&1 | tee fix_output.log
41+
echo "修复完成,查看详细日志..." >> $GITHUB_STEP_SUMMARY
42+
echo '```' >> $GITHUB_STEP_SUMMARY
43+
tail -20 fix_output.log >> $GITHUB_STEP_SUMMARY
44+
echo '```' >> $GITHUB_STEP_SUMMARY
45+
46+
- name: Check for changes
47+
id: changes
48+
run: |
49+
if git diff --quiet docs/; then
50+
echo "has_changes=false" >> $GITHUB_OUTPUT
51+
else
52+
echo "has_changes=true" >> $GITHUB_OUTPUT
53+
echo "修改的文件:" >> $GITHUB_STEP_SUMMARY
54+
git diff --name-only docs/ >> $GITHUB_STEP_SUMMARY
55+
fi
56+
57+
- name: Commit and push changes
58+
if: steps.changes.outputs.has_changes == 'true'
59+
run: |
60+
git config --local user.email "[email protected]"
61+
git config --local user.name "GitHub Action"
62+
git add docs/
63+
git commit -m "🔧 自动修复代码块格式 (@@filename 和 @@switch)"
64+
git push
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Create summary
69+
run: |
70+
echo "## 代码块修复结果 🔧" >> $GITHUB_STEP_SUMMARY
71+
if [[ "${{ steps.changes.outputs.has_changes }}" == "true" ]]; then
72+
echo "✅ 发现并修复了代码块格式问题" >> $GITHUB_STEP_SUMMARY
73+
echo "- 将 \`@@filename()\` 转换为 rspress 语法" >> $GITHUB_STEP_SUMMARY
74+
echo "- 删除了 \`@@switch\` 后的 JavaScript 代码块" >> $GITHUB_STEP_SUMMARY
75+
else
76+
echo "✅ 所有代码块格式都是正确的,无需修复" >> $GITHUB_STEP_SUMMARY
77+
fi

docs/cli/usages.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ $ nest info
183183
| . ` | / _ \/ __|| __| | | `--. \| | | | | |
184184
| |\ || __/\__ \| |_ /\__/ //\__/ /| \__/\| |_____| |_
185185
\_| \_/ \___||___/ \__|\____/ \____/ \____/\_____/\___/
186+
```
186187

187188
[System Information]
188189
OS Version : macOS High Sierra

docs/cli/workspaces.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ Nest 将组织和构建标准项目及 monorepo 结构项目所需的元数据
263263
> ...
264264
> }
265265
> ```
266+
```
266267
267268
#### 项目专属生成选项
268269

docs/contributors.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@
2929
git clone https://github.com/YOUR_USERNAME/docs.nestjs.cn.git
3030
cd docs.nestjs.cn
3131
```
32+
```
3233
3334
2. **创建特性分支**
3435
```bash
3536
git checkout -b feature/amazing-feature
3637
# 或者
3738
git checkout -b fix/some-bug
3839
```
40+
```
3941
4042
3. **进行你的修改**
4143
- 📝 翻译新内容或改进现有翻译
@@ -49,6 +51,7 @@
4951
npm run dev
5052
```
5153
在浏览器中查看你的修改效果
54+
```
5255
5356
5. **提交你的修改**
5457
```bash
@@ -57,11 +60,13 @@
5760
# 或者
5861
git commit -m "fix: correct translation error"
5962
```
63+
```
6064
6165
6. **推送到你的分支**
6266
```bash
6367
git push origin feature/amazing-feature
6468
```
69+
```
6570
6671
7. **创建 Pull Request**
6772
- 访问你的 Fork 仓库页面

docs/deployment.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ git push heroku main
108108

109109
```dockerfile
110110
FROM node:18-alpine
111+
```
111112

112113
WORKDIR /usr/src/app
113114

@@ -420,6 +421,7 @@ Sentry.init({
420421
```bash
421422
# 启用调试模式
422423
DEBUG=* npm run start:prod
424+
```
423425

424426
# 分析内存使用
425427
node --inspect dist/main.js

docs/devtools/ci-cd.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ Devtools 会为每次构建生成报告**前提是**中央注册表中已存储
7777

7878
```yaml
7979
name: Devtools
80+
```
8081
8182
on:
8283
push:
@@ -172,6 +173,7 @@ const publishOptions = {
172173

173174
```yaml
174175
image: node:16
176+
```
175177

176178
stages:
177179
- build

docs/faq/errors.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
```bash
1212
Nest can't resolve dependencies of the <provider> (?). Please make sure that the argument <unknown_token> at index [<index>] is available in the <module> context.
13+
```
1314
1415
Potential solutions:
1516
- Is <module> a valid NestJS module?
@@ -71,6 +72,7 @@ Please make sure that the argument ModuleRef at index [<index>] is available in
7172
```bash
7273
Nest cannot create the <module> instance.
7374
The module at index [<index>] of the <module> "imports" array is undefined.
75+
```
7476

7577
Potential causes:
7678
- A circular dependency between modules. Use forwardRef() to avoid it. Read more: https://docs.nestjs.com/fundamentals/circular-dependency

docs/faq/http-adapter.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
要从应用上下文外部获取 `HttpAdapter` 的引用,请调用 `getHttpAdapter()` 方法。
1010

1111
```typescript
12-
@@filename()
1312
const app = await NestFactory.create(AppModule);
1413
const httpAdapter = app.getHttpAdapter();
1514
```
@@ -19,7 +18,6 @@ const httpAdapter = app.getHttpAdapter();
1918
要从应用上下文内部获取 `HttpAdapterHost` 的引用,可使用与其他现有提供者相同的注入技术(例如通过构造函数注入)。
2019

2120
```typescript
22-
@@filename()
2321
export class CatsService {
2422
constructor(private adapterHost: HttpAdapterHost) {}
2523
}

docs/faq/hybrid-application.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ await app.listen(3001);
4141
要将 `@MessagePattern()` 绑定到混合应用中多个微服务里的单一传输策略(例如 MQTT),我们可以传入类型为 `Transport` 的第二个参数,这是一个包含所有内置传输策略定义的枚举。
4242

4343
```typescript
44-
@@filename()
4544
@MessagePattern('time.us.*', Transport.NATS)
4645
getDate(@Payload() data: number[], @Ctx() context: NatsContext) {
4746
console.log(`Subject: ${context.getSubject()}`); // e.g. "time.us.east"

docs/faq/serverless.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ $ npm i -D @types/aws-lambda serverless-offline
175175

176176
```yaml
177177
service: serverless-example
178+
```
178179
179180
plugins:
180181
- serverless-offline
@@ -294,8 +295,7 @@ return {
294295

295296
或者,如果您希望保持函数非常轻量级且不需要任何 HTTP 相关功能(路由、守卫、拦截器、管道等),可以仅使用 `NestFactory.createApplicationContext` (如前所述)而不运行整个 HTTP 服务器(以及底层的 `express`),如下所示:
296297

297-
```typescript
298-
@@filename(main)
298+
```typescript title="main"
299299
import { HttpStatus } from '@nestjs/common';
300300
import { NestFactory } from '@nestjs/core';
301301
import { Callback, Context, Handler } from 'aws-lambda';

0 commit comments

Comments
 (0)