-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_with_pake_cli.ps1
84 lines (72 loc) · 2.34 KB
/
build_with_pake_cli.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Write-Host "Welcome to use Powershell"
Write-Host "`n======================="
Write-Host "build for windows"
Write-Host "make ture powershell == 7.2.10"
Write-Host "powershell 7.2.10 download url: https://github.com/PowerShell/PowerShell/releases/tag/v7.2.10"
Write-Host "Powershell info in your localhost "
$PSVersionTable
Write-Host "`n=======================`n"
Write-Host "`n======================="
Write-Host "pake parameters is: "
Write-Host "url: " $env:URL
Write-Host "name: " $env:NAME
Write-Host "icon: " $env:ICON
Write-Host "height: " $env:HEIGHT
Write-Host "width: " $env:WIDTH
Write-Host "transparent: " $env:TRANSPARENT
# Write-Host "fullscreen: " $env:FULLSCREEN
Write-Host "resize: " $env:RESIZE
Write-Host "is multi arch? only for Mac: " $env:MULTI_ARCH
Write-Host "targets type? only for Linux: " $env:TARGETS
Write-Host "===========================`n"
Set-Location node_modules/pake-cli
# init params
${Params}="node cli.js $env:URL --name $env:NAME"
# download icon
if ((($null -ne $env:ICON) -and ($env:ICON -ne ""))){
if ($IsLinux) {
curl -L "$env:ICON" -o icon.png
${Params}="${Params} --icon icon.png"
} elseif ($IsMacOS) {
curl -L "$env:ICON" -o icon.icns
${Params}="${Params} --icon icon.icns"
} elseif ($IsWindows) {
curl -L "$env:ICON" -o icon.ico
${Params}="${Params} --icon icon.ico"
} else {
Write-Host "it won't download icon, becase it can't detect you OS system!"
}
}
# height && weight
${Params}="${Params} --height $env:HEIGHT --width $env:WIDTH"
# transparent
if ("$env:TRANSPARENT" -eq "true") {
${Params}="${Params} --transparent"
}
# fullscreen
# if ("$env:FULLSCREEN" -eq "true") {
# ${Params}="${Params} --fullscreen"
# }
# resize
if ("$env:FULLSCREEN" -eq "true" ) {
${Params}="${Params} --resize"
}
# multi-arch only for mac
if (($env:MULTI_ARCH -eq "true") -and ($IsMacOS)) {
rustup target add aarch64-apple-darwin
${Params}="${Params} --multi-arch"
}
# targets type, only for linux
if (($null -ne $env:TARGETS) -and ($env:TARGETS -ne "") -and ($IsLinux)) {
${Params}="${Params} --targets $env:TARGETS"
}
Write-Host "Pake parameters is: ${Params}"
Write-Host "compile...."
Invoke-Expression $Params
# output
if (-not(Test-Path output)) {
New-Item -ItemType Directory -Path "output"
}
Move-Item -Path "$env:NAME.*" -Destination "output/"
Write-Host "Build Success"
Set-Location ../..