26 lines
931 B
PowerShell
26 lines
931 B
PowerShell
#!/usr/bin/env pwsh
|
|
# https://docs.sheetjs.com/docs/demos/cli/nexe
|
|
|
|
$oldDir = Get-Location
|
|
$tempDir = Join-Path -Path $env:TEMP -ChildPath "sheetjs-nexe"
|
|
if (Test-Path -Path $tempDir) { Remove-Item -Path $tempDir -Recurse -Force }
|
|
New-Item -ItemType Directory -Path $tempDir | Out-Null
|
|
Set-Location -Path $tempDir
|
|
|
|
Invoke-WebRequest -Uri "https://docs.sheetjs.com/pres.numbers" -OutFile "pres.numbers"
|
|
Invoke-WebRequest -Uri "https://docs.sheetjs.com/cli/xlsx-cli.js" -OutFile "xlsx-cli.js"
|
|
|
|
npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz exit-on-epipe commander@2
|
|
|
|
$ARCH = $env:PROCESSOR_ARCHITECTURE
|
|
|
|
switch ($ARCH) {
|
|
"AMD64" { npx -y nexe -t 14.15.3 xlsx-cli.js }
|
|
"ARM64" { npx -y nexe xlsx-cli.js --build --python=$(Get-Command python3).Source }
|
|
default { Write-Error "unsupported architecture: $ARCH"; exit 1 }
|
|
}
|
|
|
|
.\xlsx-cli pres.numbers
|
|
|
|
Set-Location $oldDir
|
|
Remove-Item -Path $tempDir -Recurse -Force |