docs.sheetjs.com/tests/engines/miniracer.ps1

25 lines
987 B
PowerShell
Raw Normal View History

2026-03-05 05:25:10 +00:00
#!/usr/bin/env pwsh
# https://docs.sheetjs.com/docs/demos/engines/v8#python
$oldDir = Get-Location
$tempDir = Join-Path -Path $env:TEMP -ChildPath "sheetjs-miniracer"
if (Test-Path -Path $tempDir) { Remove-Item -Path $tempDir -Recurse -Force }
New-Item -ItemType Directory -Path $tempDir | Out-Null
Set-Location -Path $tempDir
pip install mini-racer 2>&1 | Out-Null
2026-03-06 04:51:03 +00:00
if ($LASTEXITCODE -ne 0) { python -m pip install mini-racer }
2026-03-05 05:25:10 +00:00
Invoke-WebRequest -Uri "https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js" -OutFile "xlsx.full.min.js"
Invoke-WebRequest -Uri "https://docs.sheetjs.com/pres.xlsx" -OutFile "pres.xlsx"
Invoke-WebRequest -Uri "https://docs.sheetjs.com/v8/sheetjs-mini-racer.py" -OutFile "sheetjs-mini-racer.py"
python sheetjs-mini-racer.py pres.xlsx
if ($LASTEXITCODE -ne 0) { throw "Python script failed" }
npm init -y
npm i --save xlsx-cli
.\node_modules\.bin\xlsx-cli SheetJSMiniRacer.xlsb
Set-Location $oldDir
Remove-Item -Path $tempDir -Recurse -Force