fix(eagle): 为 Linaria class 增加版本前缀#1291
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
LGTM |
chenenpei
reviewed
Apr 29, 2026
| const projectRootDir = path.resolve(__dirname); | ||
| const eagleVersionSlug = JSON.parse( | ||
| fs.readFileSync(path.join(__dirname, "package.json"), "utf-8"), | ||
| ).version.replace(/[^a-zA-Z0-9]+/g, "_"); |
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.
变更说明
本次调整 eagle 的 Linaria className 生成规则,在原有
E_${hash}前缀中加入@cloudtower/eagle当前版本号。变更后 className 格式为:
E_<eagle_version>_<linaria_hash>例如:
E_4100_0_0_s1n7hav7这样在不同 eagle 版本共存时,即使 Linaria 原始 hash 相同,也可以通过版本前缀实现样式隔离,降低跨版本样式冲突风险。
实现方式
packages/eagle/package.json中的version_rollup.config.js的 LinariaclassNameSlug中拼接版本前缀测试建议
cd packages/eagle && yarn builddist/linaria.merged.scss和dist/esm/**/*.js中 className 是否包含当前版本前缀,例如E_4100_0_0_@cloudtower/eagle,确认新版组件样式不会被旧版style.css命中或覆盖cloudtower-sre-island 里调整了 typo.d1_bold_title/d1s_bold_title
tower 中打包的样式已经是不同的 classname 了,无法影响到 font-size 等