<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>墨梅博客 - 标签: vitest</title>
        <link>https://momei.app</link>
        <description>Momei Blog - AI-driven, natively internationalized developer blog platform.</description>
        <lastBuildDate>Sat, 20 Dec 2025 19:23:44 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>Momei Blog</generator>
        <language>zh-CN</language>
        <image>
            <title>墨梅博客 - 标签: vitest</title>
            <url>https://momei.app/logo.png</url>
            <link>https://momei.app</link>
        </image>
        <copyright>© 2026 墨梅博客. All rights reserved.</copyright>
        <atom:link href="https://momei.app/feed/tag/vitest.xml" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[草梅 Auth 1.11.1 版本发布与 AI 辅助代码重构实践 | 2025 年第 49 周草梅周报]]></title>
            <link>https://momei.app/posts/2025-49-caomei-weekly-caomei-auth-1-11-1-release-and-ai-refactoring</link>
            <guid isPermaLink="false">https://momei.app/posts/2025-49-caomei-weekly-caomei-auth-1-11-1-release-and-ai-refactoring</guid>
            <pubDate>Sat, 20 Dec 2025 19:23:44 GMT</pubDate>
            <description><![CDATA[本周草梅周报主要内容包括草梅 Auth 项目进展、GitHub 动态和周刊推荐。草梅 Auth 发布了 1.11.1 版本，主要修复了邮箱登录 BUG 并进行代码重构，采用 AI 辅助制定了重构方案，通过技术指标评估重构效果。GitHub 动态展示了加星仓库，包括 CLIProxyAPI、claude-code-proxy 等热门项目。周刊推荐了阮一峰网络日志、阿猫博客等优质内容。周报可通过博客、RSS、公众号和邮箱订阅获取更新。]]></description>
            <content:encoded><![CDATA[<blockquote>
<p>本文在 <a href="https://blog.cmyr.ltd">草梅友仁的博客</a> 发布和更新，并在多个平台同步发布。如有更新，以博客上的版本为准。您也可以通过文末的 <code>原文链接</code> 查看最新版本。</p>
</blockquote>
<h2 id="前言" tabindex="-1"><a class="header-anchor" href="#前言">前言</a></h2>
<p>欢迎来到草梅周报！这是一个由草梅友仁基于 AI 整理的周报，旨在为您提供最新的博客更新、GitHub 动态、个人动态和其他周刊文章推荐等内容。</p>
<hr>
<p>本周依旧在开发 <a href="https://github.com/CaoMeiYouRen/caomei-auth">草梅 Auth</a> 中。</p>
<blockquote>
<p>你也可以直接访问官网地址：<a href="https://auth.cmyr.dev/">https://auth.cmyr.dev/</a>
Demo 站：<a href="https://auth-demo.cmyr.dev/">https://auth-demo.cmyr.dev/</a>
文档地址：<a href="https://auth-docs.cmyr.dev/">https://auth-docs.cmyr.dev/</a></p>
</blockquote>
<p>本周 草梅 Auth 发布了 <a href="https://github.com/CaoMeiYouRen/caomei-auth/releases/tag/v1.11.1">1.11.1</a> 版本。</p>
<p>主要是修复了一些问题，和对项目代码的一些重构，提高代码质量。</p>
<p>此外，也对 better-auth 版本更新后，导致无法通过邮箱登录草梅 Auth 的恶性 BUG 进行了修复。</p>
<blockquote>
<p>详见： <a href="https://github.com/CaoMeiYouRen/caomei-auth/issues/267">#267</a></p>
</blockquote>
<p>如果想了解如何部署和使用项目，可以参考文档的内容，也欢迎补充文档缺失的内容。</p>
<p>如果你对草梅 Auth 感兴趣，欢迎参与开发和测试。</p>
<hr>
<p>在这里我也简单提一下我是如何借助 AI 来重构草梅 Auth 的。</p>
<p>首先，在草梅 Auth 的开发过程中，为了追求进度，优先实现功能，所以在代码质量上不是很高，出现了大量的耦合代码、行数上千的单个代码文件、重复代码块、硬编码字符、测试覆盖率不高等问题。</p>
<p>所以，我做的第一步就是先让 AI（比如 Gemini 3 Pro）对整个代码库进行分析，生成一份代码重构方案。</p>
<blockquote>
<p>参考：<a href="https://github.com/CaoMeiYouRen/caomei-auth/blob/master/docs/REFACTOR_PLAN.md">REFACTOR_PLAN.md</a></p>
</blockquote>
<p><img src="https://oss.cmyr.dev/images/20251207195122877.png" alt="image-20251207195122796"></p>
<p>在有了方案之后，下一步就是采用技术指标，对项目的重构效果进行评估。</p>
<p>首先是控制文件长度，这个比较简单，在 eslint 的配置中添加 <code>max-lines</code> 配置即可。</p>
<pre><code class="language-js">'max-lines': [1, { max: 800 }], // 强制文件的最大行数
</code></pre>
<p>然后是测试覆盖率，这个由 <a href="https://github.com/vitest-dev/vitest">vitest</a> 提供，通过执行 <code>vitest run --coverage</code> 命令即可查看当前测试覆盖率。</p>
<p><img src="https://oss.cmyr.dev/images/20251207200233034.png" alt="image-20251207200232960"></p>
<p>最后是代码重复率，这个由 <a href="https://github.com/kucherenko/jscpd">jscpd</a> 提供，执行 <code>jscpd .</code> 查看当前代码中重复片段的数量。</p>
<p><img src="https://oss.cmyr.dev/images/20251207200513301.png" alt="image-20251207200513195"></p>
<p>控制在 5%以下就还算不错。</p>
<p>在有了具体的技术指标后，后续代码重构也就有了数据支持，可以定量的评估重构效果。</p>
<h2 id="github-release" tabindex="-1"><a class="header-anchor" href="#github-release">GitHub Release</a></h2>
<h3 id="caomei-auth" tabindex="-1"><a class="header-anchor" href="#caomei-auth">caomei-auth</a></h3>
<h4 id="v1-11-1-2025-12-06-20-40-12" tabindex="-1"><a class="header-anchor" href="#v1-11-1-2025-12-06-20-40-12"><a href="https://github.com/CaoMeiYouRen/caomei-auth/releases/tag/v1.11.1">v1.11.1</a> - 2025-12-06 20:40:12</a></h4>
<p>摘要:
版本 1.11.1 摘要 (2025-12-06)</p>
<p>Bug 修复:</p>
<ul>
<li>优化管理员角色同步功能的数据源加载方式</li>
<li>为 Twitter 登录添加所需 scopes</li>
<li>调整 ESLint 规则，将最大行数限制改为 800 行</li>
</ul>
<p>代码重构:</p>
<ul>
<li>邮件模板引擎重构，提取回退模板到独立模块</li>
<li>邮件发送逻辑重构，引入依赖注入和限流机制</li>
<li>优化手机功能启用逻辑，使用空值合并运算符处理环境变量</li>
<li>导航系统改进，引入依赖注入机制优化登录跳转逻辑</li>
<li>用户个人资料组件重构，包括对话框和管理员日志页面</li>
<li>短信发送逻辑重构，增加依赖注入和限流机制，支持多渠道发送</li>
<li>TypeORM 适配器增强，支持关系处理和事务管理</li>
<li>安全设置页面重构为组合式函数和组件化架构</li>
<li>User 和 Application 模块重构</li>
<li>使用专门的 provider 对话框替换原有组件，简化提供者管理逻辑</li>
</ul>
<h2 id="最新-github-加星仓库" tabindex="-1"><a class="header-anchor" href="#最新-github-加星仓库">最新 GitHub 加星仓库</a></h2>
<ul>
<li><a href="https://github.com/router-for-me/CLIProxyAPI">CaoMeiYouRen starred CLIProxyAPI</a> - 2025-12-07 18:17:46
该项目使用 Go 语言开发，将多个主流 AI 模型(Gemini CLI、ChatGPT Codex、Claude Code、Qwen Code、iFlow)封装成兼容 OpenAI/Gemini/Claude/Codex 的 API 服务。主要特点包括：1)提供统一 API 接口访问不同 AI 模型；2)支持免费使用 Gemini 2.5 Pro、GPT 5、Claude 和 Qwen 等先进模型；3)在 GitHub 上获得 2202 个 star，显示其受欢迎程度；4)实现跨平台模型调用标准化。该项目简化了开发者集成多种 AI 服务的过程。</li>
<li><a href="https://github.com/fuergaosi233/claude-code-proxy">CaoMeiYouRen starred claude-code-proxy</a> - 2025-12-07 18:16:37
这是一个 Python 编写的 Claude API 到 OpenAI API 的代理工具，允许开发者通过 OpenAI API 格式访问 Claude 模型。项目在 GitHub 上获得了 1727 个星标，表明其受欢迎程度较高。该工具主要功能是将 OpenAI API 请求转换为 Claude API 兼容格式，便于开发者集成使用。</li>
<li><a href="https://github.com/kucherenko/jscpd">CaoMeiYouRen starred jscpd</a> - 2025-12-07 18:07:39
编程源代码的复制粘贴检测工具，主要使用 TypeScript 语言开发，在 GitHub 上获得 5100 颗星标。</li>
<li><a href="https://github.com/Tencent/tdesign">CaoMeiYouRen starred tdesign</a> - 2025-12-06 01:09:35
企业设计系统
主要语言：Vue
GitHub 星标数：3673</li>
<li><a href="https://github.com/deepseek-ai/DeepSeek-LLM">CaoMeiYouRen starred DeepSeek-LLM</a> - 2025-12-02 22:25:53
DeepSeek LLM 是一款人工智能语言模型，主要编程语言为 Makefile，目前在 GitHub 上获得 6647 个星标。</li>
</ul>
<h2 id="其他博客或周刊推荐" tabindex="-1"><a class="header-anchor" href="#其他博客或周刊推荐">其他博客或周刊推荐</a></h2>
<h3 id="阮一峰的网络日志" tabindex="-1"><a class="header-anchor" href="#阮一峰的网络日志">阮一峰的网络日志</a></h3>
<ul>
<li><a href="http://www.ruanyifeng.com/blog/2025/12/weekly-issue-376.html">科技爱好者周刊（第 376 期）：太空数据中心的争议</a> - 2025-12-05 08:09:01</li>
</ul>
<h3 id="阿猫的博客" tabindex="-1"><a class="header-anchor" href="#阿猫的博客">阿猫的博客</a></h3>
<ul>
<li><a href="https://ameow.xyz/archives/weekly-087">猫鱼周刊 vol. 087 做一个 RSS 阅读器</a> - 2025-12-07 19:35:35</li>
</ul>
<h3 id="潮流周刊" tabindex="-1"><a class="header-anchor" href="#潮流周刊">潮流周刊</a></h3>
<ul>
<li><a href="https://weekly.tw93.fun/posts/247/">第 247 期 - 东京大学</a> - 2025-12-01 08:00:00</li>
</ul>
<h3 id="二丫讲梵的学习周刊" tabindex="-1"><a class="header-anchor" href="#二丫讲梵的学习周刊">二丫讲梵的学习周刊</a></h3>
<ul>
<li><a href="https://wiki.eryajf.net/pages/462c25/">学习周刊-总第 240 期-2025 年第 49 周</a> - 2025-12-04 23:24:07</li>
</ul>
<h2 id="总结" tabindex="-1"><a class="header-anchor" href="#总结">总结</a></h2>
<p>本周的更新和动态如上所示。感谢您的阅读！
您可以通过以下方式订阅草梅周报的更新：</p>
<ul>
<li><strong>博客</strong>：<a href="https://blog.cmyr.ltd">草梅友仁的博客</a></li>
<li><strong>RSS</strong>：<a href="https://blog.cmyr.ltd/weekly.xml">草梅周报</a></li>
<li><strong>公众号</strong>：<a href="https://oss.cmyr.dev/images/20241025184516839-21n2ctv.png">草梅友仁的后花园</a></li>
<li><strong>邮箱订阅</strong>：<a href="https://listmonk.cmyr.dev/subscription/form">草梅友仁的博客订阅</a></li>
</ul>
<h2 id="往期回顾" tabindex="-1"><a class="header-anchor" href="#往期回顾">往期回顾</a></h2>
<ul>
<li><a href="https://blog.cmyr.ltd/archives/2025-48-caomei-weekly-nano-banana-pro-ai-image-generation.html">Nano Banana Pro AI 图像生成模型与创意实践 | 2025 年第 48 周草梅周报</a> - 2025-11-30 20:30:59</li>
<li><a href="https://blog.cmyr.ltd/archives/2025-47-caomei-weekly-cloudflare-outage-nano-banana-pro.html">Cloudflare 服务中断与 AI 图像生成模型 nano-banana-pro | 2025 年第 47 周草梅周报</a> - 2025-11-23 23:08:45</li>
<li><a href="https://blog.cmyr.ltd/archives/2025-46-caomei-weekly-code-refactoring-test-coverage.html">代码重构与测试覆盖率提升实践 | 2025 年第 46 周草梅周报</a> - 2025-11-16 20:18:53</li>
</ul>
]]></content:encoded>
            <author>草梅友仁</author>
            <category>草梅周报</category>
            <enclosure url="https://oss.cmyr.dev/images/20251207202621602.png" length="0" type="image/png"/>
        </item>
    </channel>
</rss>