docs.sheetjs.com/tests/cli/pkg.ps1

23 lines
789 B
PowerShell
Raw Permalink Normal View History

2026-01-29 04:58:19 +00:00
#!/usr/bin/env pwsh
# https://docs.sheetjs.com/docs/demos/cli/pkg
$oldDir = Get-Location
$tempDir = Join-Path -Path $env:TEMP -ChildPath "sheetjs-pkg"
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
$OS = "win"
$ARCH = "x64"
npx -y pkg -t "node18-win-$ARCH,node18-linux-$ARCH,node18-macos-$ARCH" xlsx-cli.js
.\xlsx-cli-win.exe pres.numbers
Set-Location $oldDir
Remove-Item -Path $tempDir -Recurse -Force