Skip to content

Add lightweight token doc to library section#36144

Closed
jbogarthyde wants to merge 4 commits intoangular:masterfrom
jbogarthyde:jb-lightweight-tokens
Closed

Add lightweight token doc to library section#36144
jbogarthyde wants to merge 4 commits intoangular:masterfrom
jbogarthyde:jb-lightweight-tokens

Conversation

@jbogarthyde
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Misko wrote up a design doc for the new lightweight-token design pattern that is recommended for library developers.

Issue Number: N/A

What is the new behavior?

The design doc content is transformed to user doc aimed at library developers and added to AIO as a new page in the Libraries section, with a link from
https://angular.io/guide/creating-libraries#refactoring-parts-of-an-app-into-a-library

Does this PR introduce a breaking change?

  • Yes
  • No

@jbogarthyde jbogarthyde added feature Label used to distinguish feature request from other issues comp: docs effort2: days freq2: medium target: patch This PR is targeted for the next patch release risk: low labels Mar 19, 2020
@jbogarthyde jbogarthyde self-assigned this Mar 19, 2020
@ngbot ngbot bot modified the milestone: Backlog Mar 19, 2020
@mary-poppins
Copy link

You can preview 3e8e537 at https://pr36144-3e8e537.ngbuilds.io/.

@jbogarthyde jbogarthyde force-pushed the jb-lightweight-tokens branch from 3e8e537 to d75cfac Compare March 23, 2020 15:25
@mary-poppins
Copy link

You can preview d75cfac at https://pr36144-d75cfac.ngbuilds.io/.

@jbogarthyde jbogarthyde force-pushed the jb-lightweight-tokens branch from d75cfac to c8c37f6 Compare March 24, 2020 14:38
@mary-poppins
Copy link

You can preview c8c37f6 at https://pr36144-c8c37f6.ngbuilds.io/.

@jbogarthyde jbogarthyde force-pushed the jb-lightweight-tokens branch from c8c37f6 to 3c1f196 Compare March 25, 2020 16:08
@mary-poppins
Copy link

You can preview 3c1f196 at https://pr36144-3c1f196.ngbuilds.io/.

@mary-poppins
Copy link

You can preview 38a27e5 at https://pr36144-38a27e5.ngbuilds.io/.

@jbogarthyde jbogarthyde force-pushed the jb-lightweight-tokens branch from 38a27e5 to 6995f77 Compare March 31, 2020 22:58
@mary-poppins
Copy link

You can preview 6995f77 at https://pr36144-6995f77.ngbuilds.io/.

@jbogarthyde jbogarthyde added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jun 15, 2020
@jbogarthyde jbogarthyde force-pushed the jb-lightweight-tokens branch from 00367e8 to 849b773 Compare June 15, 2020 14:43
@mary-poppins
Copy link

You can preview 849b773 at https://pr36144-849b773.ngbuilds.io/.

@jbogarthyde jbogarthyde force-pushed the jb-lightweight-tokens branch from 849b773 to c0badec Compare June 16, 2020 14:34
@mary-poppins
Copy link

You can preview c0badec at https://pr36144-c0badec.ngbuilds.io/.

@aikithoughts
Copy link
Contributor

Is there anything else holding this PR from being ready for merge? @devversion and @gkalpak?

@devversion
Copy link
Member

devversion commented Jun 19, 2020

@aikidave Not from my side. I was just commenting here as the proposed pattern was not supported in Angular initially. I've sent a PR that makes it work. That should be available in the next minor. #37506.

We should probably mark this docs change as master-only, and it looks like it's still pending review.

@jbogarthyde jbogarthyde added target: major This PR is targeted for the next major release and removed target: patch This PR is targeted for the next patch release labels Jun 22, 2020
@mary-poppins
Copy link

You can preview ad96aef at https://pr36144-ad96aef.ngbuilds.io/.

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

posting partial review feedback. mostly just nitpicks + terminology clarifications.

jbogarthyde and others added 3 commits June 23, 2020 13:22
adds new DI technique recommendation for libraries to ensure tree-shaking for unused services
includes reasons for packaging schematics with libraries, clarify schematic usage recommendation
@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@IgorMinar
Copy link
Contributor

I rebased this PR and force-pushed into the PR branch. @jbogarthyde please pull change from github if you are going to make further edits to this PR.

@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@jbogarthyde
Copy link
Contributor Author

@IgorMinar Thanks -- I am not going to make any more changes, unless you have any more comments.

@mary-poppins
Copy link

You can preview a0abbe7 at https://pr36144-a0abbe7.ngbuilds.io/.

Copy link
Contributor

@IgorMinar IgorMinar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change LGTM now.

I'd like us to follow up on it after v10 is out and address several key points:

  • the intro into the guide could be more focused "This guide documents a recommended pattern for Angular library authors that ensure that their libraries are optimizable. Angular libraries are often composed of core functionality, as well as optional features. This lightweight injection pattern ensure that the code associated with the optional features unused by a particular application, is optimized away during production builds of this application."
  • some of the headings could be made more clear, I'll defer to @aikidave's guidance on this
  • somewhere early on, we should state that the pattern is applicable to two use-cases: optional features expressed as directives or components that the core part of the librarie queries for via @ContentChild, @ViewChild, etc. and optional dependencies injected into the constructor of a service or a component and flagged with the @Optional() decorator - this guide seems to mix these two use-cases, which results in confusion when the reader reads it. Again - the pattern and the recommendation to use abstract classes are applicable to both scenarios, but we should document them as two distinct use-case and show them off on two different examples.

The rest looks good. Thanks!

@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

A Googler has manually verified that the CLAs look good.

(Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.)

ℹ️ Googlers: Go here for more info.

@mary-poppins
Copy link

You can preview d68bc1c at https://pr36144-d68bc1c.ngbuilds.io/.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes effort2: days feature Label used to distinguish feature request from other issues freq2: medium risk: low target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants