简体   繁体   English

具有增量构建的 Angular 6+ Monorepo

[英]Angular 6+ Monorepo with incremental build

We have a monorepo for our frontend application, which consist of three parts:我们的前端应用程序有一个 monorepo,它由三部分组成:

  • user用户
  • partner伙伴
  • admin行政

Also we have some shared modules.我们还有一些共享模块。 Does any one know of a tool that can be configured to run specific commands based on commit changes?有没有人知道一种可以配置为根据提交更改运行特定命令的工具? For example we do not need to build all projects on our CI build if we have only changed "user" project.例如,如果我们只更改了“用户”项目,则不需要在 CI 构建上构建所有项目。 We only need to rebuild all of them if we have changed something under "shared".如果我们在“共享”下更改了某些内容,我们只需要重建所有这些。

So we are looking for a working solutions to check commit files and take a decision based on path of this files what command should run on CI, for example if we have at least one change under src/projects/user than we should run "ng build user ...".因此,我们正在寻找一种可行的解决方案来检查提交文件并根据该文件的路径来决定应该在 CI 上运行什么命令,例如,如果我们在 src/projects/user 下至少有一个更改,那么我们应该运行“ng建立用户...”。

You could check out nx. 您可以签出nx。 It offers some tools for monorepo projects including making automatic builds based on repository changes 它为monorepo项目提供了一些工具,包括基于存储库更改进行自动构建

https://nrwl.io/nx https://nrwl.io/nx

Rushjs by Microsoft is one open source alternative where you'd get incremental builds pretty much out of the box. Microsoft 的 Rushjs 是一种开源替代方案,您可以在其中获得几乎开箱即用的增量构建。

https://rushjs.io/ https://rushjs.io/

The tricky part is setting it up with CI, as you'd need to preserve a state somehow.棘手的部分是使用 CI 设置它,因为您需要以某种方式保留状态。 I personally used docker images for that.我个人为此使用了 docker 图像。

There's also lerna which can be combined with other tools, but you'd have to write/find more tooling to complement lerna for this type of thing.还有 lerna 可以与其他工具结合使用,但是您必须编写/找到更多工具来补充 lerna 用于此类事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM