feat: Add option to generate configs for static og images#220
Merged
Enter-tainer merged 5 commits intoAfilmory:mainfrom Mar 18, 2026
Merged
feat: Add option to generate configs for static og images#220Enter-tainer merged 5 commits intoAfilmory:mainfrom
Enter-tainer merged 5 commits intoAfilmory:mainfrom
Conversation
SafeDep Report SummaryPackage Details
This report is generated by SafeDep Github App |
|
@woolen-sheep is attempting to deploy a commit to the innei-dev Team on Vercel. A member of the Team first needs to authorize it. |
827c362 to
53f811d
Compare
packages/builder/src/plugins/og-image-storage/vendors/cloudflare-moddleware.ts
Outdated
Show resolved
Hide resolved
Innei
reviewed
Jan 25, 2026
Contributor
Innei
left a comment
There was a problem hiding this comment.
Review Summary
整体方案不错,vendor 架构设计合理。有几个建议:
1. 配置路径硬编码问题
const siteConfigPath = options.siteConfigPath
? path.resolve(process.cwd(), options.siteConfigPath)
: path.resolve(process.cwd(), '../../config.json') // ⚠️ 硬编码相对路径这个 ../../config.json 假设了固定的项目结构,在 monorepo 或不同目录结构下可能失效。
建议:
- 使用
repoRoot变量来定位:path.join(repoRoot, 'config.json') - 或者让用户必须显式提供
siteConfigPath
2. README 文档不完整
删除了原有的 Cloudflare middleware 示例代码后,新用户可能不清楚:
storageURL应该填什么值?- 生成的 middleware 文件在哪里?
- 如何验证配置是否正确?
建议:补充完整的配置示例和说明,比如:
vendor: {
type: 'cloudflare-middleware',
storageURL: 'https://cdn.example.com', // 你的 OG 图片存储 CDN 地址
siteConfigPath: './config.json', // 可选,默认为 repo 根目录的 config.json
}3. 错误处理建议
if (options.vendor && !vendor) {
try {
vendor = createVendor(options.vendor)
} catch (error) {
logger.main.error('OG image plugin: failed to initialize vendor config.', error)
// ⚠️ 继续执行可能不是期望行为
}
}vendor 初始化失败时只记录错误,构建会继续。用户可能不会注意到配置错误。
建议:
- 如果 vendor 配置错误,应该抛出异常中断构建
- 或者在 build 日志中更明显地标记(WARNING 级别)
4. 小优化
.gitignore 中的 functions/ 最好加个注释:
+# og-image-storage plugin generated files
functions/代码质量整体良好,主要是文档和健壮性方面的改进建议。LGTM with suggestions 👍
Innei
reviewed
Feb 4, 2026
* fix: resolve config.json base on repo root dir * doc: add more explain about vendor config and generation output * doc: fix ts code block formatting
Contributor
Author
|
Resolved above suggestions in 6525d78 最近加班太多,给搞忘了。。。 |
Contributor
Author
|
请问还有什么问题是需要我修改的吗? |
Contributor
|
冲突接下,直接合了 |
Contributor
Author
|
@Innei resolve了,我点不了合并。 |
3c77f7d to
ef8a473
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




@Enter-tainer 提到og-image插件启用太麻烦了,有很多手工成分。
为了开箱即用,增加了生成config的功能,完善了README。