
Enterprise Angular Monorepo Patterns Book v0.1 | December 1, 2018 Narwhal Technologies Inc. Enterprise Angular Monorepo Patterns Authors: Victor Savkin and Nitin Vericherla with contribution from Thomas Burleson For more information visit nrwl.io Table of Contents Introduction. 1 How This Book Is Organized . 1 Formatting . 1 An Example Reference Application . 2 Part 1: Getting Started. 3 Why a Monorepo? . 3 Why Nx? . 4 Nx Basics . 4 Interacting With Nx . 5 Installing And Setting Up a Workspace . 6 Getting Help. 9 Summary . 11 Part 2: Organizing Code With Libraries . 13 In a Nutshell . 13 Types Of Libraries . 14 Grouping Folders . 20 Sharing Libraries . 21 Notes On Using Libraries . 22 Documenting Libraries. 23 Module Names . 24 Command Line Options . 24 Summary . 25 Part 3: Enforcing Quality And Consistency . 26 Enforce a Single Version Policy . 26 Ensure Consistency In Code Formatting . 27 Enforce Restrictions In Library Dependencies . 27 Using Workspace Schematics . 35 Handling Back-end Calls With DataPersistence . 41 Summary . 46 Part 4: Helping With Builds And CI . 48 Rebuilding And Retesting only Affected Apps and Libs . 48 Summary . 52 Part 5: Development Challenges In a Monorepo . 53 How To Deal With Code Changes Between Teams. 53 Trunk-based Development . 55 A Recommended Git Strategy . 56 Summary . 59 Appendix A: Other Environments. 60 Features . 60 Appendix B: Commands . 64 Scripts Provided By the CLI . 64 Scripts Provided By Nx . 64 Appendix C: How-tos . 66 Updating Nx. 66 Where Should I Create My New Lib? . 66 Should I Reuse Or Create a Feature Library? . 67 How Do I Extract a Feature Lib From an App? . 68 Index . 70 Introduction How This Book Is Organized In Part 1 we begin by looking at development in a monorepo. We cover some basics about Nx and look at how to get started with Nx. In Part 2 we look at libraries in depth: how to organize them, name them, combine them and other techniques to aid in code reuse and modularization. In Part 3 we look at how to enforce quality and consistency across the monorepo with the tools built into Nx. In Part 4 we look at how we can help to make more intelligent builds and to use the Nx tools locally and in a CI pipeline. In Part 5 we look at some common development challenges when working in a monorepo with many teams with different release schedules. In Appendix A we look at how to interact with Nx using other tools (Angular Console). In Appendix B we look at all of the commands that you can use in Nx and refer to specific sections in the book where you can find more information on the command. In Appendix C we look at some common how-tos and illustrate the decision trees for common questions. Formatting Code blocks are formatted like this function() { console.log('hello world'); } Asides are formatted.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages76 Page
-
File Size-