Smail/deploy/build.ps1
smail 4ea3a39e41
Some checks are pending
Security Checks / security (push) Waiting to run
拆分插件三级配置菜单并统一三插件构建打包
2026-09-06 16:22:38 +08:00

26 lines
1.1 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

param([switch]$SkipFrontend)
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$output = Join-Path $root 'out\backend'
New-Item -ItemType Directory -Path $output -Force | Out-Null
if (-not $SkipFrontend) {
Push-Location (Join-Path $root 'frontend')
try {
& npm.cmd run build
if ($LASTEXITCODE -ne 0) { throw '前端构建失败' }
} finally { Pop-Location }
}
Push-Location (Join-Path $root 'backend')
try {
& go build -o (Join-Path $output 'smail-dev.exe') .
if ($LASTEXITCODE -ne 0) { throw '开发后端构建失败' }
& go build -o (Join-Path $output 'smail-admin.exe') ./cmd/smail-admin
if ($LASTEXITCODE -ne 0) { throw '管理工具构建失败' }
& go build -o (Join-Path $output 'smail-config.exe') ./cmd/smail-config
if ($LASTEXITCODE -ne 0) { throw '配置工具构建失败' }
} finally { Pop-Location }
& node (Join-Path $PSScriptRoot 'build-plugins.mjs') --dev
if ($LASTEXITCODE -ne 0) { throw '插件构建失败' }
Write-Output '构建完成:out/frontend、out/backend 和 out/plugins,包含三个内置插件。正式发行请使用 Makefile 的跨平台构建目标。'