-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Introduce Schematics Tree methods for readText
and readJSON
#23006
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3a3af1f
to
fdfc3cc
Compare
fdfc3cc
to
691133f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for splitting up the commits and taking the time to update existing usages. The readJSON()
improvements seem particularly nice.
fa10db3
to
87cbc51
Compare
…ly from a Tree The schematics `Tree` now contains an additional `readText` method that supports directly reading the content of a file as UTF-8 text. This avoids the need to manually decode a Buffer within a schematic when text 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.
…ly from a Tree 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.
87cbc51
to
c7f1642
Compare
… and `readJSON` functionality Code related to decoding buffers into strings and parsing content into JSON can now be removed by using the support provided directly from the Tree instance for the executing schematic.
c7f1642
to
b3c4229
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The schematics
Tree
now contains an additionalreadText
method that supports directlyreading the content of a file as UTF-8 text. This avoids the need to manually decode a Buffer
within a schematic when text 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 amountof code needed for common schematic use cases.
The schematics
Tree
now contains an additionalreadJSON
method that supports directlyreading 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.