Skip to content

Commit 5e9c686

Browse files
authored
Merge branch 'tangly1024:main' into main
2 parents e16457d + 6b3fd30 commit 5e9c686

163 files changed

Lines changed: 22338 additions & 1253 deletions

File tree

Some content is hidden

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

.env.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,16 @@
172172
# MAILCHIMP_API_KEY=
173173
# NEXT_PUBLIC_DEBUG=
174174
# ENABLE_CACHE=
175+
# NEXT_PUBLIC_CLAUDE_README_CACHE_ENABLED=
176+
# NEXT_PUBLIC_CLAUDE_CONTRIBUTION_PERSIST_ENABLED=
177+
# NEXT_PUBLIC_CLAUDE_CONTRIBUTION_EVENT_LIMIT=50000
178+
# CLAUDE_CONTRIBUTION_FORCE_REFRESH=false
179+
# CLAUDE_CONTRIBUTION_TRIGGER_TOKEN=
180+
# SUPABASE_URL=
181+
# SUPABASE_SECRET_KEY=
182+
# NEXT_PUBLIC_SUPABASE_URL=
183+
# NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY=
184+
# SUPABASE_SERVICE_ROLE_KEY=
175185
# VERCEL_ENV=
176186
# NEXT_PUBLIC_VERSION=
177187
# NEXT_BUILD_STANDALONE=
Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
## 自动分析并回复仓库 Issue ##
2+
3+
name: Issue Response Bot
4+
5+
on:
6+
issues:
7+
types: [opened]
8+
schedule:
9+
- cron: '0 1 * * *' # 每天国际标准时间 01:00(北京时间 09:00)运行
10+
workflow_dispatch:
11+
12+
permissions:
13+
issues: write
14+
15+
jobs:
16+
respond-to-new-issue:
17+
name: 回复新开的 Issue
18+
runs-on: ubuntu-latest
19+
if: github.event_name == 'issues' && github.event.action == 'opened'
20+
steps:
21+
- name: 自动回复新 Issue
22+
uses: actions/github-script@v7
23+
with:
24+
github-token: ${{ secrets.GITHUB_TOKEN }}
25+
script: |
26+
const issue = context.payload.issue;
27+
const labels = issue.labels.map(l => l.name);
28+
const issueNumber = issue.number;
29+
const author = issue.user.login;
30+
31+
const bugComment = [
32+
`👋 @${author} 感谢您提交 Bug 反馈!`,
33+
'',
34+
'我们已收到您的问题报告,将尽快安排排查。',
35+
'',
36+
'在处理之前,请确认您的 Issue 已提供以下信息(否则我们可能无法重现问题):',
37+
'',
38+
'- ✅ **NotionNext 版本号**(例如:4.9.4.2)',
39+
'- ✅ **使用的主题**(例如:hexo / heo / next)',
40+
'- ✅ **部署方案**(例如:Vercel / Cloudflare Pages / 自托管)',
41+
'- ✅ **复现步骤**(清晰的步骤描述)',
42+
'- ✅ **期望结果与实际结果**',
43+
'',
44+
'如果以上信息不完整,请补充后我们会继续跟进。感谢您对 NotionNext 的贡献! 🙏',
45+
].join('\n');
46+
47+
const enhancementComment = [
48+
`👋 @${author} 感谢您提交新特性建议!`,
49+
'',
50+
'您的建议已被收录,我们将在评估可行性后决定是否纳入后续版本。',
51+
'',
52+
'如果您有能力参与实现,欢迎提交 PR!具体开发规范请参阅 [贡献指南](https://github.com/tangly1024/NotionNext/blob/main/README.md)。',
53+
'',
54+
'感谢您对 NotionNext 的支持! 🙏',
55+
].join('\n');
56+
57+
const deploymentComment = [
58+
`👋 @${author} 感谢您反馈部署问题!`,
59+
'',
60+
'以下是常见部署问题的排查建议,请先自查:',
61+
'',
62+
'1. 📝 确认 `NOTION_PAGE_ID` 已正确配置并且 Notion 页面已公开分享。',
63+
'2. 🔑 确认所有必要的环境变量(如 `NEXT_PUBLIC_*`)已在部署平台正确设置。',
64+
'3. 📦 确认使用的 Node.js 版本为 20.x(兼容 20/22/24),依赖安装命令为 `yarn`。',
65+
'4. 📖 参阅官方文档:[部署指南](https://github.com/tangly1024/NotionNext#部署)',
66+
'',
67+
'如果以上步骤均已确认,请补充更详细的错误日志,我们将继续协助排查。感谢您的耐心! 🙏',
68+
].join('\n');
69+
70+
const helpComment = [
71+
`👋 @${author} 您好,感谢您使用 NotionNext!`,
72+
'',
73+
'请详细描述您遇到的问题以及期望的结果,以便社区成员更好地帮助您。',
74+
'',
75+
'同时也欢迎加入我们的社区交流群获取更快速的帮助:[Telegram 群组](https://t.me/Notionso)',
76+
'',
77+
'感谢您的使用! 🙏',
78+
].join('\n');
79+
80+
const defaultComment = [
81+
`👋 @${author} 感谢您提交 Issue!`,
82+
'',
83+
'我们已收到您的反馈,将尽快处理。如有需要,我们会与您进一步沟通。',
84+
'',
85+
'欢迎加入我们的社区:[Telegram 群组](https://t.me/Notionso)',
86+
'',
87+
'感谢您对 NotionNext 的支持! 🙏',
88+
].join('\n');
89+
90+
let comment = defaultComment;
91+
if (labels.includes('bug')) {
92+
comment = bugComment;
93+
} else if (labels.includes('enhancement')) {
94+
comment = enhancementComment;
95+
} else if (labels.includes('deployment')) {
96+
comment = deploymentComment;
97+
} else if (labels.includes('help wanted')) {
98+
comment = helpComment;
99+
}
100+
101+
await github.rest.issues.createComment({
102+
owner: context.repo.owner,
103+
repo: context.repo.repo,
104+
issue_number: issueNumber,
105+
body: comment,
106+
});
107+
108+
daily-triage:
109+
name: 每日 Issue 处理
110+
runs-on: ubuntu-latest
111+
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
112+
steps:
113+
- name: 处理未回复的 Issue
114+
uses: actions/github-script@v7
115+
with:
116+
github-token: ${{ secrets.GITHUB_TOKEN }}
117+
script: |
118+
const oneDayAgo = new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();
119+
120+
const { data: issues } = await github.rest.issues.listForRepo({
121+
owner: context.repo.owner,
122+
repo: context.repo.repo,
123+
state: 'open',
124+
since: oneDayAgo,
125+
per_page: 100,
126+
});
127+
128+
const buildComment = (author, labels) => {
129+
const bugComment = [
130+
`👋 @${author} 感谢您提交 Bug 反馈!`,
131+
'',
132+
'我们已收到您的问题报告,将尽快安排排查。',
133+
'',
134+
'在处理之前,请确认您的 Issue 已提供以下信息(否则我们可能无法重现问题):',
135+
'',
136+
'- ✅ **NotionNext 版本号**(例如:4.9.4.2)',
137+
'- ✅ **使用的主题**(例如:hexo / heo / next)',
138+
'- ✅ **部署方案**(例如:Vercel / Cloudflare Pages / 自托管)',
139+
'- ✅ **复现步骤**(清晰的步骤描述)',
140+
'- ✅ **期望结果与实际结果**',
141+
'',
142+
'如果以上信息不完整,请补充后我们会继续跟进。感谢您对 NotionNext 的贡献! 🙏',
143+
].join('\n');
144+
145+
const enhancementComment = [
146+
`👋 @${author} 感谢您提交新特性建议!`,
147+
'',
148+
'您的建议已被收录,我们将在评估可行性后决定是否纳入后续版本。',
149+
'',
150+
'如果您有能力参与实现,欢迎提交 PR!具体开发规范请参阅 [贡献指南](https://github.com/tangly1024/NotionNext/blob/main/README.md)。',
151+
'',
152+
'感谢您对 NotionNext 的支持! 🙏',
153+
].join('\n');
154+
155+
const deploymentComment = [
156+
`👋 @${author} 感谢您反馈部署问题!`,
157+
'',
158+
'以下是常见部署问题的排查建议,请先自查:',
159+
'',
160+
'1. 📝 确认 `NOTION_PAGE_ID` 已正确配置并且 Notion 页面已公开分享。',
161+
'2. 🔑 确认所有必要的环境变量(如 `NEXT_PUBLIC_*`)已在部署平台正确设置。',
162+
'3. 📦 确认使用的 Node.js 版本为 20.x(兼容 20/22/24),依赖安装命令为 `yarn`。',
163+
'4. 📖 参阅官方文档:[部署指南](https://github.com/tangly1024/NotionNext#部署)',
164+
'',
165+
'如果以上步骤均已确认,请补充更详细的错误日志,我们将继续协助排查。感谢您的耐心! 🙏',
166+
].join('\n');
167+
168+
const helpComment = [
169+
`👋 @${author} 您好,感谢您使用 NotionNext!`,
170+
'',
171+
'请详细描述您遇到的问题以及期望的结果,以便社区成员更好地帮助您。',
172+
'',
173+
'同时也欢迎加入我们的社区交流群获取更快速的帮助:[Telegram 群组](https://t.me/Notionso)',
174+
'',
175+
'感谢您的使用! 🙏',
176+
].join('\n');
177+
178+
const defaultComment = [
179+
`👋 @${author} 感谢您提交 Issue!`,
180+
'',
181+
'我们已收到您的反馈,将尽快处理。如有需要,我们会与您进一步沟通。',
182+
'',
183+
'欢迎加入我们的社区:[Telegram 群组](https://t.me/Notionso)',
184+
'',
185+
'感谢您对 NotionNext 的支持! 🙏',
186+
].join('\n');
187+
188+
if (labels.includes('bug')) return bugComment;
189+
if (labels.includes('enhancement')) return enhancementComment;
190+
if (labels.includes('deployment')) return deploymentComment;
191+
if (labels.includes('help wanted')) return helpComment;
192+
return defaultComment;
193+
};
194+
195+
let processed = 0;
196+
for (const issue of issues) {
197+
if (issue.pull_request) continue;
198+
if (issue.comments > 0) continue;
199+
200+
const labels = issue.labels.map(l => l.name);
201+
const comment = buildComment(issue.user.login, labels);
202+
203+
await github.rest.issues.createComment({
204+
owner: context.repo.owner,
205+
repo: context.repo.repo,
206+
issue_number: issue.number,
207+
body: comment,
208+
});
209+
210+
processed++;
211+
await new Promise(r => setTimeout(r, 1000));
212+
}
213+
214+
console.log(`每日巡检完成,共处理 ${processed} 个 Issue。`);
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Lockfile Consistency
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
yarn-lockfile:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version-file: ".nvmrc"
20+
21+
- name: Setup Yarn 1
22+
run: |
23+
corepack enable
24+
corepack prepare yarn@1.22.22 --activate
25+
yarn --version
26+
27+
- name: Enforce Yarn-only lockfile
28+
run: |
29+
if [ -f package-lock.json ]; then
30+
echo "package-lock.json is not allowed. Please use yarn.lock only."
31+
exit 1
32+
fi
33+
34+
- name: Install dependencies with frozen lockfile
35+
run: yarn install --frozen-lockfile
36+
37+
- name: Verify yarn.lock unchanged
38+
run: git diff --exit-code yarn.lock

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
# testing
99
/coverage
10+
/test-results
1011

1112
# next.js
1213
/.next/
@@ -51,4 +52,8 @@ yarn-error.log*
5152
package-lock.json
5253
# yarn.lock
5354

54-
.notion-api-lock
55+
.notion-api-lock
56+
.tmp/
57+
.perf/
58+
tsconfig.tsbuildinfo
59+
webpack-internal:/

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
package-lock=false
12
engine-strict=true

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20
1+
20.20.0

.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
enableImmutableInstalls: false
2+
nodeLinker: node-modules

CONTRIBUTING.zh-CN.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# 贡献指南(中文)
2+
3+
- [环境准备](#环境准备)
4+
- [新建主题](#新建主题)
5+
- [新增语言](#新增语言)
6+
- [环境变量](#环境变量)
7+
8+
感谢你愿意为 NotionNext 做贡献!
9+
10+
## 环境准备
11+
12+
请按以下流程参与开发:
13+
14+
1. 在 GitHub 上 Fork 仓库。
15+
2. 克隆到本地(或使用 Codespaces)。
16+
3. 为本次任务创建独立分支。
17+
4. 完成功能或修复并本地验证。
18+
5. 提交并推送分支。
19+
6. 发起 PR 到 NotionNext 的 `main` 分支。
20+
21+
常用命令:
22+
23+
- `yarn`:安装依赖
24+
- `yarn dev`:本地开发
25+
- `yarn build`:生产构建
26+
- `yarn start`:生产模式运行
27+
28+
## 必须遵守的协作规则
29+
30+
1. 每个任务使用独立分支,禁止直接提交到 `main`
31+
2. PR 保持聚焦,避免把无关重构混在一起。
32+
3. 不要提交个人本地文件(如 `.env.local`)。
33+
4. 不要提交会影响他人的个性化默认配置。
34+
5. 提交前至少执行 lint / type-check / 必要测试。
35+
36+
更多文档导航:
37+
38+
- [文档导航入口(中文)](./docs/README.md)
39+
- [Docs Navigation (English)](./docs/README.en.md)
40+
- [主题迁移指南(中文)](./docs/THEME_MIGRATION_GUIDE.zh-CN.md)
41+
- [Theme Migration Guide (English)](./docs/THEME_MIGRATION_GUIDE.md)
42+
43+
## 新建主题
44+
45+
如果要贡献新主题,请以 `themes/example` 为基础复制一个新目录,目录名即主题 key。
46+
47+
## 新增语言
48+
49+
如需新增本地化语言:
50+
51+
1. 复制 `lib/lang/en-US.js` 并按语言代码重命名(如 `zh-CN.js`)。
52+
2. 完成文本翻译。
53+
3.`lib/lang.js` 注册该语言。
54+
4. 提交 PR。
55+
56+
## 环境变量
57+
58+
1. 复制 `.env.example``.env.local`
59+
2. 按需填写配置。
60+
3. 不要提交 `.env.local`
61+
62+
配置优先级:
63+
64+
1. Notion 配置表(最高)
65+
2. 环境变量
66+
3. `blog.config.js`(最低)

0 commit comments

Comments
 (0)