generated from vivid-lapin/ts
-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup_wcjs.ps1
53 lines (46 loc) · 1.68 KB
/
setup_wcjs.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
$LIBVLC_VER = "3.0.16"
$LIBVLC_VER_EXTRA = "3"
$OS_NAME = "windows"
$ELECTRON_VERSION = (yarn run --silent electron --version) | Out-String
$Env:YARN_ENABLE_IMMUTABLE_INSTALLS = "false"
$Env:npm_config_wcjs_runtime = "electron"
$Env:npm_config_wcjs_runtime_version = $ELECTRON_VERSION.Replace("v", "") -replace "`t|`n|`r",""
$Env:npm_config_wcjs_arch = "x64"
$Env:ELECTRON_MIRROR = "https://artifacts.electronjs.org/headers/dist"
# Setup WebChimera.js
Set-Location "node_modules\webchimera.js"
function TryRemove {
param($file)
if (Test-Path $file) {
Remove-Item $file -Force -Recurse
}
}
function onExit {
TryRemove ".\.yarn"
TryRemove ".\node_modules"
TryRemove ".\build"
TryRemove ".\deps\vlc-${LIBVLC_VER}"
TryRemove ".\yarn.lock"
Set-Location "..\.."
}
Register-EngineEvent PowerShell.Exiting -Action {
onExit
}
onExit
Set-Location "node_modules\webchimera.js"
Invoke-WebRequest -Uri "https://github.com/vivid-lapin/vlc-miraktest/releases/download/${LIBVLC_VER}.${LIBVLC_VER_EXTRA}/vlc-${OS_NAME}-${LIBVLC_VER}.zip" -OutFile "libvlc.zip"
Expand-Archive -Path ".\libvlc.zip" -DestinationPath ".\deps\vlc-${LIBVLC_VER}" -Force
Remove-Item ".\libvlc.zip"
Write-Output "nodeLinker: node-modules" | Set-Content ".\.yarnrc.yml"
Write-Output "" | Set-Content ".\yarn.lock"
Remove-Item ".\deps\libvlc_wrapper" -Recurse -Force
git clone --depth 1 --recursive https://github.com/RSATom/ya-libvlc-wrapper.git deps/libvlc_wrapper
yarn install
node rebuild.js
@"
module.exports = {
...require('./WebChimera.js.node'),
path: __dirname.replace('app.asar', 'app.asar.unpacked')
}
"@ | Set-Content ".\index.js"
Copy-Item .\build\Release\WebChimera.js.node .