Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation on Angular Libraries best practices #42203

Open
LAlves91 opened this issue May 20, 2021 · 11 comments
Open

Add documentation on Angular Libraries best practices #42203

LAlves91 opened this issue May 20, 2021 · 11 comments
Assignees
Labels
area: adev Angular.dev documentation P4 A relatively minor issue that is not relevant to core functions
Milestone

Comments

@LAlves91
Copy link

Greetings!

I'm currently working on improvements in the codebase for an Angular Library used in the web apps I work on. When this library was first created, we didn't have a lot of information about libraries, so there are a lot of problems regarding structure and modular approach.

I've been searching for more information on the subject, but I believe the current official documentation on custom libraries is lacking in details, especially concerning best practices for performance (like multiple entry points, configurations and structures). My main source of knowledge on the subject at the moment are some articles on the web and open source repos.

So, the purpose of this issue is to request improvements in the official library documentation, or even some other sources about this subject. I believe this woud be great for the Angular dev community!

Thank you!

@alxhub alxhub added comp: docs feature Issue that requests a new feature labels May 21, 2021
@ngbot ngbot bot modified the milestone: Backlog May 21, 2021
@vugar005
Copy link
Contributor

vugar005 commented Jun 3, 2021

Yes it would be very nice. You can also follow article of @tomastrajan blog https://link.medium.com/2QwTVrOzNgb

@tomastrajan
Copy link
Contributor

Yes it would be very nice. You can also follow article of @tomastrajan blog https://link.medium.com/2QwTVrOzNgb

The link seem to point to this issue so here is another one 😉

https://tomastrajan.medium.com/the-best-way-to-architect-your-angular-libraries-87959301d3d3?sk=0b449c5d8dd8f1b84d7957b5af8f4ab4

@vugar005
Copy link
Contributor

vugar005 commented Jun 4, 2021

@tomastrajan oh sorry lol, I posted this from mobile :)

@angular-robot angular-robot bot added the feature: votes required Feature request which is currently still in the voting phase label Jun 5, 2021
@angular-robot
Copy link
Contributor

angular-robot bot commented Jun 5, 2021

This feature request is now candidate for our backlog! In the next phase, the community has 60 days to upvote. If the request receives more than 20 upvotes, we'll move it to our consideration list.

You can find more details about the feature request process in our documentation.

@Jadamae77
Copy link

+1

@angular-robot angular-robot bot added the feature: under consideration Feature request for which voting has completed and the request is now under consideration label Jun 9, 2021
@ErynManela
Copy link

+1

@petebacondarwin
Copy link
Member

We committed a number of changes to the docs about creating libraries in the last three weeks. See https://github.com/angular/angular/commits/master/aio/content/guide/creating-libraries.md

Please can you take a look and let us know if this covers the areas you wanted improved so that we can close this issue as resolved? If it does not, please can you list specific items that need to be addressed so that we can action this request.

@petebacondarwin petebacondarwin self-assigned this Nov 12, 2021
@petebacondarwin petebacondarwin added the needs: clarification This issue needs additional clarification from the reporter before the team can investigate. label Nov 12, 2021
@LAlves91
Copy link
Author

Hi @petebacondarwin !

I think there are some more topics that could be explored (in this doc or maybe in a new "advanced concepts in angular libraries" one):

  • How libraries consumption works when a client app is bundled and how to best optimize it (and optimization approaches in cases of plain JS peer dependencies);
  • Secondary entry-points (kinda related to the topic above) and how to better make use of them (approaches to separate/put together artifacts in entry-points, folder structure, use of path mapping and barrel import);
  • Strategies to avoid circular dependencies (which breaks libraries migrating to Angular 12+);

Those are the topics that come to mind here (which are based on some of my struggles refactoring a gigantic Angular library in my company - more of a core frontend library for multiple related apps, instead of just reusable components). Maybe other participants of this issue have some other suggestions!

Cheers!

@tomastrajan
Copy link
Contributor

tomastrajan commented Nov 13, 2021

Hey @LAlves91

Secondary entry-points (kinda related to the topic above)

the secondary entry points are now have official documentation here 👍

Strategies to avoid circular dependencies (which breaks libraries migrating to Angular 12+);

(circular deps can be prevented with sub-entries

@petebacondarwin petebacondarwin added this to Inbox in Feature Requests via automation Nov 26, 2021
@petebacondarwin petebacondarwin moved this from Inbox to Backlog in Feature Requests Nov 26, 2021
@lwensveen
Copy link

I would like to add to this:

I'm trying to migrate a angular app to a multi project workspace where my library already lives. The errors that I now get inside my library are:

No pipe found with name 'async'. and Can't bind to 'ngClass' since it isn't a known property of 'div'. which would imply that I'm missing a CommonModule, yet when I check the module imports it's there and the component itself is also in the declarations. As far as I know those are the two things to check when this occurs.

Now this error isn't giving me any useful information and the docs are pretty summary which makes it hard to look for a solution.

@varthc
Copy link

varthc commented May 25, 2022

the secondary entry points are now have official documentation here 👍

IMHO it'd be nice to add more info/examples about it, instead of just explaining what it is.

@josmar-crwdstffng josmar-crwdstffng added doc-topic: dev-guides P4 A relatively minor issue that is not relevant to core functions labels Jun 28, 2022
@jessicajaniuk jessicajaniuk added canonical This issue represents a canonical design issue in Angular. and removed feature Issue that requests a new feature feature: under consideration Feature request for which voting has completed and the request is now under consideration labels Aug 8, 2022
@jessicajaniuk jessicajaniuk removed the feature: votes required Feature request which is currently still in the voting phase label Aug 8, 2022
@jessicajaniuk jessicajaniuk removed needs: clarification This issue needs additional clarification from the reporter before the team can investigate. canonical This issue represents a canonical design issue in Angular. labels Oct 3, 2022
@JeanMeche JeanMeche added area: adev Angular.dev documentation and removed area: aio labels Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: adev Angular.dev documentation P4 A relatively minor issue that is not relevant to core functions
Projects
No open projects
Development

No branches or pull requests