-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
99 lines (84 loc) · 3.1 KB
/
install.ps1
File metadata and controls
99 lines (84 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# docDocs Extension Installer for Windows
# Installs the extension to all VS Code-based IDEs (Code, Cursor, Windsurf, Kiro)
# Run from PowerShell: ~\projects\docDocs\install.ps1
param(
[switch]$Rebuild
)
$ErrorActionPreference = "Continue"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$VsixFile = Join-Path $ScriptDir "docdocs-0.1.0.vsix"
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " docDocs Extension Installer" -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host ""
# Rebuild if requested or if vsix doesn't exist
if ($Rebuild -or !(Test-Path $VsixFile)) {
Write-Host "Building extension..." -ForegroundColor Yellow
Push-Location $ScriptDir
# Try bun first, fall back to npm
if (Get-Command bun -ErrorAction SilentlyContinue) {
bun install
bun run build
bunx @vscode/vsce package --no-dependencies --allow-missing-repository 2>$null
} elseif (Get-Command npm -ErrorAction SilentlyContinue) {
npm install
npm run build
npx @vscode/vsce package --no-dependencies --allow-missing-repository 2>$null
} else {
Write-Host "Error: Neither bun nor npm found. Please install one." -ForegroundColor Red
Pop-Location
exit 1
}
Pop-Location
Write-Host "Build complete!" -ForegroundColor Green
Write-Host ""
}
# Check if vsix exists
if (!(Test-Path $VsixFile)) {
Write-Host "Error: $VsixFile not found" -ForegroundColor Red
Write-Host "Run with -Rebuild to create it"
exit 1
}
# IDE CLI commands to try
$IDEs = @{
"VS Code" = "code"
"Cursor" = "cursor"
"Windsurf" = "windsurf"
"Kiro" = "kiro"
}
$InstalledCount = 0
foreach ($ide in $IDEs.GetEnumerator()) {
$ideName = $ide.Key
$cmd = $ide.Value
# Check if command exists
$cmdPath = Get-Command $cmd -ErrorAction SilentlyContinue
if ($cmdPath) {
Write-Host "Installing to $ideName... " -NoNewline
try {
& $cmd --install-extension $VsixFile --force 2>$null | Out-Null
Write-Host "Done" -ForegroundColor Green
$InstalledCount++
} catch {
Write-Host "Failed" -ForegroundColor Red
}
} else {
Write-Host "$ideName ($cmd) not found, skipping" -ForegroundColor Yellow
}
}
Write-Host ""
Write-Host "==========================================" -ForegroundColor Cyan
if ($InstalledCount -gt 0) {
Write-Host "Installed to $InstalledCount IDE(s)!" -ForegroundColor Green
Write-Host ""
Write-Host "Usage in your IDE:"
Write-Host " Ctrl+Shift+P -> 'docdocs: Generate Documentation'"
Write-Host ""
Write-Host "Or right-click any file/folder in the explorer."
} else {
Write-Host "No IDEs found to install to." -ForegroundColor Red
Write-Host "Make sure your IDE CLI is in PATH."
Write-Host ""
Write-Host "To add to PATH, search 'Environment Variables' in Windows"
Write-Host "and add your IDE's bin folder to the Path variable."
}
Write-Host "==========================================" -ForegroundColor Cyan