mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-22 15:02:11 +08:00
The schematics `Tree` now contains an additional `readJSON` method that supports directly reading and parsing the content of a file as UTF-8 JSON with comment support. This avoids the need to manually decode a Buffer, parse and handle JSON comments within a schematic when JSON content is needed. If a file path does not exist, an exception will be thrown. While this differs from the semantics of `read`, it helps reduce the amount of code needed for common schematic use cases. JSON parse errors will also result in an exception being thrown with a message detailing the error.