Repository navigation
feat(build): 两端统一精简运行时文件 - #136
Merged
Merged
Conversation
…-policy # Conflicts: # source-receipt.json
Member
Contributor
Author
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.
#119 第一阶段(体积优化尚未结束,后续计划见文末):在不改变功能的前提下,两端发布包共用一份运行时文件精简规则。
改动
scripts/lib/runtime-file-policy.mjs,参照 DSH 官方桌面端的apps/desktop/scripts/runtime-file-policy.ts:typescript包自带的标准库声明保留,因为 tsc 运行时需要读取;node_modules/.bin,不跟随符号链接。default_app.asar,Windows 原本就排除了它。删除统计写入 release 回执的runtimeFiles字段。tests/runtime-file-policy.test.mjs,并加入 build-contracts,在 macOS 和 Windows 上都会运行。效果(与同一 main 提交
2f10323的开发版构建对照)安装后,macOS 减少约 160 MB;Windows 新增删除约 64 MB。Windows 回执的统计里也包含源码映射、调试符号和字节码,这些在原来的规则下就会被删除。
验证
3b46781的开发版构建两端 CI 验收通过。候选包在 macOS arm64 本机,以及 Windows 11(ARM64 虚拟机运行 x64 包)上逐项实测,以下项目均通过:启动和退出重启、对话、终端、文件读写、本地 HTML 解析、Office 生成与 PDF 转换和预览、Studio 视频和 PDF 导出、后台和可见浏览、语音转写、插件安装、技能和定时任务;包内 tsc 检查正常。之后变基到当前 main,只刷新了源码回执。限制
后续
这只是 #119 的第一阶段,体积优化还没有结束。Chrome for Testing、LibreOffice、Electron 语言包,以及运行时里可能用不到的依赖包,占比更大,但调整它们会影响功能或离线可用性。这些会先在 #119 讨论方案,再分别提交。本 PR 合并后不关闭 #119。
Refs #119