-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_binary_windows.ps1
executable file
·60 lines (50 loc) · 1.58 KB
/
build_binary_windows.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env pwsh
$ErrorActionPreference = "Stop"
# Install the following things first:
# - Node.js
# - NSIS
Write-Host "---------------------------------------------------------"
Write-Host "Build Binary [Windows]: <Powershell>"
Write-Host "---------------------------------------------------------"
# Display node/npm/makensis version
Write-Host "node:"
node --version
Write-Host "npm:"
npm --version
Write-Host "makensis:"
$makensisWasFound = [bool] (Get-Command -ErrorAction Ignore -Type Application makensis)
if ($makensisWasFound) {
makensis -VERSION
Write-Host ""
} else {
Write-Host "WARNING: makensis was not found, Windows installer will not be created"
}
# Get the current directory
$CallDir = $pwd
# Go to the location of this directory even if the script is being run from
# somewhere else
Set-Location $PSScriptRoot
# Go to the root directory of this repository
Set-Location ..
# Remove previous output files
#Remove-Item "node_modules" -Recurse -ErrorAction Ignore
Remove-Item "bin" -Recurse -ErrorAction Ignore
# Install all dependencies and build the bot
npm install
npm run build
npm run package:windows
npm run package:windows:postfix
# Create the windows installer
if ($makensisWasFound) {
npm run create:windowsInstallerConfig
Set-Location installer
Set-Location windows_installer
makensis windows_installer.nsi
Set-Location ..
Set-Location ..
}
# Go back to the call directory
Set-Location $CallDir
# Wait for any input before closing the window
Write-Host "`n>> The script has finished. Press any key to close the window."
[Console]::ReadKey()