Repository navigation
perf: 优化打包大小 - #138
Merged
Merged
perf: 优化打包大小#138
Conversation
MoYingJi
marked this pull request as ready for review
August 6, 2026 21:41
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Enables an afterPack hook to trim unused native module artifacts from the packaged Electron app, reducing output size.
Changes:
- Turn on
afterPackinelectron-builderconfig. - Add post-pack trimming for
better-sqlite3andfont-listplatform/arch artifacts. - Adjust packaging exclude globs (e.g., exclude
.ts, refinebetter-sqlite3paths).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| scripts/after-pack.ts | Adds afterPack hook logic to delete unused native binaries/libs per target platform/arch. |
| electron-builder.config.ts | Enables afterPack hook and updates files exclusion patterns to reduce packaged content. |
| } | ||
| }; | ||
|
|
||
| const tryRm = async (path: string, options?: object): Promise<void> => { |
Collaborator
Author
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
Suppressed comments (1)
scripts/after-pack.ts:15
- 必修:这里把
options声明为宽泛的object,但fs/promises.rm要求RmOptions;scripts/**/*会被tsconfig.node.json检查,因此pnpm typecheck/打包会在rm(path, options)处报类型不兼容。请直接从rm的签名推导参数类型。
const tryRm = async (path: string, options?: object): Promise<void> => {
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.

改动类型
是否包含破坏性变更
改动说明
better-sqlite3和font-list的体积(根据平台删除不会用到的东西).ts源代码文件测试情况
resources从 55.4 MiB 缩减至 38.7 MiB,且不影响正常功能自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.tsdev分支提交