-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathbuild.bat
More file actions
55 lines (49 loc) · 2.71 KB
/
Copy pathbuild.bat
File metadata and controls
55 lines (49 loc) · 2.71 KB
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
@echo off
setlocal EnableExtensions
if "%~1"=="" (
echo Usage: %~nx0 version
echo Example: %~nx0 123
exit /b 1
)
set "VERSION=V2_4_%~1"
echo Creating Firefox package...
copy /Y "manifest.json.ff" "manifest.json" >nul
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"$zip = 'LiChessTools_%VERSION%_FF.zip';" ^
"$files = Get-ChildItem -Recurse -File | Where-Object { $_.Name -ne 'context.md' -and $_.Name -ne 'manifest.json.chrome' -and $_.Name -ne 'manifest.json.edge' -and $_.Name -ne 'manifest.json.ff' -and $_.Extension -ne '.zip' };" ^
"if (Test-Path $zip) { Remove-Item $zip -Force };" ^
"Add-Type -AssemblyName System.IO.Compression.FileSystem;" ^
"$archive = [System.IO.Compression.ZipFile]::Open($zip, 'Create');" ^
"foreach ($f in $files) {" ^
" $rel = $f.FullName.Substring((Get-Location).Path.Length + 1).Replace('\', '/');" ^
" [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($archive, $f.FullName, $rel) | Out-Null" ^
"};" ^
"$archive.Dispose()"
echo Creating Edge package...
copy /Y "manifest.json.edge" "manifest.json" >nul
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"$zip = 'LiChessTools_%VERSION%_ED.zip';" ^
"$files = Get-ChildItem -Recurse -File | Where-Object { $_.Name -ne 'context.md' -and $_.Name -ne 'manifest.json.chrome' -and $_.Name -ne 'manifest.json.edge' -and $_.Name -ne 'manifest.json.ff' -and $_.Extension -ne '.zip' };" ^
"if (Test-Path $zip) { Remove-Item $zip -Force };" ^
"Add-Type -AssemblyName System.IO.Compression.FileSystem;" ^
"$archive = [System.IO.Compression.ZipFile]::Open($zip, 'Create');" ^
"foreach ($f in $files) {" ^
" $rel = $f.FullName.Substring((Get-Location).Path.Length + 1).Replace('\', '/');" ^
" [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($archive, $f.FullName, $rel) | Out-Null" ^
"};" ^
"$archive.Dispose()"
echo Creating Chrome package...
copy /Y "manifest.json.chrome" "manifest.json" >nul
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
"$zip = 'LiChessTools_%VERSION%.zip';" ^
"$files = Get-ChildItem -Recurse -File | Where-Object { $_.Name -ne 'context.md' -and $_.Name -ne 'manifest.json.chrome' -and $_.Name -ne 'manifest.json.edge' -and $_.Name -ne 'manifest.json.ff' -and $_.Extension -ne '.zip' };" ^
"if (Test-Path $zip) { Remove-Item $zip -Force };" ^
"Add-Type -AssemblyName System.IO.Compression.FileSystem;" ^
"$archive = [System.IO.Compression.ZipFile]::Open($zip, 'Create');" ^
"foreach ($f in $files) {" ^
" $rel = $f.FullName.Substring((Get-Location).Path.Length + 1).Replace('\', '/');" ^
" [System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($archive, $f.FullName, $rel) | Out-Null" ^
"};" ^
"$archive.Dispose()"
echo Done.
endlocal