Skip to content

refactor: add script to update version, remove import json - #168

Merged
Aarebecca merged 3 commits into
mainfrom
refactor/version
Jan 15, 2026
Merged

Aarebecca merged 3 commits into
mainfrom
refactor/version

Conversation

@Aarebecca

Copy link
Copy Markdown
Contributor
  • 移除 import json 用法
  • 新增脚本更新版本后
  • 更新版本
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Aarebecca, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求旨在重构项目的版本管理系统,以提高其自动化程度和一致性。通过移除直接的 package.json 导入、引入一个专门的版本更新脚本以及将版本常量集中到一个独立文件,这些更改简化了发布流程并确保了整个代码库中的版本信息同步。同时,新增的单元测试也为版本号的正确性提供了保障。

Highlights

  • 移除 import json 用法: 移除了 src/index.ts 中直接从 package.json 导入版本号的语句,避免了 with { type: 'json' } 的特殊语法。
  • 新增版本更新脚本: 新增了 scripts/version.mjs 脚本,用于自动化管理和更新项目版本。该脚本能够检查当前版本是否已发布,并根据需要自动递增补丁版本号,同时更新 package.json 和 src/version.ts 中的版本信息。
  • 自动化版本更新流程: package.json 中新增了 version 脚本,配置为执行 scripts/version.mjs,从而实现了版本更新的自动化。
  • 版本号独立管理: 项目版本号现在从 src/version.ts 文件中导出,而不是直接从 package.json 中读取,提高了版本信息的集中管理和可维护性。
  • 新增版本一致性测试: 新增了 __tests__/unit/version.test.ts 单元测试,确保 src/version.ts 中导出的 VERSION 常量与 package.json 中的版本号保持一致。
  • 更新项目版本: package.json 中的项目版本号已从 0.2.8 更新至 0.2.9。
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

hustcc
hustcc previously approved these changes Jan 15, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

本次 PR 重构了版本处理方式,引入了一个脚本来自动增加版本号,并同步 package.json 和新的 src/version.ts 文件之间的版本。这移除了在运行时导入 JSON 的需求。这些改动是合理的,并改善了开发流程。

我对新的版本管理脚本提出了一些建议,以使其更加健壮和易于维护。具体来说,我建议改进更新 package.json 的方式,为版本不一致的情况增加错误处理,并重构一些重复的代码。

Comment thread scripts/version.mjs Resolved
Comment thread scripts/version.mjs Resolved
@codecov-commenter

codecov-commenter commented Jan 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.62%. Comparing base (aff6b68) to head (be87217).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #168   +/-   ##
=======================================
  Coverage   44.62%   44.62%           
=======================================
  Files         328      329    +1     
  Lines       26206    26206           
  Branches     2032     2032           
=======================================
  Hits        11694    11694           
  Misses      14502    14502           
  Partials       10       10           
Flag Coverage Δ
infographic 44.62% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/index.ts 100.00% <100.00%> (ø)
src/version.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@Aarebecca
Aarebecca merged commit acbcd46 into main Jan 15, 2026
@Aarebecca
Aarebecca deleted the refactor/version branch January 15, 2026 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants