diff --git a/src/client/build.ps1 b/src/client/build.ps1 new file mode 100644 index 000000000..7f11e6229 --- /dev/null +++ b/src/client/build.ps1 @@ -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