microsoft / microsoft/TypeScript
Build mode ignores inherited --pretty flag when run through lerna
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
TypeScript Version: 39.4
Search Terms: build pretty
"Code"
I am currently in the process of converting a project to a monorepo. Here I noticed that tsc -b seems to ignore the --pretty flag defined in a parent tsconfig when its run through lerna (with the stream flag set to true).
The project is set up as follows
tsconfig.json: pretty => true
tsconfig.build.json: extends from tsconfig.json
package/package-name/tsconfig.build.json: extends from ../../tsconfig.build.json
package/package-name/package.json defines the npm scripts
"scripts": {
"prebuild": "gulp prebuild",
"build": "tsc -b tsconfig.build.json",
}
The pretty flag only works sometimes:
If I manually execute npm run build in the package dir, the tsc output is pretty.
If I execute lerna run build --scope=package-name, the tsc output is NOT pretty.
If I execute lerna exec --scope=package-name -- npm run build, the tsc output is pretty.
If I manually add the --pretty flag to the npm script ("tsc -b tsconfig.build.json --watch --pretty"), the tsc output is pretty in all the cases.
Although this might be caused by lerna, I suspect this is actually a bug in TypeScript, because the prebuild output from gulp is colored (pretty) in all the cases I mentioned and manually adding the flag also works.
Expected behavior:
CLI output is "pretty"
Actual behavior:
It is not
Playground Link: not applicable
Related Issues: https://github.com/microsoft/TypeScript/issues/30282
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先复现三种命令形式:在 package 目录中运行 npm run build、lerna run build --scope=package-name,以及 lerna exec --scope=package-name -- npm run build。检查通过 lerna 调用时,tsc -b 如何读取链式 tsconfig.json 文件以及如何处理 --pretty。完成的标准是继承的 pretty 设置产生一致的 CLI 输出,或者证明该问题属于 lerna。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript
- 领域
- build-system, cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100