Skip to content

Commit

Permalink
Updated BlazorBundler
Browse files Browse the repository at this point in the history
  • Loading branch information
solomiofactura committed Sep 26, 2024
1 parent 6452683 commit 7537949
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 20 deletions.
11 changes: 6 additions & 5 deletions PersistedAssemblyBuilder.ConsoleApp/BlazorBundler/.env
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Configuration=Release
MajorVersion=3
MinorVersion=1
PatchVersion=17
PatchVersion=18
RevisionVersion=0
Publish=True
IsRelease=True
GitComment=#8 - Added .env file to build targets file to copy it to the BlazorBundler folder.
AssemblyVersion=3.1.17.0
FileVersion=3.1.17.0
ChangelogPath=C:\repo\Blazor.Tools\Blazor.Tools.BlazorBundler\changelog_3.1.17.md
GitComment=#8 - Added PackageVersion to the saved environment variables.
PackageVersion=3.1.18
AssemblyVersion=3.1.18.0
FileVersion=3.1.18.0
ChangelogPath=C:\repo\Blazor.Tools\Blazor.Tools.BlazorBundler\changelog_3.1.18.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ Set-Content -Path $ProfilePath -Value $FilteredContent
# Add the new module import statements to the profile script
Add-Content -Path $ProfilePath -Value $ModuleImports


Write-Output "Finished setting up global module imports. Restart your PowerShell session to use them."
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<#
To test run:
Import-Module C:\repo\Blazor.Tools\Blazor.Tools.BlazorBundler\tools\Set-EnvVars.psm1
Set-EnvVars -MajorVersion 3 -MinorVersion 1 -PatchVersion 8 -RevisionVersion 0 -Publish $false -IsRelease $false -GitComment "Updated project with the latest changes"
Set-EnvVars -MajorVersion 3 -MinorVersion 1 -PatchVersion 8 -RevisionVersion 0 -NugetApiKey "YOUR_API_Key" -Publish $false -IsRelease $false -GitComment "Updated project with the latest changes"
To remove:
Remove-Module -Name Set-EnvVars
Expand All @@ -21,6 +21,8 @@ param(
[Parameter(Mandatory=$true)]
[string] $RevisionVersion,
[Parameter(Mandatory=$true)]
[string] $NugetApiKey,
[Parameter(Mandatory=$true)]
[bool] $Publish,
[bool] $IsRelease = $false,
[string] $GitComment = "Updated project with the latest changes"
Expand Down Expand Up @@ -51,7 +53,7 @@ param(
Set-Item -Path "Env:MinorVersion" -Value $MinorVersion
Set-Item -Path "Env:PatchVersion" -Value $PatchVersion
Set-Item -Path "Env:RevisionVersion" -Value $RevisionVersion
Set-Item -Path "Env:NugetApiKey" -Value $Env:NugetApiKey
Set-Item -Path "Env:NugetApiKey" -Value $NugetApiKey
Set-Item -Path "Env:Publish" -Value $Publish
Set-Item -Path "Env:IsRelease" -Value $IsRelease
Set-Item -Path "Env:GitComment" -Value $GitComment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,9 @@ param (
if (Test-Path $EnvFilePath) {
Get-Content $EnvFilePath | ForEach-Object {
if ($_ -match "^\s*([^#][^=]+?)\s*=\s*(.+?)\s*$") {
$key = $matches[1].Trim() # Trim any extra whitespace
$value = $matches[2].Trim() # Trim any extra whitespace
[System.Environment]::SetEnvironmentVariable($key, $value, [System.EnvironmentVariableTarget]::Process)
Write-Host "Set $key = $value" # Debug output
[System.Environment]::SetEnvironmentVariable($matches[1], $matches[2], [System.EnvironmentVariableTarget]::Process)
}
}

# Check all variables after setting
Write-Host "Current Environment Variables:"
Get-ChildItem env: | Where-Object { $_.Name -match 'Configuration|MajorVersion|MinorVersion|PatchVersion|RevisionVersion|Publish|IsRelease|GitComment|AssemblyVersion|FileVersion|ChangelogPath' }
} else {
Write-Host "Environment file not found: $EnvFilePath"
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Blazor.Tools.BlazorBundler" Version="3.1.17" />
<PackageReference Include="Blazor.Tools.BlazorBundler" Version="3.1.18" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion PersistedAssemblyBuilder.ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Used .net 9.0 Preview 7 framework for this and nuget package Blazor.Tools.Bundler version 3.1.12 (updated 9/26)
// Used .net 9.0 Preview 7 framework for this and nuget package Blazor.Tools.Bundler version 3.1.18 (updated 9/26)
using System.Reflection;
using System.Reflection.Emit;
using Blazor.Tools.BlazorBundler.Entities.SampleObjects.Models;
Expand Down
6 changes: 3 additions & 3 deletions PersistedAssemblyBuilder.ConsoleApp/Steps - Project Setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ error NU1101: Unable to find package Blazor.Tools.BlazorBundler.Entities.SampleO
::=============================================================================================================================================
How To Build this project.
::=============================================================================================================================================
$env:Version="3.1.14"
dotnet build --verbosity detailed /p:PackageVersion=$env:Version /p:Configuration="Release" /p:AssemblyVersion=$env:Version /p:FileVersion=$env:Version /p:Version=$env:Version
$env:PackageVersion="3.1.18"
dotnet build --verbosity detailed /p:PackageVersion=$env:PackageVersion /p:Configuration="Release" /p:AssemblyVersion=$env:PackageVersion /p:FileVersion=$env:PackageVersion /p:Version=$env:PackageVersion

::=============================================================================================================================================
How To Setup the Tools Module
Expand All @@ -110,7 +110,7 @@ How To Setup the Tools Module
In bash:
which pswh
export PATH=$PATH:/usr/bin/pwsh
export NugetApiKey="YOUR_API_KEY"
export NugetApiKey="YOUR_API_KEY" >> ~/.bashrc

in pwsh:
/usr/bin/pwsh -ExecutionPolicy Bypass -File "PersistedAssemblyBuilder.ConsoleApp/BlazorBundler/Get-Tools.ps1"

0 comments on commit 7537949

Please sign in to comment.