docs: add note for naming libraries (#42335)

PR Close #42335
This commit is contained in:
Aristeidis Bampakos 2021-05-26 01:35:38 +03:00 committed by Alex Rickabaugh
parent e299683692
commit aef489f139
1 changed files with 10 additions and 0 deletions

View File

@ -15,6 +15,16 @@ Use the Angular CLI to generate a new library skeleton in a new workspace with t
ng generate library my-lib ng generate library my-lib
</code-example> </code-example>
<div class="callout is-important">
<header>Naming your library</header>
You should be very careful when choosing the name of your library if you want to publish it later in a public package registry such as npm. See [Publishing your library](guide/creating-libraries#publishing-your-library).
Avoid using a name that is prefixed with `ng-`, such as `ng-library`. The `ng-` prefix is a reserved keyword used from the Angular framework and its libraries. The `ngx-` prefix is preferred as a convention used to denote that the library is suitable for use with Angular. It is also an excellent indication to consumers of the registry to differentiate between libraries of different JavaScript frameworks.
</div>
The `ng generate` command creates the `projects/my-lib` folder in your workspace, which contains a component and a service inside an NgModule. The `ng generate` command creates the `projects/my-lib` folder in your workspace, which contains a component and a service inside an NgModule.
<div class="alert is-helpful"> <div class="alert is-helpful">