mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-07 19:24:56 -04:00

# Conflicts: # package.json Former-commit-id: b3a7890036c123d562fce9c87aec02680ba9e434 [formerly eaad05ab22da2a0beba878e6cd356afbaee2dba3] [formerly a0f857a4f1a74dc16878673580af051a67547d70] [formerly ca0b8e69ef66aa56a10c332b62961ac91ca9aa08 [formerly 3c1f57edadf77e5cc15524545a240894a161cac8 [formerly 6bbfcb4aa7f2b4ca7beb986204d5acbc31df29e4]]] Former-commit-id: d627e37b0d787b68e9262e892e2799385d7445cd [formerly 52084c8ebddfaaf96f4e6731c4292152752f7045 [formerly 2305904b652f986971c7db18756ac85804e2fd98]] Former-commit-id: 3b72681a92bab35e77526b5ac928390aa4813b28 [formerly 6a68f50c62273f31bb3772a652ff8ccdc3d193d6] Former-commit-id: f8baea5d87898ae7c66a7cbf5ad048cb5bb016f1
72 lines
2.9 KiB
PowerShell
72 lines
2.9 KiB
PowerShell
$builds = @("win-x64", "win-ia32", "win-xp")
|
|
$version = "0.51.2"
|
|
$versionXP = "0.14.7"
|
|
$appBuild = "1.2.3N"
|
|
$ZIMbase = "wikipedia_en_100_maxi"
|
|
cd $PSScriptRoot
|
|
cd ..
|
|
foreach ($build in $builds) {
|
|
"Building $build $version..."
|
|
$OBuild = $build
|
|
$sep = '-'
|
|
if ($build -eq "win-xp") {
|
|
$build = "win-ia32"
|
|
$version = $versionXP
|
|
$sep = '-XP-'
|
|
}
|
|
$folderTarget = "bld\nwjs\$build-$version"
|
|
$target = "$folderTarget\kiwix_js_windows$sep$appBuild"
|
|
$fullTarget = "$target-$build"
|
|
$ZipLocation = "node_modules\nwjs-builder-phoenix\caches\nwjs-v$version-$build.zip"
|
|
$UnzipLocation = "$ZipLocation-extracted\"
|
|
$buildLocation = "$ZipLocation-extracted\nwjs-v$version-$build\"
|
|
if (-Not (Test-Path $buildLocation -PathType Container)) {
|
|
# We need to download and/or unzip the release, as it is not available
|
|
if (-Not (Test-Path $ZipLocation -PathType Leaf)) {
|
|
$serverFile = "https://dl.nwjs.io/v$version/nwjs-v$version-$build.zip"
|
|
"Downloading $serverFile"
|
|
Invoke-WebRequest -Uri $serverFile -OutFile $ZipLocation
|
|
}
|
|
"Unzipping archive $ZipLocation"
|
|
Expand-Archive $ZipLocation $UnzipLocation
|
|
if (-Not (Test-Path $buildLocation -PathType Container)) {
|
|
"There was an error! The unzipped folder $buildLocation could not be found!"
|
|
return
|
|
}
|
|
}
|
|
$archiveFolder = "$fullTarget\archives"
|
|
if (Test-Path $folderTarget -PathType Container) {
|
|
"Removing directory $folderTarget..."
|
|
rm $folderTarget\* -Recurse
|
|
rm $folderTarget
|
|
}
|
|
md $fullTarget
|
|
# Copy latest binary x64
|
|
cp $buildLocation\* $fullTarget -Recurse
|
|
cp .\package.json, .\pwabuilder-sw.js, .\index.html, .\CHANGELOG.md, .\LICENSE, .\www $fullTarget -Recurse
|
|
"Copying archive..."
|
|
md $archiveFolder
|
|
cp "archives\$ZIMbase*.*", "archives\README.md" $archiveFolder
|
|
"Creating launchers..."
|
|
$launcherStub = ".\bld\nwjs\$build-$version\Start Kiwix JS Windows"
|
|
$foldername = "kiwix_js_windows$sep$appBuild-$build"
|
|
# Batch file
|
|
$batch = '@cd "' + $foldername + '"' + "`r`n" + '@start "Kiwix JS Windows" "nw.exe"' + "`r`n'"
|
|
$batch > "$launcherStub.bat"
|
|
# Shortcut
|
|
$WshShell = New-Object -ComObject WScript.Shell
|
|
$Shortcut = $WshShell.CreateShortcut("$launcherStub.lnk")
|
|
$Shortcut.TargetPath = '%windir%\explorer.exe'
|
|
$Shortcut.Arguments = "$foldername\nw.exe"
|
|
$Shortcut.IconLocation = '%windir%\explorer.exe,12'
|
|
$Shortcut.Save()
|
|
# Zip everything up
|
|
$ZipBuild = "bld\nwjs\$foldername.zip"
|
|
if (Test-Path $ZipBuild -PathType Leaf) {
|
|
"Deleting old Zip build $ZipBuild..."
|
|
del $ZipBuild
|
|
}
|
|
"Compressing folder..."
|
|
Compress-Archive "bld\nwjs\$build-$version\*" "bld\nwjs\$foldername.zip" -Force
|
|
"Build $OBuild finished.`n"
|
|
} |