From c5db2f3ae930cf5d870eb463d4385665e4e4a717 Mon Sep 17 00:00:00 2001 From: Pier-Paolo Mammi Date: Thu, 2 Jul 2026 10:18:02 +0200 Subject: [PATCH] add environment setup script --- scripts/setup-environment.ps1 | 41 +++++++++++++++++++++++++++++++++++ setup-environment.bat | 13 +++++++++++ 2 files changed, 54 insertions(+) create mode 100644 scripts/setup-environment.ps1 create mode 100644 setup-environment.bat diff --git a/scripts/setup-environment.ps1 b/scripts/setup-environment.ps1 new file mode 100644 index 0000000..38b0fec --- /dev/null +++ b/scripts/setup-environment.ps1 @@ -0,0 +1,41 @@ +function Initialize-PowerShellEnvironment { + Write-Host "Initializing PowerShell environment..." -ForegroundColor Yellow + + # Add any environment setup logic here, such as importing modules, setting variables, etc. + # Example: Import-Module SomeModule + Import-Module powershell-yaml -ErrorAction SilentlyContinue + + Write-Host "PowerShell environment initialized." -ForegroundColor Green +} + +function Initialize-GenerateTools { + Write-Host "Initializing Node.js dependencies..." -ForegroundColor Yellow + + Push-Location -StackName NodeTools (Join-Path $PSScriptRoot "../scripts/") + + # Install Node.js dependencies + & npm install + if ($LASTEXITCODE -ne 0) { + Write-Error "npm install failed with exit code $LASTEXITCODE." + exit 1 + } + + Pop-Location -StackName NodeTools + + Write-Host "Node.js dependencies initialized." -ForegroundColor Green +} + +function Invoke-Main { + Write-Host "Preparing environment..." -ForegroundColor Cyan + Write-Host + + Initialize-PowerShellEnvironment + Write-Host + + Initialize-GenerateTools + Write-Host + + Write-Host "Environment preparation complete!" -ForegroundColor Green +} + +Invoke-Main \ No newline at end of file diff --git a/setup-environment.bat b/setup-environment.bat new file mode 100644 index 0000000..3ca07f7 --- /dev/null +++ b/setup-environment.bat @@ -0,0 +1,13 @@ +@echo off +echo %cmdcmdline% | findstr /i /c:"%~nx0" >NUL && set iscommandline=1 +echo %PSModulePath% | findstr /i /c:"%USERPROFILE%" >NUL && set ispowershell=1 + +cd /D "%~dp0" + +echo. + +@pwsh -NoProfile -ExecutionPolicy Bypass -Command .\scripts\setup-environment.ps1 %* + +echo. + +IF DEFINED iscommandline IF NOT DEFINED ispowershell pause