@angular-devkit/core#JsonParseMode TypeScript Examples
The following examples show how to use
@angular-devkit/core#JsonParseMode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: util.ts From angular-git-info with MIT License | 7 votes |
export function parseJsonAtPath(tree: Tree, path: string): JsonAstObject {
const buffer = tree.read(path);
if (buffer === null) {
throw new SchematicsException('Could not read package.json.');
}
const content = buffer.toString();
const json = parseJsonAst(content, JsonParseMode.Strict);
if (json.kind != 'object') {
throw new SchematicsException(
'Invalid package.json. Was expecting an object'
);
}
return json;
}