diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b3f7b56..096b7de 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -2,6 +2,7 @@ ver(core): x.x.x-preview ver(gen): x.x.x-preview +ver(template): x.x.x-preview ## Notes: diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml index 900d72f..de0a8c8 100644 --- a/.github/workflows/dev-release.yml +++ b/.github/workflows/dev-release.yml @@ -53,8 +53,16 @@ jobs: Write-Host "ver(gen) no encontrado - se omitira paquete Generators" } + $templateVersion = $null + if ($prBody -match '(?i)ver\s*\(\s*template\s*\)\s*:\s*(\d+\.\d+\.\d+-preview)') { + $templateVersion = $matches[1] + Write-Host "ver(template): $templateVersion" + } else { + Write-Host "ver(template) no encontrado - se omitira paquete Templates" + } + # 2. Validar que al menos uno fue encontrado - if (-not $coreVersion -and -not $genVersion) { + if (-not $coreVersion -and -not $genVersion -and -not $templateVersion) { Write-Host "" Write-Host "No se encontro ninguna version valida. Workflow terminado." echo "::warning::No se encontraron versiones en el PR body" @@ -62,8 +70,8 @@ jobs: exit 0 } - # 3. Determinar version del Release (prioridad: Core > Generators) - $releaseVersion = if ($coreVersion) { $coreVersion } else { $genVersion } + # 3. Determinar version del Release (prioridad: Core > Generators > Templates) + $releaseVersion = if ($coreVersion) { $coreVersion } else { if ($genVersion) { $genVersion } else { $templateVersion } } # 4. Construir cuerpo del Release en Markdown $bodyMsg = "## Preview Release`n`nEsta es una version preview automatica desde development.`n`n### Paquetes publicados" @@ -74,6 +82,9 @@ jobs: if ($genVersion) { $bodyMsg += "`n- **RandAMediaLabGroup.EasyWindowsApplication.Generators** ``$genVersion``" } + if ($templateVersion) { + $bodyMsg += "`n- **RandAMediaLabGroup.EasyWindowsApplication.Templates** ``$templateVersion``" + } $bodyMsg += "`n`n### PR Original`n$($env:PR_URL)" @@ -89,17 +100,21 @@ jobs: # Solo exportar versiones que existen para evitar en .csproj if ($coreVersion) { echo "CORE_VERSION=$coreVersion" >> $env:GITHUB_OUTPUT } if ($genVersion) { echo "GEN_VERSION=$genVersion" >> $env:GITHUB_OUTPUT } + if ($templateVersion) { echo "TEMPLATE_VERSION=$templateVersion" >> $env:GITHUB_OUTPUT } $hasCore = if ($coreVersion) { 'true' } else { 'false' } $hasGen = if ($genVersion) { 'true' } else { 'false' } + $hasTemplate = if ($templateVersion) { 'true' } else { 'false' } echo "HAS_CORE=$hasCore" >> $env:GITHUB_OUTPUT echo "HAS_GEN=$hasGen" >> $env:GITHUB_OUTPUT + echo "HAS_TEMPLATE=$hasTemplate" >> $env:GITHUB_OUTPUT Write-Host "" Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" Write-Host "RELEASE_VERSION : $releaseVersion" Write-Host "HAS_CORE : $hasCore" Write-Host "HAS_GEN : $hasGen" + Write-Host "HAS_TEMPLATE : $hasTemplate" Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - name: Update project versions @@ -128,6 +143,15 @@ jobs: Write-Host "Generators omitido (no hay version)" } + if ("${{ steps.extract_version.outputs.HAS_TEMPLATE }}" -eq "true") { + $version = "${{ steps.extract_version.outputs.TEMPLATE_VERSION }}" + $projFile = "src/ProjectTemplates/ProjectTemplates.csproj" + (Get-Content $projFile) -replace '.*', "$version" | Set-Content $projFile + Write-Host "Templates actualizado a: $version" + } else { + Write-Host "Templates omitido (no hay version)" + } + Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - name: Setup .NET 10 @@ -168,6 +192,18 @@ jobs: dotnet pack src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj --configuration Release --no-build --output ./nupkgs if ($LASTEXITCODE -ne 0) { Write-Error "Pack fallido"; exit 1 } + - name: Build & Pack Templates package + if: steps.extract_version.outputs.SKIP_WORKFLOW != 'true' && steps.extract_version.outputs.HAS_TEMPLATE == 'true' + shell: pwsh + run: | + Write-Host "Restaurando Templates..." + dotnet restore src/ProjectTemplates/ProjectTemplates.csproj + if ($LASTEXITCODE -ne 0) { Write-Error "Restore fallido"; exit 1 } + + Write-Host "Empaquetando Templates..." + dotnet pack src/ProjectTemplates/ProjectTemplates.csproj --configuration Release --no-restore --output ./nupkgs + if ($LASTEXITCODE -ne 0) { Write-Error "Pack fallido"; exit 1 } + - name: List generated packages if: steps.extract_version.outputs.SKIP_WORKFLOW != 'true' shell: pwsh diff --git a/.github/workflows/prod-release.yml b/.github/workflows/prod-release.yml index be7e0a0..fe0e5fc 100644 --- a/.github/workflows/prod-release.yml +++ b/.github/workflows/prod-release.yml @@ -61,8 +61,20 @@ jobs: Write-Host "ver(gen) no encontrado - se omitira paquete Generators" } + $templatePreview = $null + $templateStable = $null + if ($prBody -match '(?i)ver\s*\(\s*template\s*\)\s*:\s*(\d+\.\d+\.\d+)-preview') { + $templatePreview = $matches[1] + "-preview" + $templateStable = $matches[1] + Write-Host "ver(template) encontrado" + Write-Host " Preview: $templatePreview" + Write-Host " Stable : $templateStable" + } else { + Write-Host "ver(template) no encontrado - se omitira paquete Templates" + } + # 2. Validar que al menos uno fue encontrado - if (-not $coreStable -and -not $genStable) { + if (-not $coreStable -and -not $genStable -and -not $templateStable) { Write-Host "" Write-Host "No se encontro ninguna version valida. Workflow terminado." echo "::warning::No se encontraron versiones en el PR body" @@ -70,8 +82,8 @@ jobs: exit 0 } - # 3. Determinar version del Release (prioridad: Core > Generators) - $releaseVersion = if ($coreStable) { $coreStable } else { $genStable } + # 3. Determinar version del Release (prioridad: Core > Generators > Templates) + $releaseVersion = if ($coreStable) { $coreStable } else { if ($genStable) { $genStable } else { $templateStable } } # 4. Construir cuerpo del Release en Markdown $bodyMsg = "## Stable Release`n`nEsta es una version estable promocionada desde preview.`n`n### Paquetes publicados" @@ -82,6 +94,9 @@ jobs: if ($genStable) { $bodyMsg += "`n- **RandAMediaLabGroup.EasyWindowsApplication.Generators** ``$genStable`` (desde ``$genPreview``)" } + if ($templateStable) { + $bodyMsg += "`n- **RandAMediaLabGroup.EasyWindowsApplication.Templates** ``$templateStable`` (desde ``$templatePreview``)" + } $bodyMsg += "`n`n### PR Original`n$($env:PR_URL)" $bodyMsg += "`n`n### Cambios`nVer el Pull Request para detalles completos de los cambios incluidos en esta version." @@ -100,17 +115,22 @@ jobs: if ($corePreview) { echo "CORE_PREVIEW=$corePreview" >> $env:GITHUB_OUTPUT } if ($genStable) { echo "GEN_STABLE=$genStable" >> $env:GITHUB_OUTPUT } if ($genPreview) { echo "GEN_PREVIEW=$genPreview" >> $env:GITHUB_OUTPUT } + if ($templateStable) { echo "TEMPLATE_STABLE=$templateStable" >> $env:GITHUB_OUTPUT } + if ($templatePreview) { echo "TEMPLATE_PREVIEW=$templatePreview" >> $env:GITHUB_OUTPUT } $hasCore = if ($coreStable) { 'true' } else { 'false' } $hasGen = if ($genStable) { 'true' } else { 'false' } + $hasTemplate = if ($templateStable) { 'true' } else { 'false' } echo "HAS_CORE=$hasCore" >> $env:GITHUB_OUTPUT echo "HAS_GEN=$hasGen" >> $env:GITHUB_OUTPUT + echo "HAS_TEMPLATE=$hasTemplate" >> $env:GITHUB_OUTPUT Write-Host "" Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" Write-Host "RELEASE_VERSION : $releaseVersion" Write-Host "HAS_CORE : $hasCore" Write-Host "HAS_GEN : $hasGen" + Write-Host "HAS_TEMPLATE : $hasTemplate" Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - name: Update project versions @@ -139,6 +159,15 @@ jobs: Write-Host "Generators omitido (no hay version)" } + if ("${{ steps.extract_version.outputs.HAS_TEMPLATE }}" -eq "true") { + $version = "${{ steps.extract_version.outputs.TEMPLATE_STABLE }}" + $projFile = "src/ProjectTemplates/ProjectTemplates.csproj" + (Get-Content $projFile) -replace '.*', "$version" | Set-Content $projFile + Write-Host "Templates actualizado a: $version (STABLE)" + } else { + Write-Host "Templates omitido (no hay version)" + } + Write-Host "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - name: Setup .NET 10 @@ -179,6 +208,18 @@ jobs: dotnet pack src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj --configuration Release --no-build --output ./nupkgs if ($LASTEXITCODE -ne 0) { Write-Error "Pack fallido"; exit 1 } + - name: Build & Pack Templates package + if: steps.extract_version.outputs.SKIP_WORKFLOW != 'true' && steps.extract_version.outputs.HAS_TEMPLATE == 'true' + shell: pwsh + run: | + Write-Host "Restaurando Templates..." + dotnet restore src/ProjectTemplates/ProjectTemplates.csproj + if ($LASTEXITCODE -ne 0) { Write-Error "Restore fallido"; exit 1 } + + Write-Host "Empaquetando Templates..." + dotnet pack src/ProjectTemplates/ProjectTemplates.csproj --configuration Release --no-restore --output ./nupkgs + if ($LASTEXITCODE -ne 0) { Write-Error "Pack fallido"; exit 1 } + - name: List generated packages if: steps.extract_version.outputs.SKIP_WORKFLOW != 'true' shell: pwsh diff --git a/.gitignore b/.gitignore index 112db11..dcb79fc 100644 --- a/.gitignore +++ b/.gitignore @@ -433,3 +433,6 @@ src/ProjectTemplates/**/*.ico # Plan files plan-*.md + +# OpenCode .ignore file +.ignore diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a35f0c7..31890bc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -49,6 +49,16 @@ dotnet build src\EasyWindowsApplication\EasyWindowsApplication.csproj dotnet run --project src\ProjectTemplates\SimpleEasyWinApp\SimpleEasyWinApp.csproj ``` +### Plantillas (desarrollo) + +Para reinstalar o desinstalar las plantillas sin recordar comandos, ejecuta el gestor interactivo: + +```bash +.\devtools\install-templates.ps1 +``` + +El menú permite reinstalar desde el repositorio (`src\ProjectTemplates`) o desde un paquete `.nupkg` local, desinstalar, y salir. + --- ## Arquitectura de módulos @@ -181,7 +191,7 @@ Todo trabajo (funcionalidad, ajuste, bugfix) comienza con un **issue** creado co git checkout {número}-{slug} ``` 4. **Trabaja y haz push** con commits en Conventional Commits (`feat:`, `fix:`, ...). -5. **Abre un Pull Request contra `develop`** e incluye en el body los marcadores de versión (`ver(core)` / `ver(gen)`) según la sección [CI/CD](#cicd). +5. **Abre un Pull Request contra `develop`** e incluye en el body los marcadores de versión (`ver(core)` / `ver(gen)` / `ver(template)`) según la sección [CI/CD](#cicd). 6. **Mergea a `develop`** → `dev-release.yml` publica el preview automáticamente. Los usuarios prueban y dan feedback, que se canaliza en nuevos issues. Reglas: @@ -217,9 +227,11 @@ Este repositorio publica paquetes NuGet automáticamente mediante GitHub Actions ```text ver(core): 0.1.0-preview ver(gen): 0.1.0-preview + ver(template): 0.1.0-preview ``` - `core` → paquete `RandAMediaLabGroup.EasyWindowsApplication` - `gen` → paquete `RandAMediaLabGroup.EasyWindowsApplication.Generators` + - `template` → paquete `RandAMediaLabGroup.EasyWindowsApplication.Templates` (template pack `easywinapp` / `simpleeasywinapp`) 3. **Al *mergear*** a `develop`, el workflow `dev-release.yml` publica automáticamente el preview a NuGet y crea un *GitHub Release* con tag `v0.1.0-preview`. 4. **Para promover a estable**, abre un PR de `develop` → `main` con el **mismo** *body* (marcadores con `-preview`). Al *mergear*, `prod-release.yml` publica la versión estable y elimina el `-preview` del tag. diff --git a/README.md b/README.md index 2308226..2bb4b70 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,15 @@ El framework incluye **dos plantillas** oficiales: dotnet build src\EasyWindowsApplication.slnx ``` -2. **Instala las plantillas localmente:** +2. **Instala las plantillas:** + + **Opción A — Paquete NuGet (recomendado para usuarios):** + ```bash + dotnet new install RandAMediaLabGroup.EasyWindowsApplication.Templates + ``` + El paquete incluye ambas plantillas (`easywinapp` y `simpleeasywinapp`) y los proyectos que genera dependen de los **paquetes NuGet** del framework (`RandAMediaLabGroup.EasyWindowsApplication` y `RandAMediaLabGroup.EasyWindowsApplication.Generators`) en su última versión publicada (preview o estable). + + **Opción B — Desde la carpeta del repositorio (desarrollo):** ```bash dotnet new install src\ProjectTemplates\EasyWinApp dotnet new install src\ProjectTemplates\SimpleEasyWinApp @@ -84,6 +92,8 @@ El framework incluye **dos plantillas** oficiales: **Desintalaion de plantillas** ```bash + dotnet new uninstall RandAMediaLabGroup.EasyWindowsApplication.Templates + dotnet new uninstall src\ProjectTemplates\EasyWinApp dotnet new uninstall src\ProjectTemplates\SimpleEasyWinApp @@ -109,8 +119,7 @@ El framework incluye **dos plantillas** oficiales: 1. **Instala las plantillas** (una vez): ```bash - dotnet new install src\ProjectTemplates\EasyWinApp - dotnet new install src\ProjectTemplates\SimpleEasyWinApp + dotnet new install RandAMediaLabGroup.EasyWindowsApplication.Templates ``` 2. **Archivo → Nuevo → Proyecto → Busca "Easy Win App" o "Simple Easy Win App" → Siguiente → Crear.** diff --git a/devtools/install-templates.ps1 b/devtools/install-templates.ps1 new file mode 100644 index 0000000..255f8c2 --- /dev/null +++ b/devtools/install-templates.ps1 @@ -0,0 +1,290 @@ +#Requires -Version 5.1 +<# +.SYNOPSIS + Gestor interactivo de plantillas de Easy Windows Application. + +.DESCRIPTION + Permite reinstalar o desinstalar las plantillas 'easywinapp' y 'simpleeasywinapp' + sin tener que recordar comandos. Al ejecutarlo se muestra un menu interactivo: + + 1. Reinstalar desde el repositorio (src\ProjectTemplates) + 2. Reinstalar desde un paquete .nupkg local + 3. Desinstalar + + Salir: presiona [Esc] + + Uso: + .\devtools\install-templates.ps1 +#> + +[CmdletBinding()] +param() + +# ================= Configuracion ================= +$RepoRoot = Split-Path -Parent $PSScriptRoot +$TemplatesFolder = [IO.Path]::GetFullPath((Join-Path $RepoRoot 'src\ProjectTemplates')).TrimEnd('\') + +function Test-DotNet { + return $null -ne (Get-Command dotnet -ErrorAction SilentlyContinue) +} + +function Get-InstallationStatus { + param() + + $status = @{ + Installed = $false + Source = 'none' + RepoSource = $null + PkgSources = @() + Templates = @() + TemplateIds = @() + } + + $output = (& dotnet new uninstall 2>&1 | Out-String) + $currentSource = $null + + foreach ($line in ($output -split "\r?\n")) { + if ($line -match '^\s{3}\S') { + $currentSource = $line.Trim() + } + elseif ($line -match '^\s{6,}\S' -and $line -match 'easywinapp|simpleeasywinapp') { + $status.Templates += $line.Trim() + if ($line -match '\((easywinapp|simpleeasywinapp)\)') { + $id = $Matches[1] + if ($id -notin $status.TemplateIds) { $status.TemplateIds += $id } + } + if ($null -ne $currentSource) { + $srcFull = '' + try { $srcFull = [IO.Path]::GetFullPath($currentSource).TrimEnd('\') } catch { } + if ($srcFull -ieq $TemplatesFolder) { + $status.RepoSource = $currentSource + } + elseif ($currentSource -notin $status.PkgSources) { + $status.PkgSources += $currentSource + } + } + } + } + + if ($status.Templates.Count -gt 0) { + $status.Installed = $true + $status.Source = if ($status.RepoSource) { 'repo' } else { 'pkg' } + } + return $status +} + +function Show-Header { + Clear-Host + Write-Host '' + Write-Host '====================================================' -ForegroundColor Cyan + Write-Host ' Easy Windows Application - Gestor de Plantillas' -ForegroundColor Cyan + Write-Host '====================================================' -ForegroundColor Cyan + Write-Host '' +} + +function Show-Status { + param($Status) + + if ($Status.Installed) { + $srcLabel = if ($Status.Source -eq 'repo') { 'desde repositorio' } else { 'desde paquete NuGet' } + Write-Host (" Estado : [OK] Plantillas instaladas ({0})" -f $srcLabel) -ForegroundColor Green + if ($Status.TemplateIds.Count -gt 0) { + Write-Host (" templates: {0}" -f ($Status.TemplateIds -join ', ')) -ForegroundColor Green + } + } + else { + Write-Host ' Estado : [--] No hay plantillas instaladas' -ForegroundColor Yellow + } + Write-Host '' +} + +function Show-MainMenu { + Write-Host ' Que deseas hacer?' + Write-Host '' + Write-Host ' Preciona [1] para Reinstalar desde repositorio' + Write-Host ' Preciona [2] para Reinstalar desde paquete NuGet' + Write-Host ' Preciona [3] para Desinstalar' + Write-Host '' + Write-Host ' Presiona [Esc] para salir' + Write-Host '' + + $key = $Host.UI.RawUI.ReadKey("NoEcho, IncludeKeyDown") + switch ($key.VirtualKeyCode) { + 27 { return 'quit' } + 49 { return '1' } + 50 { return '2' } + 51 { return '3' } + default { return 'invalid' } + } +} + +function Show-Confirm { + param([string]$Action) + + Write-Host '' + Write-Host (" Continuar con '{0}'?" -f $Action) -ForegroundColor Yellow + $resp = Read-Host ' [S/n]' + return ($resp.Trim().ToLower() -ne 'n') +} + +function Wait-BackToMenu { + Write-Host ' Presiona [Enter] para volver al menu o [Esc] para salir.' + $key = $Host.UI.RawUI.ReadKey("NoEcho, IncludeKeyDown") + if ($key.VirtualKeyCode -eq 27) { exit } + Write-Host '' +} + +function Invoke-Uninstall { + $status = Get-InstallationStatus + if (-not $status.Installed) { + Write-Host ' No hay plantillas instaladas.' -ForegroundColor Yellow + return + } + + $targets = @() + if ($status.RepoSource) { $targets += $status.RepoSource } + $targets += $status.PkgSources + + foreach ($t in $targets) { + Write-Host (" Desinstalando: {0}" -f $t) -ForegroundColor DarkGray + & dotnet new uninstall $t | Out-Null + if ($LASTEXITCODE -ne 0) { + Write-Host (" [ERROR] Fallo al desinstalar: {0}" -f $t) -ForegroundColor Red + } + } +} + +function Install-FromRepo { + $status = Get-InstallationStatus + if ($status.Installed) { + if (-not (Show-Confirm 'Reinstalar desde repositorio')) { return } + Invoke-Uninstall + } + + Write-Host '' + Write-Host (" Instalando desde: {0}" -f $TemplatesFolder) -ForegroundColor DarkGray + & dotnet new install $TemplatesFolder + if ($LASTEXITCODE -eq 0) { + Write-Host '' + Write-Host ' [OK] Plantillas instaladas desde el repositorio.' -ForegroundColor Green + } + else { + Write-Host '' + Write-Host ' [ERROR] Fallo al instalar desde el repositorio.' -ForegroundColor Red + } + Wait-BackToMenu +} + +function Install-FromPackage { + $status = Get-InstallationStatus + if ($status.Installed) { + if (-not (Show-Confirm 'Reinstalar desde paquete NuGet')) { return } + Invoke-Uninstall + } + + $nupkgBase = Join-Path $TemplatesFolder 'bin' + $files = @(Get-ChildItem -Path $nupkgBase -Filter '*.nupkg' -Recurse -ErrorAction SilentlyContinue | + Where-Object { $_.Name -notmatch '\.(symbols|snupkg)\.nupkg$' }) + + $pkg = $null + + if ($files.Count -eq 0) { + Write-Host '' + Write-Host ' No se encontraron paquetes .nupkg en src\ProjectTemplates\bin' -ForegroundColor Yellow + Write-Host '' + Write-Host ' [1] Escribir ruta manualmente' + Write-Host ' [2] Volver al menu' + Write-Host '' + $c = Read-Host ' Selecciona [1-2]' + if ($c.Trim() -eq '1') { + $pkg = (Read-Host ' Ruta del paquete .nupkg').Trim().Trim('"') + if (-not (Test-Path -LiteralPath $pkg)) { + Write-Host ' [ERROR] La ruta no existe.' -ForegroundColor Red + Wait-BackToMenu + return + } + } + else { + return + } + } + elseif ($files.Count -eq 1) { + $pkg = $files[0].FullName + } + else { + Write-Host '' + Write-Host ' Paquetes encontrados:' + for ($i = 0; $i -lt $files.Count; $i++) { + Write-Host (" [{0}] {1}" -f ($i + 1), $files[$i].Name) + } + Write-Host '' + $c = Read-Host (" Selecciona paquete [1-{0}]" -f $files.Count) + $idx = 0 + if ([int]::TryParse($c.Trim(), [ref]$idx) -and $idx -ge 1 -and $idx -le $files.Count) { + $pkg = $files[$idx - 1].FullName + } + else { + Write-Host ' [ERROR] Seleccion no valida.' -ForegroundColor Red + Wait-BackToMenu + return + } + } + + if ($null -ne $pkg -and $pkg -ne '') { + Write-Host '' + Write-Host (" Instalando desde: {0}" -f $pkg) -ForegroundColor DarkGray + & dotnet new install $pkg + if ($LASTEXITCODE -eq 0) { + Write-Host '' + Write-Host ' [OK] Plantillas instaladas desde el paquete.' -ForegroundColor Green + } + else { + Write-Host '' + Write-Host ' [ERROR] Fallo al instalar desde el paquete.' -ForegroundColor Red + } + } + Wait-BackToMenu +} + +function Uninstall-Templates { + $status = Get-InstallationStatus + if (-not $status.Installed) { + Write-Host ' No hay plantillas instaladas.' -ForegroundColor Yellow + Wait-BackToMenu + return + } + if (-not (Show-Confirm 'Desinstalar')) { return } + Invoke-Uninstall + Write-Host '' + Write-Host ' [OK] Plantillas desinstaladas.' -ForegroundColor Green + Wait-BackToMenu +} + +# ================= Ejecucion ================= +if (-not (Test-DotNet)) { + Write-Host '' + Write-Host ' [ERROR] dotnet no encontrado en el PATH.' -ForegroundColor Red + Write-Host ' Instala el .NET SDK y vuelve a intentarlo.' + Write-Host '' + exit 1 +} + +$running = $true +while ($running) { + Show-Header + $status = Get-InstallationStatus + Show-Status $status + $choice = Show-MainMenu + + switch ($choice) { + '1' { Install-FromRepo } + '2' { Install-FromPackage } + '3' { Uninstall-Templates } + 'quit' { $running = $false } + default { + Write-Host '' + Write-Host ' [ERROR] Opcion no valida.' -ForegroundColor Red + Start-Sleep -Milliseconds 900 + } + } +} diff --git a/src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj b/src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj index 49c02e1..dafac34 100644 --- a/src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj +++ b/src/EasyWindowsApplication.Generators/EasyWindowsApplication.Generators.csproj @@ -9,6 +9,7 @@ $(NoWarn);RS2008 true true + false True EasyWindowsApplication.Generators @@ -42,4 +43,8 @@ + + + + diff --git a/src/ProjectTemplates/EasyWinApp/.template.config/template.json b/src/ProjectTemplates/EasyWinApp/.template.config/template.json index 62b7458..a42bfa3 100644 --- a/src/ProjectTemplates/EasyWinApp/.template.config/template.json +++ b/src/ProjectTemplates/EasyWinApp/.template.config/template.json @@ -25,6 +25,38 @@ "datatype": "bool", "defaultValue": "true", "description": "Mantiene el Layout en secciones (Resources/Layout/Behavior). Si se desactiva (--Simple false), descompone el Layout en Views/Controls. Experimental hasta el rework sem\u00E1ntico del generador." + }, + "ProjectReferenceCore": { + "type": "generated", + "generator": "constant", + "parameters": { + "value": "" + }, + "replaces": "" + }, + "ProjectReferenceGenerators": { + "type": "generated", + "generator": "constant", + "parameters": { + "value": "" + }, + "replaces": "" + }, + "EasyWAProj": { + "type": "generated", + "generator": "constant", + "parameters": { + "value": "" + }, + "replaces": "<_EasyWAProj>$(MSBuildProjectDirectory)\\..\\..\\EasyWindowsApplication\\EasyWindowsApplication.csproj" + }, + "IcoGenReference": { + "type": "generated", + "generator": "constant", + "parameters": { + "value": "<PackageReference Include="RandAMediaLabGroup.EasyWindowsApplication" Version="%2A-%2A" />" + }, + "replaces": "<ProjectReference Include="$(_EasyWAProj)" />" } }, "sources": [ diff --git a/src/ProjectTemplates/EasyWinApp/EasyWinApp.csproj b/src/ProjectTemplates/EasyWinApp/EasyWinApp.csproj index c986b96..0c0e996 100644 --- a/src/ProjectTemplates/EasyWinApp/EasyWinApp.csproj +++ b/src/ProjectTemplates/EasyWinApp/EasyWinApp.csproj @@ -15,9 +15,7 @@ - + diff --git a/src/ProjectTemplates/EasyWinApp/logo_projecttemplates_easywinapp.png b/src/ProjectTemplates/EasyWinApp/logo_projecttemplates_easywinapp.png deleted file mode 120000 index 74db9ef..0000000 --- a/src/ProjectTemplates/EasyWinApp/logo_projecttemplates_easywinapp.png +++ /dev/null @@ -1 +0,0 @@ -../../../rsc/Images/logo_projecttemplates_easywinapp.png \ No newline at end of file diff --git a/src/ProjectTemplates/EasyWinApp/logo_projecttemplates_easywinapp.png b/src/ProjectTemplates/EasyWinApp/logo_projecttemplates_easywinapp.png new file mode 100644 index 0000000..0f5f605 Binary files /dev/null and b/src/ProjectTemplates/EasyWinApp/logo_projecttemplates_easywinapp.png differ diff --git a/src/ProjectTemplates/ProjectTemplates.csproj b/src/ProjectTemplates/ProjectTemplates.csproj new file mode 100644 index 0000000..e6490f2 --- /dev/null +++ b/src/ProjectTemplates/ProjectTemplates.csproj @@ -0,0 +1,28 @@ + + + + netstandard2.0 + true + false + content + Template + EasyWindowsApplication.Templates + RandAMediaLabGroup.EasyWindowsApplication.Templates + 0.0.0 + cl2raul66 + RandAMediaLabGroup + Plantillas dotnet new (easywinapp / simpleeasywinapp) para el framework EasyWindowsApplication + template; win32; windows-application; easy-windows-application; easywinapp; simpleeasywinapp + MIT + True + https://github.com/cl2raul66/EasyWindowsApplication + https://github.com/cl2raul66/EasyWindowsApplication + + + + + + + + + \ No newline at end of file diff --git a/src/ProjectTemplates/SimpleEasyWinApp/.template.config/template.json b/src/ProjectTemplates/SimpleEasyWinApp/.template.config/template.json index 6aaaf40..63debea 100644 --- a/src/ProjectTemplates/SimpleEasyWinApp/.template.config/template.json +++ b/src/ProjectTemplates/SimpleEasyWinApp/.template.config/template.json @@ -19,6 +19,38 @@ "description": "Target framework", "replaces": "net10.0-windows10.0.19041.0", "defaultValue": "net10.0-windows10.0.19041.0" + }, + "ProjectReferenceCore": { + "type": "generated", + "generator": "constant", + "parameters": { + "value": "" + }, + "replaces": "" + }, + "ProjectReferenceGenerators": { + "type": "generated", + "generator": "constant", + "parameters": { + "value": "" + }, + "replaces": "" + }, + "EasyWAProj": { + "type": "generated", + "generator": "constant", + "parameters": { + "value": "" + }, + "replaces": "<_EasyWAProj>$(MSBuildProjectDirectory)\\..\\..\\EasyWindowsApplication\\EasyWindowsApplication.csproj" + }, + "IcoGenReference": { + "type": "generated", + "generator": "constant", + "parameters": { + "value": "<PackageReference Include="RandAMediaLabGroup.EasyWindowsApplication" Version="%2A-%2A" />" + }, + "replaces": "<ProjectReference Include="$(_EasyWAProj)" />" } }, "sources": [ diff --git a/src/ProjectTemplates/SimpleEasyWinApp/SimpleEasyWinApp.csproj b/src/ProjectTemplates/SimpleEasyWinApp/SimpleEasyWinApp.csproj index 9b1a1a5..7c51e20 100644 --- a/src/ProjectTemplates/SimpleEasyWinApp/SimpleEasyWinApp.csproj +++ b/src/ProjectTemplates/SimpleEasyWinApp/SimpleEasyWinApp.csproj @@ -15,9 +15,7 @@ - + diff --git a/src/ProjectTemplates/SimpleEasyWinApp/logo_projecttemplates_easywinapp.png b/src/ProjectTemplates/SimpleEasyWinApp/logo_projecttemplates_easywinapp.png deleted file mode 120000 index 74db9ef..0000000 --- a/src/ProjectTemplates/SimpleEasyWinApp/logo_projecttemplates_easywinapp.png +++ /dev/null @@ -1 +0,0 @@ -../../../rsc/Images/logo_projecttemplates_easywinapp.png \ No newline at end of file diff --git a/src/ProjectTemplates/SimpleEasyWinApp/logo_projecttemplates_easywinapp.png b/src/ProjectTemplates/SimpleEasyWinApp/logo_projecttemplates_easywinapp.png new file mode 100644 index 0000000..0f5f605 Binary files /dev/null and b/src/ProjectTemplates/SimpleEasyWinApp/logo_projecttemplates_easywinapp.png differ diff --git a/src/Sample/Program.cs b/src/Sample/Program.cs index 2e5e305..ee5d6b3 100644 --- a/src/Sample/Program.cs +++ b/src/Sample/Program.cs @@ -30,6 +30,6 @@ { counter++; bh.LbShowIncrement.Text = $"{counter} Increment"; - }); + }); }) .Initialize();