docs: ident the library shematics guide properly (#41755)

PR Close #41755
This commit is contained in:
Aristeidis Bampakos 2021-04-21 23:49:55 +03:00 committed by Jessica Janiuk
parent 122c8ba0e3
commit dfdd4a2d74

View File

@ -225,9 +225,9 @@ The `Tree` methods give you access to the complete file tree in your workspace,
<code-example header="projects/my-lib/schematics/my-service/index.ts (Schema Import)" path="schematics-for-libraries/projects/my-lib/schematics/my-service/index.ts" region="workspace"> <code-example header="projects/my-lib/schematics/my-service/index.ts (Schema Import)" path="schematics-for-libraries/projects/my-lib/schematics/my-service/index.ts" region="workspace">
</code-example> </code-example>
* Be sure to check that the context exists and throw the appropriate error. Be sure to check that the context exists and throw the appropriate error.
1. The `WorkspaceDefinition`, `extensions` property includes a `defaultProject` value for determining which project to use if not provided. 1. The `workspace.extensions` property includes a `defaultProject` value for determining which project to use if not provided.
We will use that value as a fallback, if no project is explicitly specified in the `ng generate` command. We will use that value as a fallback, if no project is explicitly specified in the `ng generate` command.
<code-example header="projects/my-lib/schematics/my-service/index.ts (Default Project)" path="schematics-for-libraries/projects/my-lib/schematics/my-service/index.ts" region="project-fallback"> <code-example header="projects/my-lib/schematics/my-service/index.ts (Default Project)" path="schematics-for-libraries/projects/my-lib/schematics/my-service/index.ts" region="project-fallback">
@ -238,7 +238,7 @@ The `Tree` methods give you access to the complete file tree in your workspace,
<code-example header="projects/my-lib/schematics/my-service/index.ts (Project)" path="schematics-for-libraries/projects/my-lib/schematics/my-service/index.ts" region="project-info"> <code-example header="projects/my-lib/schematics/my-service/index.ts (Project)" path="schematics-for-libraries/projects/my-lib/schematics/my-service/index.ts" region="project-info">
</code-example> </code-example>
The `workspace projects` object contains all the project-specific configuration information. The `workspace.projects` object contains all the project-specific configuration information.
1. The `options.path` determines where the schematic template files are moved to once the schematic is applied. 1. The `options.path` determines where the schematic template files are moved to once the schematic is applied.
@ -272,7 +272,7 @@ A `Rule` can use external template files, transform them, and return another `Ru
The `chain()` method allows you to combine multiple rules into a single rule, so that you can perform multiple operations in a single schematic. The `chain()` method allows you to combine multiple rules into a single rule, so that you can perform multiple operations in a single schematic.
Here you are only merging the template rules with any code executed by the schematic. Here you are only merging the template rules with any code executed by the schematic.
See a complete exampled of the schematic rule function. See a complete example of the schematic rule function below.
<code-example header="projects/my-lib/schematics/my-service/index.ts" path="schematics-for-libraries/projects/my-lib/schematics/my-service/index.ts"> <code-example header="projects/my-lib/schematics/my-service/index.ts" path="schematics-for-libraries/projects/my-lib/schematics/my-service/index.ts">
</code-example> </code-example>