State & Data Libraries Single-repo Monolithic 5 Project B Project C … … Project A Reusable Components … App Pros › Easy to Implement › Easy to Manage a Small Amount of Mini Projects Cons › Release All Projects Together › A Big Ball of Mud › Hard to Scale Repository
State & Data Libraries Single-repo Monolithic 6 Project B Project C … … Project A Reusable Components … App Pros › Easy to Implement › Easy to Manage a Small Amount of Mini Projects Cons › Release All Projects Together › A Big Ball of Mud › Hard to Scale Repository
Nx Next Generation Build System with First Class Monorepo Support Plugable Tooling Task Orchestration Workspace Analysis Detecting Affected Computation Caching 14
Computation Caching Never Build or Test The Same Thing Twice 15 CLI Command Flags > nx run seller-center:build --stage=alpha Relevant Source App Lib1 Lib2 Runtime External Dependencies React ProseMirror Global Config Hasher Computation Hash
Computation Caching Never Build or Test The Same Thing Twice 16 CLI Command Flags > nx run seller-center:build --stage=alpha Relevant Source App Lib1 Lib2 Runtime External Dependencies React ProseMirror Global Config Hasher Computation Hash
Computation Caching Store and Replay File and Process Output 17 NX Running target build for project seller-center and 3 task(s) it depends on > nx run services:build Compiling TypeScript files for project "services"... Done compiling TypeScript files for project "services". > nx run recoil-request:build Compiling TypeScript files for project "recoil-request"... Done compiling TypeScript files for project "recoil-request". > nx run shared:build Compiling TypeScript files for project "shared"... Done compiling TypeScript files for project "shared". > nx run seller-center:build:production ... NX Successfully ran target build for project seller-center and 3 task(s) it depends on < Command > Processing Command Result Cached fi rst time (no cache) second time (cached)
Computation Caching Store and Replay File and Process Output 18 < Command > Processing Command Result Cached fi rst time (no cache) second time (cached) NX Running target build for project seller-center and 3 task(s) it depends on > nx run seller-center:build:production ... NX Successfully ran target build for project seller-center Nx read the output from the cache instead of running the command for 3 out of 4 tasks.
Task Orchestration Run Tasks in the Correct Order and in Parallel 20 0 1 2 3 4 app:build app:serve app-e2e:test app:test lib:test lib:test lib:test lib:test lib:test …. …. …. Parallel Processes Execution Time
Detecting Affected Continuous Integration 23 develop feature checkout commits pull request automated build & test commits approve merge Unit Test E2E Test SonarQube Unit Test Checkout Setup Environment Install Dependencies Test Affected Restore Cache Detect Affected Set SHAs CI Work fl ows
Detecting Affected Continuous Integration 24 develop feature checkout commits pull request automated build & test commits approve merge Unit Test E2E Test SonarQube Unit Test Checkout Setup Environment Install Dependencies Test Affected Restore Cache Detect Affected Set SHAs CI Work fl ows
Workspace Analysis Graph Visualization 25 › High Level View of the Code Architecture › Search, Filter, Hide, and Focus the Nodes in the Graph › Detailed Information of Each Dependency Link › Task Graph Support
Workspace Analysis Circular Dependency 26 Consequences › Unexpected Side Effects › Make Nx’s Affected Algorithm Less Effective Strategies to Resolve › Move Pieces of Code from One Project to the Other › Move Code that Both Libraries Depend on into a New Library › Combine Projects into One Library
Plugable Tooling Generators 29 › Generating, Updating and Structuring Code in a Certain Way › Migration Generator › AST Manipulation › EJS Syntax for Control flow in the Template › Composable Generators Generated Files src/index.html src/main.ts src/components/ src/pages/ tsconfig.json jest.config.ts … Template Files src/index.html src/main.ts__tmpl__ src/components/ src/pages/ tsconfig.json__tmpl__ jest.config.ts__tmpl__ … Generate create/update fi les create/update project con fi g create/update TS con fi g compose other generators update package dependencies format fi les …