fix(bazel): support running ng-add on minimal applications (#29681)

Minimal applications don't have `test` and `e2e` targets but we are not currently checking if they exists.

Fixes #29680

PR Close #29681
This commit is contained in:
Alan
2019-04-03 15:00:32 +02:00
committed by Jason Aden
parent 8e83b3bec1
commit 9810c6c0f9
2 changed files with 29 additions and 7 deletions

View File

@ -154,15 +154,18 @@ function updateAngularJsonToUseBazelBuilder(options: Schema): Rule {
},
},
indent);
replacePropertyInAstObject(
recorder, architect, 'test', {
builder: '@angular/bazel:build',
options: {'bazelCommand': 'test', 'targetLabel': '//src/...'},
},
indent);
if (findPropertyInAstObject(architect, 'test')) {
replacePropertyInAstObject(
recorder, architect, 'test', {
builder: '@angular/bazel:build',
options: {'bazelCommand': 'test', 'targetLabel': '//src/...'},
},
indent);
}
const e2eArchitect = findE2eArchitect(workspaceJsonAst, name);
if (e2eArchitect) {
if (e2eArchitect && findPropertyInAstObject(e2eArchitect, 'e2e')) {
replacePropertyInAstObject(
recorder, e2eArchitect, 'e2e', {
builder: '@angular/bazel:build',