Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Conversation

@wuliya336
Copy link
Contributor

@wuliya336 wuliya336 commented Jul 5, 2025

  • 移除 tsconfig.module.json 文件
  • 新增 tsdown.config.ts 文件,配置 tsdown 构建工具
  • 删除 tsup.config.ts 和 tsup.modules.ts 文件,移除 tsup 构建工具
  • 更新构建选项,包括入口文件、格式、依赖处理等
  • 添加复制文件和清理目录的钩子函数

Sourcery 总结

将构建管道从 tsup 迁移到 tsdown,相应地更新包导出和脚本,并引入构建后钩子来清理和重命名输出文件。

增强功能:

  • 将构建配置整合到一个新的 tsdown.config.ts 中,其中包含统一的入口点和输出设置
  • 更新 package.json 导出和 main 字段,以引用 .js 输出而不是 .mjs
  • 添加构建后钩子以删除 .d.cts 文件并将 .js 重命名为分发文件夹中的 .mjs

构建:

  • 在 package.json 中用 tsdown 替换基于 tsup 的构建脚本
  • 删除 tsup 配置文件 (tsup.config.ts, tsup.modules.ts) 和过时的 tsconfig.module.json

杂项:

  • 指定 Node.js >=20 引擎要求并配置 pnpm onlyBuiltDependencies
Original summary in English

Summary by Sourcery

Migrate the build pipeline from tsup to tsdown, update package exports and scripts accordingly, and introduce post–build hooks to clean and rename output files.

Enhancements:

  • Consolidate build configuration into a new tsdown.config.ts with unified entry points and output settings
  • Update package.json exports and main fields to reference .js outputs instead of .mjs
  • Add post-build hooks to remove .d.cts files and rename .js to .mjs in distribution folders

Build:

  • Replace tsup-based build scripts with tsdown in package.json
  • Remove tsup config files (tsup.config.ts, tsup.modules.ts) and obsolete tsconfig.module.json

Chores:

  • Specify Node.js >=20 engine requirement and configure pnpm onlyBuiltDependencies

@sourcery-ai
Copy link

sourcery-ai bot commented Jul 5, 2025

好的,这是将 pull request review guide 翻译成简体中文的结果:

🧙 Sourcery 已经完成了对您的 pull request 的审查!


提示和命令

与 Sourcery 互动

  • 触发新的审查: 在 pull request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审查评论。
  • 从审查评论生成 GitHub issue: 回复审查评论,让 Sourcery 从该评论创建一个 issue。您也可以回复审查评论并加上 @sourcery-ai issue 来从中创建一个 issue。
  • 生成 pull request 标题: 在 pull request 标题中任何位置写入 @sourcery-ai 以随时生成标题。您也可以在 pull request 上评论 @sourcery-ai title 以随时(重新)生成标题。
  • 生成 pull request 摘要: 在 pull request 正文中任何位置写入 @sourcery-ai summary 以随时在您想要的位置生成 PR 摘要。您也可以在 pull request 上评论 @sourcery-ai summary 以随时(重新)生成摘要。
  • 生成审查者指南: 在 pull request 上评论 @sourcery-ai guide 以随时(重新)生成审查者指南。
  • 解决所有 Sourcery 评论: 在 pull request 上评论 @sourcery-ai resolve 以解决所有 Sourcery 评论。如果您已经处理了所有评论并且不想再看到它们,这将非常有用。
  • 驳回所有 Sourcery 审查: 在 pull request 上评论 @sourcery-ai dismiss 以驳回所有现有的 Sourcery 审查。如果您想从一个新的审查开始,这将特别有用 - 别忘了评论 @sourcery-ai review 以触发新的审查!

自定义您的体验

访问您的 仪表盘 以:

  • 启用或禁用审查功能,例如 Sourcery 生成的 pull request 摘要、审查者指南等。
  • 更改审查语言。
  • 添加、删除或编辑自定义审查说明。
  • 调整其他审查设置。

获取帮助

Original review guide in English

🧙 Sourcery has finished reviewing your pull request!


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@candriajs
Copy link
Contributor

candriajs bot commented Jul 5, 2025

🎉 🎉 🎉 构建完成!
该版本是基于 tsdown 分支的快照 26064ac 所构建的。

你可以通过以下命令安装该版本:

pnpm install https://pkg.pr.new/CandriaJS/git-neko-kit/@candriajs/git-neko-kit@26064ac

@candriajs
Copy link
Contributor

candriajs bot commented Jul 5, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
git-neko-kit ✅ Ready (View Log) Visit Preview 8874e87

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

嘿 @shiwuliya - 我已经查看了你的更改 - 这里有一些反馈:

  • tsdown.config.ts 中的重命名钩子当前将 .js 文件重命名为 .mjs,但 package.json 导出路径仍然指向 .js——请对齐扩展名或相应地更新导出。
  • 你的 tsdown 目标设置为 node22,但 package.json 引擎允许 >=20.0.0,因此要么降低目标以匹配,要么提高引擎字段以要求 Node 22。
  • copyExpFiles 钩子仅删除 .d.cts 文件,但不会为 exports 文件夹将 .js 输出重命名为 .mjs——添加匹配的重命名逻辑或调整导出映射。
AI 代理的提示
请解决此代码审查中的评论:
## 总体评论
- tsdown.config.ts 中的重命名钩子当前将 `.js` 文件重命名为 `.mjs`,但 package.json 导出路径仍然指向 `.js`——请对齐扩展名或相应地更新导出。
- 你的 tsdown 目标设置为 `node22`,但 package.json 引擎允许 `>=20.0.0`,因此要么降低目标以匹配,要么提高引擎字段以要求 Node 22。
- `copyExpFiles` 钩子仅删除 `.d.cts` 文件,但不会为 exports 文件夹将 `.js` 输出重命名为 `.mjs`——添加匹配的重命名逻辑或调整导出映射。

## 单独评论

### 评论 1
<location> `tsdown.config.ts:59` </location>
<code_context>
+  const distDir = path.join(file_path, 'dist')
+
+  // 删除 .d.cts 文件
+  fs.readdirSync(distDir).forEach((file) => {
+    if (file.endsWith('.d.cts')) {
+      fs.rmSync(path.join(distDir, file))
+    }
</code_context>

<issue_to_address>
直接删除 dist 目录中的文件可能会导致问题,如果目录结构发生变化。

此逻辑仅删除 dist 顶层的文件,并且会遗漏子目录中的 .d.cts 文件。使用递归方法或 glob 模式来处理所有情况。

建议的实现方式:

```typescript
  const distDir = path.join(file_path, 'dist')

  // 递归删除所有 .d.cts 文件
  import glob from 'glob'

  glob.sync('**/*.d.cts', { cwd: distDir, absolute: true }).forEach((file) => {
    fs.rmSync(file)
  })

  // 仅重命名顶层 .js 文件为 .mjs
  fs.readdirSync(distDir).forEach((file) => {
    if (file.endsWith('.js')) {
      const oldPath = path.join(distDir, file)
      const newPath = path.join(distDir, file.replace('.js', '.mjs'))
      fs.renameSync(oldPath, newPath)
    }
  })

```

- 确保 `glob` 包已安装在您的项目中 (`npm install glob`)。
- 如果您的项目使用 ES 模块,您可能需要将 glob 导入为 `import glob from 'glob'` 在文件顶部,或者如果使用 CommonJS,则使用 `const glob = require('glob')`- 如果您还想递归地将子目录中的 `.js` 文件重命名为 `.mjs`,您应该为 `.js` 文件应用类似的 glob 模式。
</issue_to_address>

Sourcery 对开源是免费的 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我更有用!请点击每个评论上的 👍 或 👎,我将使用反馈来改进您的评论。
Original comment in English

Hey @shiwuliya - I've reviewed your changes - here's some feedback:

  • The renaming hook in tsdown.config.ts currently renames .js files to .mjs, but package.json export paths still point to .js—please align the extensions or update the exports accordingly.
  • Your tsdown target is set to node22 but package.json engines allow >=20.0.0, so either lower the target to match or bump the engines field to require Node 22.
  • The copyExpFiles hook only removes .d.cts files but doesn’t rename .js outputs to .mjs for the exports folder—add matching rename logic or adjust the exports mapping.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The renaming hook in tsdown.config.ts currently renames `.js` files to `.mjs`, but package.json export paths still point to `.js`—please align the extensions or update the exports accordingly.
- Your tsdown target is set to `node22` but package.json engines allow `>=20.0.0`, so either lower the target to match or bump the engines field to require Node 22.
- The `copyExpFiles` hook only removes `.d.cts` files but doesn’t rename `.js` outputs to `.mjs` for the exports folder—add matching rename logic or adjust the exports mapping.

## Individual Comments

### Comment 1
<location> `tsdown.config.ts:59` </location>
<code_context>
+  const distDir = path.join(file_path, 'dist')
+
+  // 删除 .d.cts 文件
+  fs.readdirSync(distDir).forEach((file) => {
+    if (file.endsWith('.d.cts')) {
+      fs.rmSync(path.join(distDir, file))
+    }
</code_context>

<issue_to_address>
Directly deleting files in the dist directory may cause issues if the directory structure changes.

This logic only deletes files in the top level of dist and will miss .d.cts files in subdirectories. Use a recursive method or glob pattern to handle all cases.

Suggested implementation:

```typescript
  const distDir = path.join(file_path, 'dist')

  // 递归删除所有 .d.cts 文件
  import glob from 'glob'

  glob.sync('**/*.d.cts', { cwd: distDir, absolute: true }).forEach((file) => {
    fs.rmSync(file)
  })

  // 仅重命名顶层 .js 文件为 .mjs
  fs.readdirSync(distDir).forEach((file) => {
    if (file.endsWith('.js')) {
      const oldPath = path.join(distDir, file)
      const newPath = path.join(distDir, file.replace('.js', '.mjs'))
      fs.renameSync(oldPath, newPath)
    }
  })

```

- Make sure the `glob` package is installed in your project (`npm install glob`).
- If your project uses ES modules, you may need to import glob as `import glob from 'glob'` at the top of the file, or use `const glob = require('glob')` if using CommonJS.
- If you want to also recursively rename `.js` files to `.mjs` in subdirectories, you should apply a similar glob pattern for `.js` files.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +59 to +60
fs.readdirSync(distDir).forEach((file) => {
if (file.endsWith('.d.cts')) {
Copy link

Choose a reason for hiding this comment

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

suggestion (bug_risk): 直接删除 dist 目录中的文件可能会导致问题,如果目录结构发生变化。

此逻辑仅删除 dist 顶层的文件,并且会遗漏子目录中的 .d.cts 文件。使用递归方法或 glob 模式来处理所有情况。

建议的实现方式:

  const distDir = path.join(file_path, 'dist')

  // 递归删除所有 .d.cts 文件
  import glob from 'glob'

  glob.sync('**/*.d.cts', { cwd: distDir, absolute: true }).forEach((file) => {
    fs.rmSync(file)
  })

  // 仅重命名顶层 .js 文件为 .mjs
  fs.readdirSync(distDir).forEach((file) => {
    if (file.endsWith('.js')) {
      const oldPath = path.join(distDir, file)
      const newPath = path.join(distDir, file.replace('.js', '.mjs'))
      fs.renameSync(oldPath, newPath)
    }
  })
  • 确保 glob 包已安装在您的项目中 (npm install glob)。
  • 如果您的项目使用 ES 模块,您可能需要将 glob 导入为 import glob from 'glob' 在文件顶部,或者如果使用 CommonJS,则使用 const glob = require('glob')
  • 如果您还想递归地将子目录中的 .js 文件重命名为 .mjs,您应该为 .js 文件应用类似的 glob 模式。
Original comment in English

suggestion (bug_risk): Directly deleting files in the dist directory may cause issues if the directory structure changes.

This logic only deletes files in the top level of dist and will miss .d.cts files in subdirectories. Use a recursive method or glob pattern to handle all cases.

Suggested implementation:

  const distDir = path.join(file_path, 'dist')

  // 递归删除所有 .d.cts 文件
  import glob from 'glob'

  glob.sync('**/*.d.cts', { cwd: distDir, absolute: true }).forEach((file) => {
    fs.rmSync(file)
  })

  // 仅重命名顶层 .js 文件为 .mjs
  fs.readdirSync(distDir).forEach((file) => {
    if (file.endsWith('.js')) {
      const oldPath = path.join(distDir, file)
      const newPath = path.join(distDir, file.replace('.js', '.mjs'))
      fs.renameSync(oldPath, newPath)
    }
  })
  • Make sure the glob package is installed in your project (npm install glob).
  • If your project uses ES modules, you may need to import glob as import glob from 'glob' at the top of the file, or use const glob = require('glob') if using CommonJS.
  • If you want to also recursively rename .js files to .mjs in subdirectories, you should apply a similar glob pattern for .js files.

- 移除 tsconfig.module.json 文件
- 新增 tsdown.config.ts 文件,配置 tsdown 构建工具
- 删除 tsup.config.ts 和 tsup.modules.ts 文件,移除 tsup 构建工具
- 更新构建选项,包括入口文件、格式、依赖处理等
- 添加复制文件和清理目录的钩子函数
@candriajs
Copy link
Contributor

candriajs bot commented Jul 5, 2025

🎉 🎉 🎉 构建完成!
该版本是基于 tsdown 分支的快照 26064ac 所构建的。

你可以通过以下命令安装该版本:

pnpm install https://pkg.pr.new/CandriaJS/git-neko-kit/@candriajs/git-neko-kit@26064ac

@candriajs
Copy link
Contributor

candriajs bot commented Jul 5, 2025

🎉 🎉 🎉 构建完成!
该版本是基于 tsdown 分支的快照 aa365e4 所构建的。

你可以通过以下命令安装该版本:

pnpm install https://pkg.pr.new/CandriaJS/git-neko-kit/@candriajs/git-neko-kit@aa365e4

@candriajs
Copy link
Contributor

candriajs bot commented Jul 5, 2025

🎉 🎉 🎉 构建完成!
该版本是基于 tsdown 分支的快照 aa365e4 所构建的。

你可以通过以下命令安装该版本:

pnpm install https://pkg.pr.new/CandriaJS/git-neko-kit/@candriajs/git-neko-kit@aa365e4

@candriajs
Copy link
Contributor

candriajs bot commented Jul 6, 2025

🎉 🎉 🎉 构建完成!
该版本是基于 tsdown 分支的快照 aa365e4 所构建的。

你可以通过以下命令安装该版本:

pnpm install https://pkg.pr.new/CandriaJS/git-neko-kit/@candriajs/git-neko-kit@aa365e4

@wuliya336 wuliya336 merged commit 0996820 into main Jul 6, 2025
10 of 11 checks passed
@wuliya336 wuliya336 deleted the tsdown branch July 6, 2025 05:41
@candriajs candriajs bot mentioned this pull request Jul 5, 2025
wuliya336 pushed a commit that referenced this pull request Jul 6, 2025
🤖 I have created a release *beep* *boop*
---


##
[1.2.0](v1.1.1...v1.2.0)
(2025-07-06)


### ✨ 新功能

* **common:** 添加差异渲染函数
([26064ac](26064ac))


### ♻️ 代码重构

* **deps:** 用 radash 替代 lodash
([aa365e4](aa365e4))


### 📦️ 构建系统

* 重构构建配置并迁移至 tsdown
([#77](#77))
([0996820](0996820))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: candriajs[bot] <206545521+candriajs[bot]@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant