-
Notifications
You must be signed in to change notification settings - Fork 37
/
packager-win.ps1
121 lines (107 loc) · 3.21 KB
/
packager-win.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
$chooseExampleType=$args[0]
$outterZipName="electronDemo.zip"
function ChooseArch($type)
{
if($type -eq 1){
write-host("ChooseArch x32")
Copy-Item -Path ../.npmrc_x32 -Destination ./.npmrc -Force
} elseif($type -eq 2){
write-host("ChooseArch x64")
Copy-Item -Path ../.npmrc_x64 -Destination ./.npmrc -Force
}else {
write-host("not set arch type")
}
}
function distByArch($type)
{
if($type -eq 1){
write-host("distByArch x32")
yarn dist:win32
} elseif($type -eq 2){
write-host("distByArch x64")
yarn dist:win64
}else {
write-host("not set arch type")
}
}
switch -Regex ($chooseExampleType)
{
1 {
pushd Agora-Electron-API-Example
# choose arch
ChooseArch -type $args[1]
# remove node_modules
Remove-Item -Path node_modules -Recurse -Force -ErrorAction Ignore;
# remove node_modules
Remove-Item -Path src/node_modules -Recurse -Force -ErrorAction Ignore;
# remove dist
Remove-Item -Path release -Recurse -Force -ErrorAction Ignore;
yarn
# copy native sdk
Copy-Item -Path ../Electron-*/* -Destination src/node_modules/agora-electron-sdk/ -Recurse -Force
# dist start
DistByArch -type $args[1]
# move zip
Copy-Item -Path release/ElectronReact-*.zip -Destination ../$outterZipName -Recurse -Force
popd;
Break
}
2 {
pushd Agora-Electron-API-Example-Iris
# choose arch
ChooseArch -type $args[1]
# remove node_modules
Remove-Item -Path node_modules -Recurse -Force -ErrorAction Ignore;
# remove node_modules
Remove-Item -Path src/node_modules -Recurse -Force -ErrorAction Ignore;
# remove dist
Remove-Item -Path release -Recurse -Force -ErrorAction Ignore;
yarn
# copy native sdk
Copy-Item -Path ../Electron-*/* -Destination src/node_modules/agora-electron-sdk/ -Recurse -Force
# dist start
DistByArch -type $args[1]
# move zip
Copy-Item -Path release/ElectronReact-*.zip -Destination ../$outterZipName -Recurse -Force
popd;
Break
}
3 {
pushd Agora-Electron-Premium
# choose arch
ChooseArch -type $args[1]
# remove node_modules
Remove-Item -Path node_modules -Recurse -Force -ErrorAction Ignore;
# remove dist
Remove-Item -Path dist -Recurse -Force -ErrorAction Ignore;
yarn
# copy native sdk
Copy-Item -Path ../Electron-*/* -Destination ./node_modules/agora-electron-sdk/ -Recurse -Force
# dist start
DistByArch -type $args[1]
# move zip
Copy-Item -Path dist/agora-electron-*.zip -Destination ../$outterZipName -Recurse -Force
popd;
Break
}
4 {"It is four."; Break}
}
echo "结束"
# IF "%chooseExampleType%"=="0" (
# cd Agora-Electron-Premium
# echo 当前工作路径: %cd%
# @REM del /f/q/s node_modules
# @REM call yarn --verbose
# xcopy %cd%/Electron-* node_modules/agora-electron-sdk/ /s /e /y
# @REM call yarn dist:zip
# @REM pushd dist
# @REM 7z a %cd%/../../../%outterZipName% win-unpacked
# @REM popd
# @REM popd
# ) ELSE IF "%chooseExampleType%"=="1" (
# echo 1
# ) ELSE IF "%chooseExampleType%"=="2" (
# echo 2
# ) ELSE (
# echo default
# )