feat: add comprehensive Windows PowerShell script usage instructions

- Enhanced ScriptPreview with detailed Windows-specific installation steps including execution policy handling and winget availability checks
- Added localization support for all script preview UI elements and Windows usage instructions
- Improved script generator with automatic unblocking, admin privilege warnings, and winget validation
This commit is contained in:
Yusuf İpek
2025-11-11 16:13:29 +03:00
parent a462c18cc6
commit 299e951368
7 changed files with 457 additions and 33 deletions
+4 -1
View File
@@ -35,7 +35,10 @@ export async function query(text: string, params?: any[]) {
try {
const res = await pool.query(text, params)
const duration = Date.now() - start
console.log('📊 Query executed', { text, duration, rows: res.rowCount })
// Only log slow queries (> 100ms) or errors
if (duration > 100) {
console.log('⚠️ Slow query', { text: text.substring(0, 50), duration, rows: res.rowCount })
}
return res
} catch (error) {
console.error('❌ Query failed', { text, error })
+22
View File
@@ -140,6 +140,28 @@ function generateWindowsScript(packages: SelectedPackage[]): string {
Write-Host "Starting package installation for Windows..."
# Try to unblock this script (no-op if not needed)
try { Unblock-File -Path $MyInvocation.MyCommand.Path -ErrorAction SilentlyContinue } catch {}
# Warn if not running as Administrator (some installs may require elevation)
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $isAdmin) {
Write-Warning "It's recommended to run this script as Administrator for best results."
}
# Ensure winget is available
if (-not (Get-Command winget -ErrorAction SilentlyContinue)) {
Write-Warning "Windows Package Manager (winget) is not installed."
Write-Host "We'll open the Microsoft Store page for 'App Installer' (includes winget)."
Write-Host "After installation completes, please re-run this script."
try {
Start-Process "ms-windows-store://pdp/?productId=9NBLGGH4NNS1"
} catch {
Write-Host "If the Store didn't open, install 'App Installer' manually from: https://aka.ms/getwinget"
}
exit 1
}
# Install packages using winget
Write-Host "Installing packages: ${packageNames}"