Leanpub Header

Skip to main content

Angular Libraries - The Complete Guide

You will learn strategies for organizing your code using Angular libraries and how to distribute and publish to NPM or in your local development environment.

Minimum price

$7.99

$14.99

You pay

$14.99

Author earns

$11.99
$

...Or Buy With Credits!

You can get credits with a paid monthly or annual Reader Membership, or you can buy them here.
PDF
EPUB
141
Pages
14,082Words
About

About

About the Book

This book guides Angular developers through the process of creating custom Angular Libraries. Learn how to identify candidates for libraries and create different types of Angular libraries. Also includes information on how to create your own Schematic/Generator to scaffold your own custom libraries using the CLI.

  • Details on different Angular Module/Library types within an application: service, feature, core, and shared.
  • How to structure application for code reuse.
  • Managing Custom Libraries versions.
  • Details on how to publish locally and to NPM.

Share this book

Categories

Author

About the Author

Matt Vaughn

Matt Vaughn is a seasoned professional web developer with over 20 years of web development experience. What more can you say, he's seen a lot. He has been a .NET developer since 2001. His approach to solving problems is simple. Keep things simple. Matt takes a pragmatic approach to technical solutions. He utilizes common design patterns, object-oriented programming, and other proven principles like SOLID.

Leanpub Podcast

Episode 177

An Interview with Matt Vaughn

Contents

Table of Contents

1Introduction

  1. Million Dollar Mistake

2What Are Angular Libraries?

  1. What’s in a Library?

3Angular Library Types

  1. Shared UI Components
  2. Cross-Cutting Concerns (Infrastructure)
  3. Common Cross-Cutting Concerns
  4. UI Feature
  5. Domain Service
  6. Shared Types
  7. API Response
  8. Domain Types (e.g., customer, product, order, etc.)
  9. Framework
  10. Rules Engine
  11. Business Actions
  12. Validators
  13. Custom asynchronous validators for Reactive Forms
  14. Email
  15. Password Strength
  16. Postal Codes
  17. Names
  18. Address

4How to Identify Library Candidates

  1. Similar Code
  2. Isolate Shared Code
  3. Friends Don’t Let Friends Copy and Paste

5Creating Custom Libraries

  1. Prerequisite: Workspace
  2. Angular Workspace (default)
  3. Angular Workspace Projects
  4. Error Handler
  5. Build Library (default non-prod)
  6. Build with --prod
  7. CLI Command Recap

6Publishing and Distributing Angular Libraries

  1. Publishing to NPM
  2. Update the Package.json
  3. Building and Publishing Libraries
  4. Fix 1: Build Package Using --prod
  5. Fix 2: Publish Package with --ignore-scripts
  6. Fix 3: TSConfig with "enableIvy": false
  7. Fix 4: TSConfig with "compilationMode": "partial"
  8. Details On How To Publish Locally and to Npm
  9. Managing Custom Libraries Versions

7Nx Workspace

8Workspace Structure for Code Reuse

9Code Organization Strategies with Libraries

10Angular Package Format (Historical View)

  1. September 26, 2016
  2. October 6, 2016
  3. December 14, 2016
  4. January 17, 2017
  5. March 20, 2017
  6. April 9, 2017
  7. June 6, 2017
  8. Jun 29, 2017
  9. December 7, 2017
  10. December 15, 2017
  11. February 20, 2018
  12. May 6, 2020
  13. April 15, 2021

11Resources

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub