Elffuss BraidHub

kikocis/continue public

main · 4.0 KiBRawPermalink
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
7Write-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)
19if ($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
29if (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
61if ($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
72if (($null -eq $node)) {
73 return "`nSome dependencies that may require installation could not be found. Exiting"
74}
75
76Write-Host "`nInstalling root-level dependencies..." -ForegroundColor White
77npm install
78
79Write-Host "`nBuilding packages (fetch, openai-adapters, config-yaml)..." -ForegroundColor White
80node ./scripts/build-packages.js
81
82Write-Host "`nInstalling Core extension dependencies..." -ForegroundColor White
83Push-Location core
84npm install
85npm link
86Pop-Location
87
88Write-Output "`nInstalling GUI extension dependencies..." -ForegroundColor White
89Push-Location gui
90npm install
91npm link @continuedev/core
92npm run build
93Pop-Location
94
95# VSCode Extension (will also package GUI)
96Write-Output "`nInstalling VSCode extension dependencies..." -ForegroundColor White
97Push-Location extensions/vscode
98
99# This does way too many things inline but is the common denominator between many of the scripts
100npm install
101npm link @continuedev/core
102npm run prepackage
103npm run package
104
105Pop-Location
106
107
108Write-Output "`nInstalling binary dependencies..." -ForegroundColor White
109Push-Location binary
110
111npm install
112npm run build
113
114Pop-Location
115
116Write-Output "`nInstalling docs dependencies..." -ForegroundColor White
117Push-Location docs
118
119npm install
120
121Pop-Location