blessing-skin-server/scripts/build.ps1

31 lines
803 B
PowerShell
Raw Normal View History

2019-11-25 18:39:18 +08:00
param (
# Clean files and run webpack only.
[Parameter()]
[switch]
$Simple
)
2019-11-24 15:57:46 +08:00
# Clean files
if (Test-Path ./public/app) {
Remove-Item ./public/app -Recurse -Force
}
# Run webpack
yarn build
2019-11-25 18:39:18 +08:00
if ($Simple) {
exit
}
2019-11-24 15:57:46 +08:00
# Copy static files
Copy-Item -Path ./resources/assets/src/images/bg.jpg -Destination ./public/app
Copy-Item -Path ./resources/assets/src/images/favicon.ico -Destination ./public/app
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