Add initial PsiTransfer Filelink provider scaffold
This commit is contained in:
parent
a87d020ca2
commit
953cd501a7
16 changed files with 6283 additions and 1 deletions
75
build-xpi.ps1
Normal file
75
build-xpi.ps1
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Build an XPI from the repository contents.
|
||||
|
||||
.DESCRIPTION
|
||||
- Reads the version from manifest.json.
|
||||
- Packages the repo while excluding build scripts, release output, and local editor folders.
|
||||
- Writes the finished XPI to release/.
|
||||
#>
|
||||
|
||||
$ScriptDir = Split-Path $MyInvocation.MyCommand.Path
|
||||
$ReleaseDir = Join-Path $ScriptDir 'release'
|
||||
$Manifest = Join-Path $ScriptDir 'manifest.json'
|
||||
|
||||
if (-not (Test-Path $Manifest)) {
|
||||
Write-Error "manifest.json not found at $Manifest"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if (-not (Test-Path $ReleaseDir)) {
|
||||
New-Item -ItemType Directory -Path $ReleaseDir | Out-Null
|
||||
}
|
||||
|
||||
$version = (Get-Content $Manifest -Raw | ConvertFrom-Json).version
|
||||
if (-not $version) {
|
||||
Write-Error "No version found in manifest.json"
|
||||
exit 1
|
||||
}
|
||||
|
||||
$artifactBase = "psitransfer-filelink-$version"
|
||||
$zipPath = Join-Path $ReleaseDir "$artifactBase.zip"
|
||||
$xpiPath = Join-Path $ReleaseDir "$artifactBase.xpi"
|
||||
|
||||
Remove-Item -Path $zipPath, $xpiPath -Force -ErrorAction SilentlyContinue
|
||||
|
||||
$allFiles = Get-ChildItem -Path $ScriptDir -Recurse -File |
|
||||
Where-Object {
|
||||
$_.Extension -notin '.ps1', '.sh' -and
|
||||
$_.FullName -notmatch '\\release\\' -and
|
||||
$_.FullName -notmatch '\\.git\\' -and
|
||||
$_.FullName -notmatch '\\.idea\\' -and
|
||||
$_.FullName -notmatch '\\.vscode\\'
|
||||
}
|
||||
|
||||
if ($allFiles.Count -eq 0) {
|
||||
Write-Error "No files found to package."
|
||||
exit 1
|
||||
}
|
||||
|
||||
foreach ($file in $allFiles) {
|
||||
$size = (Get-Item $file.FullName).Length
|
||||
$rel = $file.FullName.Substring($ScriptDir.Length + 1).TrimStart('\')
|
||||
$entryName = $rel.Replace('\', '/')
|
||||
Write-Host "Zipping: $entryName <- $($file.FullName) ($size bytes)"
|
||||
}
|
||||
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
|
||||
$zip = [System.IO.Compression.ZipFile]::Open($zipPath, 'Create')
|
||||
foreach ($file in $allFiles) {
|
||||
$rel = $file.FullName.Substring($ScriptDir.Length + 1).TrimStart('\')
|
||||
$entryName = $rel.Replace('\', '/')
|
||||
|
||||
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile(
|
||||
$zip,
|
||||
$file.FullName,
|
||||
$entryName,
|
||||
[System.IO.Compression.CompressionLevel]::Optimal
|
||||
)
|
||||
}
|
||||
$zip.Dispose()
|
||||
|
||||
Rename-Item -Path $zipPath -NewName "$artifactBase.xpi" -Force
|
||||
|
||||
Write-Host "Built XPI at: $xpiPath"
|
||||
Loading…
Add table
Add a link
Reference in a new issue