| 1 | # This is used in a task in .vscode/tasks.json when on windows |
| 2 | # Start developing with: |
| 3 | # - Run Task -> Install Dependencies |
| 4 | # - Debug -> Extension |
| 5 | |
| 6 | # Everything needs node and npm |
| 7 | Write-Host "`nChecking for dependencies that may require manual installation...`n" -ForegroundColor White |
| 8 | |
| 9 | # $cargo = (get-command cargo -ErrorAction SilentlyContinue) |
| 10 | # if ($null -eq $cargo) { |
| 11 | # Write-Host "Not Found " -ForegroundColor Red -NoNewLine |
| 12 | # Write-Host "cargo" |
| 13 | # } else { |
| 14 | # Write-Host "Found " -ForegroundColor Green -NoNewLine |
| 15 | # & cargo --version |
| 16 | # } |
| 17 | |
| 18 | $node = (get-command node -ErrorAction SilentlyContinue) |
| 19 | if ($null -eq $node) { |
| 20 | Write-Host "Not Found " -ForegroundColor Red -NoNewLine |
| 21 | Write-Host "node" |
| 22 | } else { |
| 23 | Write-Host "Found " -ForegroundColor Green -NoNewLine |
| 24 | Write-Host "node " -NoNewLine |
| 25 | & node --version |
| 26 | } |
| 27 | |
| 28 | # Node.js version check |
| 29 | if (Test-Path ".nvmrc") { |
| 30 | $requiredNodeVersion = Get-Content ".nvmrc" |
| 31 | $currentNodeVersion = node -v |
| 32 | |
| 33 | # Remove 'v' prefix from versions for comparison |
| 34 | $requiredVersion = $requiredNodeVersion.TrimStart('v') |
| 35 | $currentVersion = $currentNodeVersion.TrimStart('v') |
| 36 | |
| 37 | if ($requiredVersion -ne $currentVersion) { |
| 38 | Write-Host "`n⚠️ Warning: Your Node.js version ($currentNodeVersion) does not match the required version ($requiredNodeVersion)" -ForegroundColor Yellow |
| 39 | Write-Host "Please consider switching to the correct version using: nvm use" -ForegroundColor Yellow |
| 40 | |
| 41 | # Check if running in interactive mode |
| 42 | if ([Environment]::UserInteractive -and [Environment]::GetCommandLineArgs().Count -eq 0) { |
| 43 | Write-Host "Press Enter to continue with installation anyway..." -NoNewline -ForegroundColor Yellow |
| 44 | $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown") |
| 45 | Write-Host "`n" # Add newline after key press |
| 46 | } else { |
| 47 | Write-Host "Continuing with installation anyway...`n" -ForegroundColor Yellow |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | |
| 53 | # if ($null -eq $cargo) { |
| 54 | # Write-Host "`n...`n" |
| 55 | # Write-Host "Cargo`n" -ForegroundColor White |
| 56 | # Write-Host "Doesn't appear to be installed or is not on your Path." |
| 57 | # Write-Host "For how to install cargo see:" -NoNewline |
| 58 | # Write-Host "https://doc.rust-lang.org/cargo/getting-started/installation.html" -ForegroundColor Green |
| 59 | # } |
| 60 | |
| 61 | if ($null -eq $node) { |
| 62 | Write-Host "`n...`n" |
| 63 | Write-Host "NodeJS`n" -ForegroundColor White |
| 64 | Write-Host "Doesn't appear to be installed or is not on your Path." |
| 65 | Write-Host "On most Windows systems you can install node using: " -NoNewLine |
| 66 | Write-Host "winget install OpenJS.NodeJS.LTS " -ForegroundColor Green |
| 67 | Write-Host "After installing restart your Terminal to update your Path." |
| 68 | Write-Host "Alternatively see: " -NoNewLine |
| 69 | Write-Host "https://nodejs.org/" -ForegroundColor Yellow |
| 70 | } |
| 71 | |
| 72 | if (($null -eq $node)) { |
| 73 | return "`nSome dependencies that may require installation could not be found. Exiting" |
| 74 | } |
| 75 | |
| 76 | Write-Host "`nInstalling root-level dependencies..." -ForegroundColor White |
| 77 | npm install |
| 78 | |
| 79 | Write-Host "`nBuilding packages (fetch, openai-adapters, config-yaml)..." -ForegroundColor White |
| 80 | node ./scripts/build-packages.js |
| 81 | |
| 82 | Write-Host "`nInstalling Core extension dependencies..." -ForegroundColor White |
| 83 | Push-Location core |
| 84 | npm install |
| 85 | npm link |
| 86 | Pop-Location |
| 87 | |
| 88 | Write-Output "`nInstalling GUI extension dependencies..." -ForegroundColor White |
| 89 | Push-Location gui |
| 90 | npm install |
| 91 | npm link @continuedev/core |
| 92 | npm run build |
| 93 | Pop-Location |
| 94 | |
| 95 | # VSCode Extension (will also package GUI) |
| 96 | Write-Output "`nInstalling VSCode extension dependencies..." -ForegroundColor White |
| 97 | Push-Location extensions/vscode |
| 98 | |
| 99 | # This does way too many things inline but is the common denominator between many of the scripts |
| 100 | npm install |
| 101 | npm link @continuedev/core |
| 102 | npm run prepackage |
| 103 | npm run package |
| 104 | |
| 105 | Pop-Location |
| 106 | |
| 107 | |
| 108 | Write-Output "`nInstalling binary dependencies..." -ForegroundColor White |
| 109 | Push-Location binary |
| 110 | |
| 111 | npm install |
| 112 | npm run build |
| 113 | |
| 114 | Pop-Location |
| 115 | |
| 116 | Write-Output "`nInstalling docs dependencies..." -ForegroundColor White |
| 117 | Push-Location docs |
| 118 | |
| 119 | npm install |
| 120 | |
| 121 | Pop-Location |