rename scripts and fix collections location

This commit is contained in:
2026-07-22 12:20:35 +02:00
parent 1fd36fd957
commit 5ae3b93436
6 changed files with 26 additions and 15 deletions
@@ -6,7 +6,7 @@ cd /D "%~dp0"
echo.
@pwsh -NoProfile -ExecutionPolicy Bypass -Command .\scripts\generate-http-requests.ps1 %*
@pwsh -NoProfile -ExecutionPolicy Bypass -Command .\scripts\generate-httpyac-requests.ps1 %*
echo.
@@ -1,14 +1,16 @@
#requires -Modules powershell-yaml
param(
[string]$StartDir = (Split-Path -LiteralPath $MyInvocation.MyCommand.Path)
[string]$StartDir = (Resolve-Path -LiteralPath (Join-Path -Path (Split-Path -LiteralPath $MyInvocation.MyCommand.Path) -ChildPath "../bruno")),
[string]$OutputDir = (Resolve-Path -LiteralPath (Join-Path -Path (Split-Path -LiteralPath $MyInvocation.MyCommand.Path) -ChildPath ".."))
)
$DEFAULT_ENV_VAR_VALUE = 'EDIT_VALUE_HERE'
$VARIABLE_NAME_VALUE_SEPARATOR = '='
function Find-WorkspaceRoot($startDir) {
$current = $startDir
function Find-WorkspaceRoot($dir) {
Write-Host "Processing workspace folder: '$dir'..."
$current = $dir
while ($true) {
if (Test-Path -LiteralPath (Join-Path $current 'workspace.yml')) {
return $current
@@ -997,7 +999,7 @@ function Write-JsFiles ($sourceDir, $outputRoot) {
function Invoke-Main {
# Workspace root
$workspaceRoot = Find-WorkspaceRoot $PSScriptRoot
$workspaceRoot = Find-WorkspaceRoot $StartDir
$workspaceFile = Join-Path $workspaceRoot 'workspace.yml'
$workspace = Parse-Workspace $workspaceFile
$collections = @()
@@ -1009,7 +1011,12 @@ function Invoke-Main {
throw "No collections found in workspace.yml"
}
$outputBaseRoot = Join-Path $workspaceRoot 'autodocs/httpyac'
$outputBaseRoot = Join-Path $OutputDir 'autodocs/httpyac'
if (-not (Test-Path $outputBaseRoot)) {
New-Item -ItemType Directory -Path $outputBaseRoot | Out-Null
}
$outputBaseRoot = Resolve-Path -LiteralPath $outputBaseRoot
Clean-Folder $outputBaseRoot
foreach ($collection in $collections) {
+8 -4
View File
@@ -25,8 +25,12 @@ function Ask-YesNo($message) {
}
# Funzione per chiedere un valore
function Ask-Value($key) {
return Read-Host "Valore per '$key' (digita `"`" per inserire stringa vuota e lascia vuoto per NON aggiornare)"
function Ask-Value($key, $currentValue) {
$currentValueHint = ""
if (-not [string]::IsNullOrEmpty($currentValue)) {
$currentValueHint = "[attuale: '$currentValue'] "
}
return Read-Host "Chiave '$key' $currentValueHint`n(digita `"`" per inserire stringa vuota e lascia vuoto per NON aggiornare)"
}
# Copia profonda preservando ordine
@@ -79,8 +83,6 @@ foreach ($topKey in $parsedJson.Keys) {
continue
}
$inputValue = Ask-Value $key
if ($existingEnv -and $existingEnv["API"] -and $existingEnv["API"].Contains($sectionName)) {
$oldValue = $existingEnv["API"][$sectionName][$key]
}
@@ -88,6 +90,8 @@ foreach ($topKey in $parsedJson.Keys) {
$oldValue = ""
}
$inputValue = Ask-Value $key $oldValue
if ($inputValue -eq "") {
# Mantieni valore esistente se presente
$newSection[$key] = $oldValue
+2 -2
View File
@@ -1,6 +1,6 @@
# Percorsi file
$envFile = Join-Path $PSScriptRoot ".." "env.json" # JSON originale
$collectionsRoot = Join-Path $PSScriptRoot ".." "collections" # cartella di partenza delle collezioni
$envFile = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot ".." "env.json") # JSON originale
$collectionsRoot = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot ".." "bruno/collections") # cartella di partenza delle collezioni
# Costanti
$ENV_JSON_FILENAME = "env.json"
@@ -1,6 +1,6 @@
# Percorsi file
$envFile = Join-Path $PSScriptRoot ".." "env.json" # JSON originale
$collectionsRoot = Join-Path $PSScriptRoot ".." "autodocs/httpyac" # cartella di partenza delle collezioni
$envFile = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot ".." "env.json") # JSON originale
$collectionsRoot = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot ".." "autodocs/httpyac") # cartella di partenza delle collezioni
# Costanti
$API_SECTION_NAME = "API"
@@ -6,7 +6,7 @@ cd /D "%~dp0"
echo.
@pwsh -NoProfile -ExecutionPolicy Bypass -Command .\scripts\update-http-requests-environments.ps1 %*
@pwsh -NoProfile -ExecutionPolicy Bypass -Command .\scripts\update-httpyac-environments.ps1 %*
echo.