Skip to content

Commit

Permalink
Optimization.
Browse files Browse the repository at this point in the history
  • Loading branch information
emadadel4 committed Nov 22, 2024
1 parent 0af4dc3 commit 70b9ad5
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function GenerateCheckboxes {

foreach ($Item in $Items) {
# Clean description and category to remove special characters
$CleanedDescription = $Item.Description -replace '[^\w\s.]', ''
$CleanedDescription = $Item.Description -replace '[^\w\s./]', ''
$CleanedCategory = $Item.Category -replace '[^\w\s]', ''

# Get content from the specified content field
Expand Down Expand Up @@ -160,13 +160,22 @@ function Sync-JsonFiles {
[string]$OutputScriptPath
)

Get-ChildItem $DatabaseDirectory | Where-Object {$_.extension -eq ".json"} | ForEach-Object {
$json = (Get-Content $_.FullName -Raw).replace("'", "''")
Get-ChildItem $DatabaseDirectory | Where-Object {$_.Extension -eq ".json"} | ForEach-Object {
# Get the content of the JSON file as raw text
$json = Get-Content $_.FullName -Raw

# Cache json file into $itt.database
$itt.database.$($_.BaseName) = $json | ConvertFrom-Json
Write-Output "`$itt.database.$($_.BaseName) = '$json' | ConvertFrom-Json" | Out-File $OutputScriptPath -Append -Encoding default

# Prepare the output with the @' and '@ format
$output = "`$itt.database.$($_.BaseName) = @'`n$json`n'@ | ConvertFrom-Json"

# Write the output to the script file
Write-Output $output | Out-File $OutputScriptPath -Append -Encoding Default
}
}


# Update app tweaks etc count.. from README.MD
function Update-Readme {
param (
Expand Down

0 comments on commit 70b9ad5

Please sign in to comment.