browser4-cli 4.12.0 → 4.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/browser4-cli-darwin-arm64 +0 -0
- package/bin/browser4-cli-darwin-x64 +0 -0
- package/bin/browser4-cli-linux-arm64 +0 -0
- package/bin/browser4-cli-linux-musl-arm64 +0 -0
- package/bin/browser4-cli-linux-musl-x64 +0 -0
- package/bin/browser4-cli-linux-x64 +0 -0
- package/bin/browser4-cli-win32-x64.exe +0 -0
- package/package.json +1 -1
- package/scripts/build-all-platforms.ps1 +104 -104
- package/scripts/enumerate-help.ps1 +382 -382
- package/scripts/install-browser4-cli.ps1 +812 -812
- package/scripts/tests/install-browser4-cli.tests.ps1 +476 -462
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
[CmdletBinding()]
|
|
2
|
-
param(
|
|
3
|
-
[string]$ProjectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path,
|
|
4
|
-
[string]$ImageName = "browser4-builder",
|
|
5
|
-
[switch]$SkipDockerBuild,
|
|
6
|
-
[switch]$DryRun
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
Set-StrictMode -Version Latest
|
|
10
|
-
$ErrorActionPreference = "Stop"
|
|
11
|
-
|
|
12
|
-
$OutputDir = Join-Path $ProjectRoot "bin"
|
|
13
|
-
$CliDir = Join-Path $ProjectRoot "browser4-cli"
|
|
14
|
-
$DockerfilePath = Join-Path $ProjectRoot "docker/Dockerfile.build"
|
|
15
|
-
|
|
16
|
-
$Targets = @(
|
|
17
|
-
@{ Target = "x86_64-unknown-linux-gnu"; Output = "browser4-cli-linux-x64" },
|
|
18
|
-
@{ Target = "aarch64-unknown-linux-gnu"; Output = "browser4-cli-linux-arm64" },
|
|
19
|
-
@{ Target = "x86_64-pc-windows-gnu"; Output = "browser4-cli-win32-x64.exe" },
|
|
20
|
-
@{ Target = "x86_64-apple-darwin"; Output = "browser4-cli-darwin-x64" },
|
|
21
|
-
@{ Target = "aarch64-apple-darwin"; Output = "browser4-cli-darwin-arm64" },
|
|
22
|
-
@{ Target = "x86_64-unknown-linux-musl"; Output = "browser4-cli-linux-musl-x64" },
|
|
23
|
-
@{ Target = "aarch64-unknown-linux-musl"; Output = "browser4-cli-linux-musl-arm64" }
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
function Invoke-DockerCommand {
|
|
27
|
-
param([string[]]$Args)
|
|
28
|
-
|
|
29
|
-
if ($DryRun) {
|
|
30
|
-
Write-Host ("[DRY-RUN] docker " + ($Args -join " ")) -ForegroundColor DarkYellow
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
& docker @Args
|
|
35
|
-
if ($LASTEXITCODE -ne 0) {
|
|
36
|
-
throw "Docker command failed with exit code $LASTEXITCODE"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function Build-Target {
|
|
41
|
-
param(
|
|
42
|
-
[string]$Target,
|
|
43
|
-
[string]$OutputName
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
Write-Host "Building for $Target..." -ForegroundColor Yellow
|
|
47
|
-
|
|
48
|
-
$containerCmd = "cargo zigbuild --release --target $Target && cp /build/target/$Target/release/browser4-cli* /output/$OutputName && chmod +x /output/$OutputName 2>/dev/null || true"
|
|
49
|
-
|
|
50
|
-
Invoke-DockerCommand -Args @(
|
|
51
|
-
"run", "--rm",
|
|
52
|
-
"-v", "${CliDir}:/build",
|
|
53
|
-
"-v", "${OutputDir}:/output",
|
|
54
|
-
$ImageName,
|
|
55
|
-
"-c", $containerCmd
|
|
56
|
-
)
|
|
57
|
-
|
|
58
|
-
$artifactPath = Join-Path $OutputDir $OutputName
|
|
59
|
-
if (-not (Test-Path -Path $artifactPath -PathType Leaf)) {
|
|
60
|
-
throw "Failed to build $OutputName"
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
$artifactSize = (Get-Item -Path $artifactPath).Length
|
|
64
|
-
if ($artifactSize -le 0) {
|
|
65
|
-
throw "Built artifact is empty: $OutputName"
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
Write-Host "Built $OutputName" -ForegroundColor Green
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
|
|
72
|
-
throw "Docker CLI not found in PATH. Install Docker Desktop and retry."
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
Write-Host "Building browser4-cli for all platforms..." -ForegroundColor Yellow
|
|
76
|
-
Write-Host ""
|
|
77
|
-
|
|
78
|
-
New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
|
|
79
|
-
|
|
80
|
-
if (-not $SkipDockerBuild) {
|
|
81
|
-
Write-Host "Building Docker cross-compilation image..." -ForegroundColor Yellow
|
|
82
|
-
Invoke-DockerCommand -Args @(
|
|
83
|
-
"build",
|
|
84
|
-
"-t", $ImageName,
|
|
85
|
-
"-f", $DockerfilePath,
|
|
86
|
-
$ProjectRoot
|
|
87
|
-
)
|
|
88
|
-
Write-Host ""
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
foreach ($entry in $Targets) {
|
|
92
|
-
Build-Target -Target $entry.Target -OutputName $entry.Output
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
Write-Host ""
|
|
96
|
-
Write-Host "Build complete" -ForegroundColor Green
|
|
97
|
-
Write-Host "Binaries are in: $OutputDir"
|
|
98
|
-
|
|
99
|
-
if ($DryRun) {
|
|
100
|
-
Write-Host "[DRY-RUN] Skipping artifact listing." -ForegroundColor DarkYellow
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
Get-ChildItem -Path $OutputDir -Filter "browser4-cli-*" | Select-Object Name, Length, LastWriteTime
|
|
104
|
-
}
|
|
1
|
+
[CmdletBinding()]
|
|
2
|
+
param(
|
|
3
|
+
[string]$ProjectRoot = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path,
|
|
4
|
+
[string]$ImageName = "browser4-builder",
|
|
5
|
+
[switch]$SkipDockerBuild,
|
|
6
|
+
[switch]$DryRun
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
Set-StrictMode -Version Latest
|
|
10
|
+
$ErrorActionPreference = "Stop"
|
|
11
|
+
|
|
12
|
+
$OutputDir = Join-Path $ProjectRoot "bin"
|
|
13
|
+
$CliDir = Join-Path $ProjectRoot "browser4-cli"
|
|
14
|
+
$DockerfilePath = Join-Path $ProjectRoot "docker/Dockerfile.build"
|
|
15
|
+
|
|
16
|
+
$Targets = @(
|
|
17
|
+
@{ Target = "x86_64-unknown-linux-gnu"; Output = "browser4-cli-linux-x64" },
|
|
18
|
+
@{ Target = "aarch64-unknown-linux-gnu"; Output = "browser4-cli-linux-arm64" },
|
|
19
|
+
@{ Target = "x86_64-pc-windows-gnu"; Output = "browser4-cli-win32-x64.exe" },
|
|
20
|
+
@{ Target = "x86_64-apple-darwin"; Output = "browser4-cli-darwin-x64" },
|
|
21
|
+
@{ Target = "aarch64-apple-darwin"; Output = "browser4-cli-darwin-arm64" },
|
|
22
|
+
@{ Target = "x86_64-unknown-linux-musl"; Output = "browser4-cli-linux-musl-x64" },
|
|
23
|
+
@{ Target = "aarch64-unknown-linux-musl"; Output = "browser4-cli-linux-musl-arm64" }
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
function Invoke-DockerCommand {
|
|
27
|
+
param([string[]]$Args)
|
|
28
|
+
|
|
29
|
+
if ($DryRun) {
|
|
30
|
+
Write-Host ("[DRY-RUN] docker " + ($Args -join " ")) -ForegroundColor DarkYellow
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
& docker @Args
|
|
35
|
+
if ($LASTEXITCODE -ne 0) {
|
|
36
|
+
throw "Docker command failed with exit code $LASTEXITCODE"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function Build-Target {
|
|
41
|
+
param(
|
|
42
|
+
[string]$Target,
|
|
43
|
+
[string]$OutputName
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
Write-Host "Building for $Target..." -ForegroundColor Yellow
|
|
47
|
+
|
|
48
|
+
$containerCmd = "cargo zigbuild --release --target $Target && cp /build/target/$Target/release/browser4-cli* /output/$OutputName && chmod +x /output/$OutputName 2>/dev/null || true"
|
|
49
|
+
|
|
50
|
+
Invoke-DockerCommand -Args @(
|
|
51
|
+
"run", "--rm",
|
|
52
|
+
"-v", "${CliDir}:/build",
|
|
53
|
+
"-v", "${OutputDir}:/output",
|
|
54
|
+
$ImageName,
|
|
55
|
+
"-c", $containerCmd
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
$artifactPath = Join-Path $OutputDir $OutputName
|
|
59
|
+
if (-not (Test-Path -Path $artifactPath -PathType Leaf)) {
|
|
60
|
+
throw "Failed to build $OutputName"
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
$artifactSize = (Get-Item -Path $artifactPath).Length
|
|
64
|
+
if ($artifactSize -le 0) {
|
|
65
|
+
throw "Built artifact is empty: $OutputName"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
Write-Host "Built $OutputName" -ForegroundColor Green
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) {
|
|
72
|
+
throw "Docker CLI not found in PATH. Install Docker Desktop and retry."
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
Write-Host "Building browser4-cli for all platforms..." -ForegroundColor Yellow
|
|
76
|
+
Write-Host ""
|
|
77
|
+
|
|
78
|
+
New-Item -ItemType Directory -Force -Path $OutputDir | Out-Null
|
|
79
|
+
|
|
80
|
+
if (-not $SkipDockerBuild) {
|
|
81
|
+
Write-Host "Building Docker cross-compilation image..." -ForegroundColor Yellow
|
|
82
|
+
Invoke-DockerCommand -Args @(
|
|
83
|
+
"build",
|
|
84
|
+
"-t", $ImageName,
|
|
85
|
+
"-f", $DockerfilePath,
|
|
86
|
+
$ProjectRoot
|
|
87
|
+
)
|
|
88
|
+
Write-Host ""
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
foreach ($entry in $Targets) {
|
|
92
|
+
Build-Target -Target $entry.Target -OutputName $entry.Output
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
Write-Host ""
|
|
96
|
+
Write-Host "Build complete" -ForegroundColor Green
|
|
97
|
+
Write-Host "Binaries are in: $OutputDir"
|
|
98
|
+
|
|
99
|
+
if ($DryRun) {
|
|
100
|
+
Write-Host "[DRY-RUN] Skipping artifact listing." -ForegroundColor DarkYellow
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
Get-ChildItem -Path $OutputDir -Filter "browser4-cli-*" | Select-Object Name, Length, LastWriteTime
|
|
104
|
+
}
|