forked from lemonade-sdk/lemonade
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ps1
More file actions
165 lines (133 loc) · 4.35 KB
/
setup.ps1
File metadata and controls
165 lines (133 loc) · 4.35 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/usr/bin/env pwsh
# Lemonade development environment setup script for Windows
# This script prepares the development environment for building Lemonade
param()
$ErrorActionPreference = "Stop"
# Colors for output
$Info = "Blue"
$Success = "Green"
$Warning = "Yellow"
$Error = "Red"
# Helper functions
function Write-Info {
param([string]$Message)
Write-Host "[INFO] $Message" -ForegroundColor $Info
}
function Write-Success {
param([string]$Message)
Write-Host "[SUCCESS] $Message" -ForegroundColor $Success
}
function Write-Warning {
param([string]$Message)
Write-Host "[WARNING] $Message" -ForegroundColor $Warning
}
function Write-Error-Custom {
param([string]$Message)
Write-Host "[ERROR] $Message" -ForegroundColor $Error
}
# Check if command exists
function Command-Exists {
param([string]$Command)
try {
if (Get-Command $Command -ErrorAction Stop) {
return $true
}
} catch {
return $false
}
}
Write-Info "Lemonade Development Setup"
Write-Info "Operating System: Windows"
Write-Host ""
# Check and install pre-commit
Write-Info "Checking pre-commit installation..."
if (-not (Command-Exists "pre-commit")) {
Write-Warning "pre-commit not found, installing..."
if (Command-Exists "pip") {
pip install pre-commit
} elseif (Command-Exists "pip3") {
pip3 install pre-commit
} elseif (Command-Exists "py") {
Write-Warning "Pip or Pip3 not found. Installing using py."
py -m pip install pre-commit
Write-Warning "If you encounter issues, please ensure the Python Scripts directory is in your PATH."
} else {
Write-Error-Custom "Neither pip nor pip3 found. Please install Python 3 first."
exit 1
}
Write-Success "pre-commit installed"
} else {
Write-Success "pre-commit is already installed"
}
# Install pre-commit hooks
if (Test-Path ".pre-commit-config.yaml") {
Write-Info "Installing pre-commit hooks..."
pre-commit install
Write-Success "pre-commit hooks installed"
} else {
Write-Warning "No .pre-commit-config.yaml found, skipping hook installation"
}
Write-Host ""
# Step 3: Check and install Node.js and npm
Write-Info "Step 3: Checking Node.js and npm installation..."
if (-not (Command-Exists "node")) {
Write-Error-Custom "Node.js not found"
Write-Info "Please install Node.js from https://nodejs.org/"
Write-Info "You can also use Chocolatey if installed: choco install nodejs"
exit 1
} else {
Write-Success "Node.js is installed"
}
if (-not (Command-Exists "npm")) {
Write-Error-Custom "npm is not available"
Write-Info "Please reinstall Node.js or ensure npm is in your PATH"
exit 1
} else {
Write-Success "npm is installed"
}
Write-Host ""
# Check and install Node.js and npm
Write-Info "Checking Node.js and npm installation..."
if (-not (Command-Exists "node")) {
Write-Error-Custom "Node.js not found"
Write-Info "Please install Node.js from https://nodejs.org/"
Write-Info "You can also use Chocolatey if installed: choco install nodejs"
exit 1
} else {
Write-Success "Node.js is installed"
}
if (-not (Command-Exists "npm")) {
Write-Error-Custom "npm is not available"
Write-Info "Please reinstall Node.js or ensure npm is in your PATH"
exit 1
} else {
Write-Success "npm is installed"
}
Write-Host ""
# Clean and create build directory
Write-Info "Preparing build directory..."
if (Test-Path "build") {
Write-Warning "Removing existing build directory..."
Remove-Item -Recurse -Force "build"
}
New-Item -ItemType Directory -Path "build" -Force | Out-Null
Write-Success "Build directory created"
Write-Host ""
# Configure with CMake presets
Write-Info "Configuring CMake with presets..."
cmake --preset windows
if ($LASTEXITCODE -ne 0) {
Write-Error-Custom "CMake configuration failed"
exit 1
}
Write-Success "CMake configured successfully"
Write-Host ""
Write-Host "==========================================" -ForegroundColor Green
Write-Success "Setup completed successfully!"
Write-Host "==========================================" -ForegroundColor Green
Write-Host ""
Write-Info "Next steps:"
Write-Host " Build the project: cmake --build --preset windows"
Write-Host " Build the electron app: cmake --build --preset windows --target electron-app"
Write-Host ""
Write-Info "For more information, see the README.md file"