Finding Affected Builds in Nrwl Nx Monorepo
In this article, I will explain how to know which applications or libraries are changed in your nx monorepo workspace.
First time building Nx Monorepo
First Time if you get the source from repo to your local machine and run.
npm run affected:build
Notice all of the applications and library projects will build.
Once the build is done Nx will remember which projects are compiled successfully.
Next change the log.service.ts
inside logger project in branding service.
Affected Dependency Graph in Nx Monorepo
Next lets check the dependency graph to know which are the apps and libraries affected by our changes.
Run npm run affected:dep-graph
See it is showing we have change logger
project and it is being used in
customer-user-editor
and onlinestore-admin
so all of these applications and
projects are affected.
Nx can identify which are the projects changed. Which is great!
Build only Affected Projects in Nx Monorepo
Now you can run below script to just build affected projects only.
Run npm run affected:build
Notice it is only building affected projects only.
That give us performance while developing since we only build and test the projects that we change.
Become full stack developer 💻
If you want to become full stack developer and grow your carrier as new software developer or Lead Developer/Architect. Consider subscribing to our full stack development training programs. We have All-Access Monthly membership plans and you will get unlimited access to all of our video courses, slides, source code & Monthly video calls.
- Please subscribe to All-Access Membership PRO plan to access current and future angular, node.js and related courses.
- Please subscribe to All-Access Membership ELITE plan to get everything from PRO plan. Additionally, you will get access to monthly live Q&A video call with Rupesh and you can ask doubts/questions and get more help, tips and tricks.
Your bright future is awaiting for you so visit today FullstackMaster and allow me to help you to board on your dream software company as a Developer,Architect or Lead Engineer role. 💖 Say 👋 to me!