Skip to content

Commit 0be5412

Browse files
JeanMechepkozlowski-opensource
authored andcommitted
docs: Update creating libraries to the current recommendations (angular#60931)
PR Close angular#60931
1 parent 975a69c commit 0be5412

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

adev/src/content/tools/libraries/creating-libraries.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ It is also an excellent indication to consumers of the registry to differentiate
2929

3030
</docs-callout>
3131

32-
The `ng generate` command creates the `projects/my-lib` folder in your workspace, which contains a component and a service inside an NgModule.
32+
The `ng generate` command creates the `projects/my-lib` folder in your workspace, which contains a component.
3333

3434
HELPFUL: For more details on how a library project is structured, refer to the [Library project files](reference/configs/file-structure#library-project-files) section of the [Project File Structure guide](reference/configs/file-structure).
3535

@@ -69,11 +69,10 @@ This builder, among other things, ensures that the library is always built with
6969

7070
To make library code reusable you must define a public API for it.
7171
This "user layer" defines what is available to consumers of your library.
72-
A user of your library should be able to access public functionality \(such as NgModules, service providers and general utility functions\) through a single import path.
72+
A user of your library should be able to access public functionality \(such as service providers and general utility functions\) through a single import path.
7373

7474
The public API for your library is maintained in the `public-api.ts` file in your library folder.
7575
Anything exported from this file is made public when your library is imported into an application.
76-
Use an NgModule to expose services and components.
7776

7877
Your library should supply documentation \(typically a README file\) for installation and maintenance.
7978

@@ -100,7 +99,7 @@ Here are some things to consider in migrating application functionality to a lib
10099
This practice lets the compiler leave the service out of the bundle if it never gets injected into the application that imports the library.
101100
For more about this, see [Tree-shakable providers](guide/di/lightweight-injection-tokens).
102101

103-
* If you register global service providers or share providers across multiple NgModules, use the [`forRoot()` and `forChild()` design patterns](guide/ngmodules/singleton-services) provided by the [RouterModule](api/router/RouterModule)
102+
* If you register global service providers expose a `provideXYZ()` provider function.
104103
* If your library provides optional services that might not be used by all client applications, support proper tree-shaking for that case by using the [lightweight token design pattern](guide/di/lightweight-injection-tokens)
105104

106105
## Integrating with the CLI using code-generation schematics

0 commit comments

Comments
 (0)