diff --git a/deploy/win32/spotube/clear-installation.ps1 b/deploy/win32/spotube/clear-installation.ps1 index c1164a64..e7265cea 100644 --- a/deploy/win32/spotube/clear-installation.ps1 +++ b/deploy/win32/spotube/clear-installation.ps1 @@ -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💕!" diff --git a/assets/icon.ico b/deploy/win32/spotube/icon.ico similarity index 100% rename from assets/icon.ico rename to deploy/win32/spotube/icon.ico diff --git a/deploy/win32/spotube/make-install.ps1 b/deploy/win32/spotube/make-install.ps1 index 87f86c6b..7b94ef18 100644 --- a/deploy/win32/spotube/make-install.ps1 +++ b/deploy/win32/spotube/make-install.ps1 @@ -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" diff --git a/package.json b/package.json index b66946f1..bca1f09c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/build-win32.ps1 b/scripts/build-win32.ps1 new file mode 100644 index 00000000..ac016529 --- /dev/null +++ b/scripts/build-win32.ps1 @@ -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" \ No newline at end of file