fix(bazel): Make sure only single copy of @angular/bazel is installed (#30072)

When `ng add` is invoked independently of `ng new`, a node installation
of `@angular/bazel` is performed by the CLI before invoking the
schematic. This step appends `@angular/bazel` to the `dependencies`
section of `package.json`. The schematics then appends the same package
to `devDependencies`.

This leads to the warning:

```
warning package.json: "dependencies" has dependency "@angular/bazel" with
range "^8.0.0-beta.13" that collides with a dependency in "devDependencies"
of the same name with version "~8.0.0-beta.12"
```

PR Close #30072
This commit is contained in:
Keen Yee Liau
2019-04-23 12:51:13 -07:00
committed by Andrew Kushnir
parent e8d3246c6e
commit 2905bf5548
3 changed files with 27 additions and 8 deletions

View File

@ -40,7 +40,7 @@ export function removeKeyValueInAstObject(
const start = prop.start.offset;
const end = prop.end.offset;
let length = end - start;
const match = content.slice(end).match(/[,\s]+/);
const match = content.slice(end).match(/^[,\s]+/);
if (match) {
length += match.pop() !.length;
}