Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: tsconfig include default value and warning msg #1902

Merged
merged 6 commits into from
Sep 17, 2023

Conversation

PeachScript
Copy link
Member

@PeachScript PeachScript commented Sep 17, 2023

🤔 这个变动的性质是?/ What is the nature of this change?

  • 新特性提交 / New feature
  • bug 修复 / Fix bug
  • 样式优化 / Style optimization
  • 代码风格优化 / Code style optimization
  • 性能优化 / Performance optimization
  • 构建优化 / Build optimization
  • 网站、文档、Demo 改进 / Website, documentation, demo improvements
  • 重构代码或样式 / Refactor code or style
  • 测试相关 / Test related
  • 其他 / Other

🔗 相关 Issue / Related Issue

💡 需求背景和解决方案 / Background or solution

之前 tsconfig.json include 配置项的脚手架默认值和框架警告提示都包含 .dumi/**/*,示例:

warn  - Please append `.dumi/**/*` & `.dumirc.ts` into `include` option of `tsconfig.json`, to make sure the types exported by framework works.

如果用户照做的话,会导致 dumi 的临时文件目录 .dumi/tmp 也被包含进去,在项目执行 tsc 时将会包含不必要的检查,甚至可能抛出不该用户关心的类型错误。

所以该 PR 做了 3 处改动:

  1. 对脚手架的 tsconfig.json 均去除 .dumi/**/*
  2. 对存量 tsconfig.json 检测到 .dumi/**/*(用户已修复过)会自动帮用户去除,并根据需要把 .dumi 下的其他文件加进去,尽可能让已经处理过的用户或通过新脚手架创建的用户不感知这个二次修复
  3. 对存量 tsconfig.json 未检测到 .dumi/**/*(用户还没修复过),但同时又使用到 .dumi 文件夹下的 TypeScript 约定式文件(比如 .dumi/app.tsx.dumi/theme/**/*)做针对性警告提示,建议用户将它们添加到 tsconfig.json include 中

额外说明:为什么需要额外将 .dumi 下的 TypeScript 文件添加到 include 中?因为 include 的默认值是 **/*,不包含 . 开头的隐藏文件,如果不添加的话会导致相关文件丢失 TypeScript 类型提示

📝 更新日志 / Changelog

Language Changelog
🇺🇸 English Fix tsconfig include default value and warning msg
🇨🇳 Chinese 修复 tsconfig include 的值及相关警告信息

@vercel
Copy link

vercel bot commented Sep 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
dumi ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 17, 2023 9:39am

@PeachScript PeachScript changed the title fix: tsconfig include default value and warning msg for it fix: tsconfig include default value and warning msg Sep 17, 2023
@PeachScript PeachScript merged commit 2486fe1 into master Sep 17, 2023
8 checks passed
@PeachScript PeachScript deleted the hotfix/tsconfig-include branch September 17, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant