blessing-skin-server/scripts/build.ps1
2020-03-04 19:37:17 +08:00

32 lines
870 B
PowerShell

param (
# Clean files and run webpack only.
[Parameter()]
[switch]
$Simple
)
# Clean files
if (Test-Path ./public/app) {
Remove-Item ./public/app -Recurse -Force
}
# Run webpack
yarn build
if ($Simple) {
exit
}
# Copy static files
Copy-Item -Path ./resources/assets/src/images/bg.png -Destination ./public/app
Copy-Item -Path ./resources/assets/src/images/favicon.ico -Destination ./public/app
Copy-Item -Path ./resources/misc/backgrounds/ ./public/bg -Recurse
Write-Host 'Static files copied.' -ForegroundColor Green
# Write commit ID
$commit = git log --pretty=%H -1
$manifest = Get-Content ./public/app/manifest.json | ConvertFrom-Json
$manifest | Add-Member -MemberType NoteProperty -Name commit -Value $commit.Trim()
ConvertTo-Json $manifest | Set-Content ./public/app/manifest.json
Write-Host 'Saved commit ID.' -ForegroundColor Green