Skip to content

Commit

Permalink
build: add windows build script
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Aug 14, 2023
1 parent a192c76 commit 9b28a35
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/client/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
$current_location = Get-Location
$project_root = git rev-parse --show-toplevel
Set-Location $project_root/src/client

foreach ($opt in $args) {
switch ($opt) {
"--silent" { $silent = $true }
default {
Write-Host "Invalid option: $opt"
exit
}
}
}

if ($silent) { $log_level = "--log-level=warning" }

if (!$silent) { Write-Host "Transpile and bundle TS sources to webui.js" }
esbuild --bundle --target="chrome90,firefox90,safari15" --format=esm --tree-shaking=false --outdir=. ./webui.ts $log_level

if (!$silent) { Write-Host "Convert JS source to C-String using xxd" }
Set-Location ..
# The path needs to match the path in webui.c, that's why we move up to src/
xxd -i client/webui.js client/webui.h

if (!$silent) { Write-Host "Finished." }
Set-Location $current_location

0 comments on commit 9b28a35

Please sign in to comment.