diff --git a/src/lib/scriptGenerator.ts b/src/lib/scriptGenerator.ts index 303a4d4..61203d3 100644 --- a/src/lib/scriptGenerator.ts +++ b/src/lib/scriptGenerator.ts @@ -132,13 +132,13 @@ echo "Installation completed!"` } function generateWindowsScript(packages: SelectedPackage[]): string { - const packageNames = packages.map(p => p.id).join(' ') + const packageNames = packages.map(p => p.name).join(' ') return `# RepoHub Installation Script for Windows # Generated on ${new Date().toISOString()} # This script is idempotent and safe to run multiple times -Write-Host "Starting package installation for Windows..." +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 {} @@ -151,9 +151,9 @@ if (-not $isAdmin) { # Ensure winget is available if (-not (Get-Command winget -ErrorAction SilentlyContinue)) { - Write-Warning "Windows Package Manager (winget) is not installed." + 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." + Write-Host 'After installation completes, please re-run this script.' try { Start-Process "ms-windows-store://pdp/?productId=9NBLGGH4NNS1" } catch { @@ -163,21 +163,25 @@ if (-not (Get-Command winget -ErrorAction SilentlyContinue)) { } # Install packages using winget -Write-Host "Installing packages: ${packageNames}" +Write-Host 'Installing packages: ${packageNames}' -$packages = @(${packages.map(p => `'${p.id}'`).join(', ')}) +$packages = @(${packages.map(p => `'${p.name}'`).join(', ')}) foreach ($package in $packages) { Write-Host "Installing $package..." try { winget install --id $package --accept-package-agreements --accept-source-agreements -e - Write-Host "✓ $package installed successfully" + if ($LASTEXITCODE -ne 0) { + Write-Host "[ERROR] $package installation failed with exit code $LASTEXITCODE" + } else { + Write-Host "[OK] $package installed successfully" + } } catch { - Write-Host "✗ $package installation failed: $_" + Write-Host "[ERROR] $package installation failed: $_" } } -Write-Host "Installation completed!"` +Write-Host 'Installation completed!'` } function generateMacOSScript(packages: SelectedPackage[]): string { diff --git a/src/services/wingetPackageFetcher.ts b/src/services/wingetPackageFetcher.ts index efd89c2..59e0e9e 100644 --- a/src/services/wingetPackageFetcher.ts +++ b/src/services/wingetPackageFetcher.ts @@ -97,7 +97,7 @@ export class WingetPackageFetcher { if (!packageSet.has(identifier)) { packageSet.add(identifier) allPackages.push({ - name: pkg.name, + name: identifier, publisher: publisher.name, version: 'latest', description: `${pkg.name} by ${publisher.name}` diff --git a/src/types/index.ts b/src/types/index.ts index fe4998c..dd81990 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -17,6 +17,7 @@ export interface Package { platform?: string | Platform platform_id?: string repository: 'official' | 'third-party' + download_url?: string lastUpdated?: string downloads?: number popularity?: number