Skip to content
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

Use here-strings for JSON in Compile.ps1 #2816

Merged
merged 3 commits into from
Oct 1, 2024

Conversation

ruxunderscore
Copy link
Contributor

@ruxunderscore ruxunderscore commented Sep 24, 2024

NOTE: I recommend going through my commits to see the changes I made over time, to better understand why I coded things the way I did.

Change Compile.ps1 to use here-strings with JSON.

Type of Change

  • Refactoring

Description

This modifies the Compile.ps1 script's handling of JSON to use here-strings and -Raw, similar to what we do with Xaml. This allows us to forego the replace when we ConvertTo-Json -Depth 3.

There are a couple formatting to CamelCasing changes for consistency, as well.

Testing

Tested the Compile in pwsh and powershell (pulled in changes from @og-mrk for Pre-processing for testing in PS5.)

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • My changes generate no errors/warnings/merge conflicts.

- Change Compile.ps1 to use here-strings with JSON, similar to my changes to Xaml being ingested using here-strings.
- Modifications, allowing for the removal of all .replace() functions in JSON handler.
- Changed formatting of here-string on line 91 -> 89 to prevent accidental double in winutil.ps1 (Doesn't cause an issue, but looks better.)
- Added here-string to 95 -> 93 (This allowed the removal of the final .replace())
- Added comment to line 90.
@ruxunderscore ruxunderscore marked this pull request as ready for review September 24, 2024 21:59
@ruxunderscore
Copy link
Contributor Author

@ChrisTitusTech I had to refactor my code where I used here-strings for the Xaml stuff because of the changes to Compile.ps1 and Preprocessing around the same time, which hasn't been causing issues, and hasn't been rolled back. JSON was a little more work to do.
The rollback you are thinking of, was related to -Force being used in Preprocessing when dealing with ignoring files/directories, because it was causing compile issues on Powershell 5. I believe OG rewrote all that algorithm to fix the issue and restore functionality. Unrelated to JSON and Xaml using here-strings.

@ChrisTitusTech ChrisTitusTech merged commit d92284e into ChrisTitusTech:main Oct 1, 2024
1 check passed
@ruxunderscore ruxunderscore deleted the compile-json branch October 1, 2024 21:11
og-mrk added a commit to og-mrk/winutil that referenced this pull request Oct 23, 2024
…nstead of Unix-Style Newline Character (LF)

Originated from PR ChrisTitusTech#2816 by @ruxunderscore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants