From 51a26701f7417a85813a9a722a30fdb9f926d475 Mon Sep 17 00:00:00 2001 From: stan44 Date: Fri, 27 Feb 2026 21:06:20 -0600 Subject: [PATCH] Added script: publish-output.ps1 desc: it builds and outputs everything to output. can and will be used as part of the devtool set. --- .gitignore | 1 + devtool.json | 17 ++++++ scripts/publish-output.ps1 | 103 +++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+) create mode 100644 scripts/publish-output.ps1 diff --git a/.gitignore b/.gitignore index 768a914..f9e8871 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ logs/ .just/ journalapp.exe Journal.App/node_modules.old/@rollup/.rollup-win32-x64-msvc-IjiZshxL/rollup.win32-x64-msvc.node +journalapp(1).exe diff --git a/devtool.json b/devtool.json index 62106d6..ff9e98b 100644 --- a/devtool.json +++ b/devtool.json @@ -262,6 +262,23 @@ "workingDir": ".", "dependsOn": [] } + , + { + "id": "stage-output", + "label": "Stage Output Bundle", + "description": "Publish sidecar + web + webgateway + tauri, then stage journalapp.exe into output/", + "group": "Build", + "command": "pwsh", + "args": [ + "-NoProfile", + "-ExecutionPolicy", + "Bypass", + "-File", + "scripts/publish-output.ps1" + ], + "workingDir": ".", + "dependsOn": [] + } ], "env": [ { diff --git a/scripts/publish-output.ps1 b/scripts/publish-output.ps1 new file mode 100644 index 0000000..29663f6 --- /dev/null +++ b/scripts/publish-output.ps1 @@ -0,0 +1,103 @@ +param( + [ValidateSet("Release", "Debug")] + [string]$Configuration = "Release", + [string]$Runtime = "win-x64", + [switch]$SkipSidecar, + [switch]$SkipWeb, + [switch]$SkipWebGateway, + [switch]$SkipTauri, + [switch]$DryRun +) + +$commonScript = Join-Path $PSScriptRoot "script-common.ps1" +if (-not (Test-Path $commonScript)) { + throw "Missing helper script: $commonScript" +} +. $commonScript + +$repoRoot = Resolve-JournalRepoRoot -StartPath $PSScriptRoot +$appRoot = Resolve-JournalAppRoot -RepoRoot $repoRoot +$outputRoot = Join-Path $repoRoot "output" + +$publishSidecar = Join-Path $PSScriptRoot "publish-sidecar.ps1" +$publishApp = Join-Path $PSScriptRoot "publish-app.ps1" +$publishGateway = Join-Path $PSScriptRoot "publish-webgateway.ps1" + +Write-Host "Publishing all outputs to: $outputRoot" -ForegroundColor Cyan +Write-Host "Configuration: $Configuration Runtime: $Runtime" -ForegroundColor DarkGray + +if (-not (Test-Path $outputRoot)) { + New-Item -ItemType Directory -Force -Path $outputRoot | Out-Null +} + +function Invoke-Step { + param( + [string]$Label, + [string]$ScriptPath, + [string[]]$Args + ) + + Write-Host "`n> $Label" -ForegroundColor Cyan + Write-Host " $ScriptPath $($Args -join ' ')" -ForegroundColor DarkGray + if (-not $DryRun) { + & $ScriptPath @Args + } +} + +if (-not $SkipSidecar) { + Invoke-Step "Publish Sidecar" $publishSidecar @( + "-Configuration", $Configuration, + "-Runtime", $Runtime + ) +} +else { + Write-Host "Skipping sidecar publish." -ForegroundColor DarkGray +} + +if (-not $SkipWeb) { + Invoke-Step "Build Web UI" $publishApp @( + "-Target", "web", + "-Configuration", $Configuration + ) +} +else { + Write-Host "Skipping web build." -ForegroundColor DarkGray +} + +if (-not $SkipWebGateway) { + Invoke-Step "Publish WebGateway" $publishGateway @( + "-Configuration", $Configuration, + "-Runtime", $Runtime + ) +} +else { + Write-Host "Skipping WebGateway publish." -ForegroundColor DarkGray +} + +if (-not $SkipTauri) { + Invoke-Step "Build Tauri Desktop App" $publishApp @( + "-Target", "tauri", + "-Configuration", $Configuration, + "-TauriBundles", "none" + ) + + $targetConfigDir = if ($Configuration -eq "Debug") { "debug" } else { "release" } + $tauriExePath = Join-Path $appRoot "src-tauri\\target\\$targetConfigDir\\journalapp.exe" + $stagedExePath = Join-Path $outputRoot "journalapp.exe" + + if (Test-Path $tauriExePath) { + if ($DryRun) { + Write-Host "Would copy: $tauriExePath -> $stagedExePath" -ForegroundColor Yellow + } + else { + Copy-Item -Force $tauriExePath $stagedExePath + Write-Host "Staged desktop exe: $stagedExePath" -ForegroundColor Green + } + } + else { + Write-Warning "Tauri exe not found at $tauriExePath" + } +} +else { + Write-Host "Skipping Tauri build." -ForegroundColor DarkGray +}