Implementado o versionamento de versão da extensão

This commit is contained in:
Paulo Porto
2026-04-30 12:56:22 -03:00
parent 45cfceff0e
commit ca839345bc
4 changed files with 102 additions and 2 deletions

View File

@@ -22,3 +22,19 @@ Extensao Chrome Manifest V3 que adiciona o botao `Arch panel` ao header da pagin
- `manifest.json`: define a extensao e o carregamento do content script
- `content-script.js`: valida a URL, encontra o header e injeta o botao
## Controle de versao
A versao oficial da extensao fica em `manifest.json`.
Toda alteracao funcional, visual ou tecnica na extensao deve incrementar a terceira casa da versao antes da entrega:
```powershell
powershell -ExecutionPolicy Bypass -File tools/bump-extension-version.ps1
```
Quando uma versao especifica for solicitada, informe o valor explicitamente:
```powershell
powershell -ExecutionPolicy Bypass -File tools/bump-extension-version.ps1 -Version 1.0.25
```

View File

@@ -794,6 +794,13 @@
<span>Updated by Refresh data</span>
</div>
</div>
<div class="arch-panel-extension-sidebar-group">
<p class="arch-panel-extension-sidebar-label">Extension version</p>
<div class="arch-panel-extension-sidebar-data">
<span>v${escapeHtml(getExtensionVersion())}</span>
</div>
</div>
</aside>
<main class="arch-panel-extension-main-shell">
@@ -833,6 +840,14 @@
`;
}
function getExtensionVersion() {
try {
return chrome.runtime.getManifest()?.version || "0.0.0";
} catch {
return "0.0.0";
}
}
function renderMetricCard(label, value, detail) {
return `
<article class="arch-panel-extension-summary-card">

View File

@@ -1,7 +1,7 @@
{
{
"manifest_version": 3,
"name": "Arch Panel Injector",
"version": "1.0.0",
"version": "1.0.3",
"description": "Insere o botao Arch panel no header do Oracle Workload Workbench.",
"permissions": [
"cookies",
@@ -36,3 +36,7 @@
}
]
}

View File

@@ -0,0 +1,65 @@
param(
[string]$Version
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$manifestPath = Join-Path $repoRoot "manifest.json"
function Test-ExtensionVersion {
param([string]$Value)
if ($Value -notmatch '^\d+\.\d+\.\d+$') {
throw "Invalid version '$Value'. Expected format N.N.N, for example 1.0.7."
}
foreach ($part in $Value.Split(".")) {
$number = [int64]$part
if ($number -lt 0 -or $number -gt 65535) {
throw "Invalid version '$Value'. Each part must be between 0 and 65535."
}
}
}
if (!(Test-Path -LiteralPath $manifestPath)) {
throw "manifest.json not found at $manifestPath"
}
$rawManifest = Get-Content -LiteralPath $manifestPath -Raw
$manifest = $rawManifest | ConvertFrom-Json
$currentVersion = [string]$manifest.version
Test-ExtensionVersion -Value $currentVersion
if ($Version) {
$nextVersion = $Version.Trim()
Test-ExtensionVersion -Value $nextVersion
} else {
$parts = $currentVersion.Split(".")
$patch = [int64]$parts[2] + 1
if ($patch -gt 65535) {
throw "Cannot increment patch version beyond 65535."
}
$nextVersion = "$($parts[0]).$($parts[1]).$patch"
}
$versionPattern = '("version"\s*:\s*")([^"]+)(")'
$matches = [regex]::Matches($rawManifest, $versionPattern)
if ($matches.Count -ne 1) {
throw "Expected exactly one version field in manifest.json, found $($matches.Count)."
}
$updatedManifest = [regex]::Replace(
$rawManifest,
$versionPattern,
"`${1}$nextVersion`${3}",
1
)
Set-Content -LiteralPath $manifestPath -Value $updatedManifest -Encoding UTF8
Write-Output "Extension version updated: $currentVersion -> $nextVersion"