Elffuss BraidHub

kikocis/continue public

0806570fe48c · 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 config-yaml..." -ForegroundColor White
80Push-Location packages/config-yaml
81npm install
82npm run build
83Pop-Location
84
85Write-Host "`nInstalling Core extension dependencies..." -ForegroundColor White
86Push-Location core
87npm install
88npm link
89Pop-Location
90
91Write-Output "`nInstalling GUI extension dependencies..." -ForegroundColor White
92Push-Location gui
93npm install
94npm link @continuedev/core
95npm run build
96Pop-Location
97
98# VSCode Extension (will also package GUI)
99Write-Output "`nInstalling VSCode extension dependencies..." -ForegroundColor White
100Push-Location extensions/vscode
101
102# This does way too many things inline but is the common denominator between many of the scripts
103npm install
104npm link @continuedev/core
105npm run prepackage
106npm run package
107
108Pop-Location
109
110
111Write-Output "`nInstalling binary dependencies..." -ForegroundColor White
112Push-Location binary
113
114npm install
115npm run build
116
117Pop-Location
118
119Write-Output "`nInstalling docs dependencies..." -ForegroundColor White
120Push-Location docs
121
122npm install
123
124Pop-Location