Created windows build script

This commit is contained in:
KRTirtho 2021-03-23 16:56:57 -07:00
parent 66e9e6ba8b
commit 8b4d36076e
5 changed files with 43 additions and 6 deletions

View File

@ -23,6 +23,19 @@ if(Test-Path "$ScriptDir\qode.exe"){
else{
throw "Wrong Option, use either 'y' or 'n', aborting..."
}
# removing all the shortcuts
$shortcut_paths = @(
"$HOME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Spotube.lnk",
"$HOME\Desktop\Spotube.lnk"
)
foreach($shortcut in $shortcut_paths){
if(Test-Path $shortcut){
echo "Deleting Shortcut: $shortcut"
Remove-Item -Path $shortcut
}
}
echo "Uninstall complete, just delete the Spotube folder now"
echo "Will miss you💕!"

View File

Before

Width:  |  Height:  |  Size: 107 KiB

After

Width:  |  Height:  |  Size: 107 KiB

View File

@ -8,8 +8,8 @@ $shortcut_paths = @(
"$HOME\Desktop\Spotube.lnk"
)
# for creating shortcuts
function CreateShortcut {
$Target = "$ScriptDir\qode.exe"
function CreateShortcut([String]$InstallLocation) {
$Target = "$InstallLocation\qode.exe"
$WshShell = New-Object -comObject WScript.Shell
echo "Creating shortcuts"
@ -17,8 +17,8 @@ function CreateShortcut {
echo $shortcut
$StartShortcut = $WshShell.CreateShortcut($shortcut)
$StartShortcut.TargetPath = $Target
$StartShortcut.WorkingDirectory = $ScriptDir
$StartShortcut.IconLocation = "$ScriptDir\dist\icon.ico"
$StartShortcut.WorkingDirectory = $InstallLocation
$StartShortcut.IconLocation = "$InstallLocation\icon.ico"
$StartShortcut.Save()
}
}
@ -44,7 +44,10 @@ function InstallSpotube {
$WannaCreateShortcut = Read-Host -Prompt "Do you want to create shortcuts?[y]Yes/[n]No"
$WannaCreateShortcut = $WannaCreateShortcut.Trim().ToLower()
if($WannaCreateShortcut -eq "y"){
CreateShortcut
if(!$Spotube_Location.Trim()){
$Spotube_Location= $Env:Programfiles
}
CreateShortcut -InstallLocation "$Spotube_Location\Spotube"
}
elseif($WannaCreateShortcut -eq "n"){
echo "Ok, skipping this part"

View File

@ -12,7 +12,8 @@
"start:trace": "qode ./dist/index.js --trace",
"debug": "qode --inspect ./dist/index.js",
"pack": "nodegui-packer -p ./dist",
"pack-deb": "node scripts/build-deb.js"
"pack-deb": "node scripts/build-deb.js",
"pack-win32": "powershell.exe -ExecutionPolicy Unrestricted -Command \". '.\\scripts\\build-win32.ps1'\""
},
"dependencies": {
"@nodegui/nodegui": "^0.27.0",

20
scripts/build-win32.ps1 Normal file
View File

@ -0,0 +1,20 @@
$CWD = Split-Path $script:MyInvocation.MyCommand.Path
$CWD = "$CWD\..\"
$Build_Dir = "$CWD\deploy\win32\build\spotube\"
$files = Get-ChildItem -Path $Build_Dir -Exclude @("make-install.ps1", "install.bat")
echo "Archiving the code...."
Compress-Archive -Path $files -DestinationPath "$Build_Dir\spotube.zip" -CompressionLevel Fastest -Force
Rename-Item "$Build_Dir\spotube.zip" "spotube.data"
$packageJson = Get-Content "$CWD\package.json" | Out-String | ConvertFrom-Json
$Version = $packageJson.version
echo "Now compressing the portable binary..."
Compress-Archive -Path @("$Build_Dir\spotube.data", "$Build_Dir\install.bat", "$Build_Dir\make-install.ps1") -DestinationPath "$Build_Dir\Spotube-winx64-v$Version.zip" -Force
echo "Removing temp build files..."
Remove-Item -Path "$Build_Dir\spotube.data"
echo "Done building"
echo "Zip located at $Build_Dir\Spotube-winx64-v$Version.zip"