docs: fix cli builder doc (#31305)

PR Close #31305
This commit is contained in:
Syu Kato 2019-06-27 17:30:28 +09:00 committed by Kara Erickson
parent bed680cff8
commit f2466cf4ee
1 changed files with 31 additions and 33 deletions

View File

@ -253,7 +253,7 @@ In the `package.json` file, add a `builders` key that tells the Architect tool w
</code-example> </code-example>
The official name of our builder is now ` @example/command-runner:command`. The official name of our builder is now ` @example/command-runner:command`.
The first part of this is the package name (resolved using node resolution), and the second part is the builder name (resolved using the `builder.json` file). The first part of this is the package name (resolved using node resolution), and the second part is the builder name (resolved using the `builders.json` file).
Using one of our `options` is very straightforward, we did this in the previous section when we accessed `options.command`. Using one of our `options` is very straightforward, we did this in the previous section when we accessed `options.command`.
@ -279,28 +279,28 @@ By default, for example, the `build` command runs the builder `@angular-devkit/
"myApp": { "myApp": {
... ...
"architect": { "architect": {
"build": { "build": {
"builder": "@angular-devkit/build-angular:browser", "builder": "@angular-devkit/build-angular:browser",
"options": { "options": {
"outputPath": "dist/myApp", "outputPath": "dist/myApp",
"index": "src/index.html", "index": "src/index.html",
... ...
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
...
}
}
}, },
... "configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
...
}
}
},
...
</code-example> </code-example>
@ -419,15 +419,13 @@ We need to update the `angular.json` file to add a target for this builder to th
"projects": { "projects": {
"builder-test": { "builder-test": {
"architect": { "architect": {
"builder-test": { "touch": {
"touch": { "builder": "@example/command-runner:command",
"builder": "@example/command-runner:command", "options": {
"options": { "command": "touch",
"command": "touch", "args": [
"args": [ "src/main.ts"
"src/main.ts" ]
]
}
} }
}, },
"build": { "build": {
@ -497,14 +495,14 @@ The test uses the builder to run the `ls` command, then validates that it ran su
<code-example language="typescript"> <code-example language="typescript">
import { Architect, ArchitectHost } from '@angular-devkit/architect'; import { Architect } from '@angular-devkit/architect';
import { TestingArchitectHost } from '@angular-devkit/architect/testing'; import { TestingArchitectHost } from '@angular-devkit/architect/testing';
// Our builder forwards the STDOUT of the command to the logger. // Our builder forwards the STDOUT of the command to the logger.
import { logging, schema } from '@angular-devkit/core'; import { logging, schema } from '@angular-devkit/core';
describe('Command Runner Builder', () => { describe('Command Runner Builder', () => {
let architect: Architect; let architect: Architect;
let architectHost: ArchitectHost; let architectHost: TestingArchitectHost;
beforeEach(async () => { beforeEach(async () => {
const registry = new schema.CoreSchemaRegistry(); const registry = new schema.CoreSchemaRegistry();