Skip to content

Commit ce70ade

Browse files
author
Curtis Gray
committed
Added admin ux to deployment
1 parent 3070e65 commit ce70ade

File tree

4 files changed

+112
-3
lines changed

4 files changed

+112
-3
lines changed

admin/build-ux-ci.ps1

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
param(
2+
[Parameter(Mandatory = $true)]
3+
[ValidateSet("windows", "windows-cublas", "linux", "linux-cublas", "macos", "macos-metal")]
4+
[string]$BuildPlatform,
5+
6+
[Parameter(Mandatory = $false)]
7+
[switch]$Force,
8+
9+
[Parameter(Mandatory = $false)]
10+
[switch]$SkipDeployment,
11+
12+
[Parameter(Mandatory = $false)]
13+
[switch]$SkipNpmInstall
14+
)
15+
16+
try {
17+
# Clean up the previous build artifacts
18+
19+
if ($Force) {
20+
Write-Host "Cleaning previous build artifacts..."
21+
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue node_modules
22+
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue dist
23+
}
24+
25+
# Determine architecture based on platform
26+
$platform = ""
27+
switch ($BuildPlatform) {
28+
"windows" {
29+
$platform = "win32"
30+
}
31+
"windows-cublas" {
32+
$platform = "win32"
33+
}
34+
"linux" {
35+
$platform = "linux"
36+
}
37+
"linux-cublas" {
38+
$platform = "linux"
39+
}
40+
"macos" {
41+
} # For universal macOS build
42+
"macos-metal" {
43+
} # For universal macOS build
44+
default {
45+
throw "Unsupported platform: $BuildPlatform"
46+
}
47+
}
48+
49+
if (-not $SkipNpmInstall) {
50+
51+
# Install dependencies
52+
Write-Host "Installing Node dependencies..."
53+
# skip dev dependencies on linux platform
54+
if ($platform -eq "linux") {
55+
npm ci --cache .npm --prefer-offline --production
56+
}
57+
else {
58+
npm ci --cache .npm --prefer-offline
59+
}
60+
61+
if ($LASTEXITCODE -ne 0) {
62+
throw "npm install failed"
63+
}
64+
# # Conditional appdmg installation for macOS builds
65+
# # if ($BuildPlatform -eq "macos" -or $BuildPlatform -eq "macos-metal") {
66+
# if ($BuildPlatform -eq "macos-metal") {
67+
# Write-Host "Installing appdmg for macOS..."
68+
# npm install appdmg --save-dev
69+
# if ($LASTEXITCODE -ne 0) {
70+
# throw "npm install appdmg failed"
71+
# }
72+
# }
73+
}
74+
# Build the project
75+
Write-Host "Building the project..."
76+
npm run build
77+
if ($LASTEXITCODE -ne 0) {
78+
throw "npm run build failed"
79+
}
80+
81+
if ($SkipDeployment) {
82+
Write-Warning "Skipping deployment..."
83+
}
84+
else {
85+
# Copy the dist folder to wingman.cpp if the ../services/wingman.cpp/wingman folder exists
86+
$distRoot = "../services/wingman.cpp/wingman"
87+
if (Test-Path $distRoot) {
88+
Write-Host "Copying dist folder to wingman.cpp..."
89+
Copy-Item -Recurse -Force -ErrorAction SilentlyContinue ./dist ../services/wingman.cpp/wingman/distadmin
90+
}
91+
else {
92+
Write-Warning "wingman.cpp folder not found. Skipping copy of dist folder..."
93+
}
94+
}
95+
96+
Write-Host "UX $command completed successfully."
97+
}
98+
catch {
99+
Write-Error "An error occurred during the UX build process: $_"
100+
exit 1
101+
}

build.ps1

+9
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ try {
2424
}
2525
Pop-Location
2626

27+
# Build Wingman Admin UX
28+
Write-Host "Building Wingman Admin UX"
29+
Push-Location -Path "./admin"
30+
./build-ux-ci.ps1 -BuildPlatform $BuildPlatform -Force:$Force -SkipDeployment:$SkipDeployment
31+
if ($LASTEXITCODE -ne 0) {
32+
throw "Building Wingman Admin UX failed with exit code $LASTEXITCODE"
33+
}
34+
Pop-Location
35+
2736
# Build Wingman.cpp
2837
Write-Host "Building Wingman.cpp"
2938
Push-Location -Path "./services/wingman.cpp"

ux/build-ux-ci.ps1

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ try {
1919
if ($Force) {
2020
Write-Host "Cleaning previous build artifacts..."
2121
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue node_modules
22-
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue out
23-
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue .next
22+
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue dist
2423
}
2524

2625
# Determine architecture based on platform

0 commit comments

Comments
 (0)