docs: typo fixes for schematics-for-libraries.md (#37753)

Addresses small typos such as extra whitespaces.

This change was extracted from #29505.
This change was extracted from #29505.
This change was extracted from #29505.

PR Close #37753
This commit is contained in:
Edric Chan 2019-03-25 21:57:06 +08:00 committed by Andrew Kushnir
parent 2cbc429291
commit b2816a1536
1 changed files with 10 additions and 12 deletions

View File

@ -1,7 +1,7 @@
# Schematics for libraries # Schematics for libraries
When you create an Angular library, you can provide and package it with schematics that integrate it with the Angular CLI. When you create an Angular library, you can provide and package it with schematics that integrate it with the Angular CLI.
With your schematics, your users can use `ng add` to install an initial version of your library, With your schematics, your users can use `ng add` to install an initial version of your library,
`ng generate` to create artifacts defined in your library, and `ng update` to adjust their project for a new version of your library that introduces breaking changes. `ng generate` to create artifacts defined in your library, and `ng update` to adjust their project for a new version of your library that introduces breaking changes.
All three types of schematics can be part of a collection that you package with your library. All three types of schematics can be part of a collection that you package with your library.
@ -115,10 +115,10 @@ When you add a schematic to the collection, you have to point to it in the colle
<code-example header="projects/my-lib/schematics/my-service/schema.json (Schematic JSON Schema)" path="schematics-for-libraries/projects/my-lib/schematics/my-service/schema.json"> <code-example header="projects/my-lib/schematics/my-service/schema.json (Schematic JSON Schema)" path="schematics-for-libraries/projects/my-lib/schematics/my-service/schema.json">
</code-example> </code-example>
* *id* : A unique id for the schema in the collection. * *id*: A unique id for the schema in the collection.
* *title* : A human-readable description of the schema. * *title*: A human-readable description of the schema.
* *type* : A descriptor for the type provided by the properties. * *type*: A descriptor for the type provided by the properties.
* *properties* : An object that defines the available options for the schematic. * *properties*: An object that defines the available options for the schematic.
Each option associates key with a type, description, and optional alias. Each option associates key with a type, description, and optional alias.
The type defines the shape of the value you expect, and the description is displayed when the user requests usage help for your schematic. The type defines the shape of the value you expect, and the description is displayed when the user requests usage help for your schematic.
@ -130,9 +130,9 @@ When you add a schematic to the collection, you have to point to it in the colle
<code-example header="projects/my-lib/schematics/my-service/schema.ts (Schematic Interface)" path="schematics-for-libraries/projects/my-lib/schematics/my-service/schema.ts"> <code-example header="projects/my-lib/schematics/my-service/schema.ts (Schematic Interface)" path="schematics-for-libraries/projects/my-lib/schematics/my-service/schema.ts">
</code-example> </code-example>
* *name* : The name you want to provide for the created service. * *name*: The name you want to provide for the created service.
* *path* : Overrides the path provided to the schematic. The default path value is based on the current working directory. * *path*: Overrides the path provided to the schematic. The default path value is based on the current working directory.
* *project* : Provides a specific project to run the schematic on. In the schematic, you can provide a default if the option is not provided by the user. * *project*: Provides a specific project to run the schematic on. In the schematic, you can provide a default if the option is not provided by the user.
### Add template files ### Add template files
@ -169,10 +169,9 @@ The Schematics framework provides a file templating system, which supports both
The system operates on placeholders defined inside files or paths that loaded in the input `Tree`. The system operates on placeholders defined inside files or paths that loaded in the input `Tree`.
It fills these in using values passed into the `Rule`. It fills these in using values passed into the `Rule`.
For details of these data structure and syntax, see the [Schematics README](https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/schematics/README.md). For details of these data structures and syntax, see the [Schematics README](https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/schematics/README.md).
1. Create the main file `index.ts` and add the source code for your schematic factory function.
1. Create the main file, `index.ts` and add the source code for your schematic factory function.
1. First, import the schematics definitions you will need. The Schematics framework offers many utility functions to create and use rules when running a schematic. 1. First, import the schematics definitions you will need. The Schematics framework offers many utility functions to create and use rules when running a schematic.
@ -271,7 +270,6 @@ For more information about rules and utility methods, see [Provided Rules](https
After you build your library and schematics, you can install the schematics collection to run against your project. The steps below show you how to generate a service using the schematic you created above. After you build your library and schematics, you can install the schematics collection to run against your project. The steps below show you how to generate a service using the schematic you created above.
### Build your library and schematics ### Build your library and schematics
From the root of your workspace, run the `ng build` command for your library. From the root of your workspace, run the `ng build` command for your library.