From d2a57de84eaf9559f2dc6c2b7f191b304e5bf70f Mon Sep 17 00:00:00 2001 From: solomiofactura Date: Thu, 26 Sep 2024 09:26:56 +0000 Subject: [PATCH] added a postStartCommand --- .devcontainer/devcontainer.json | 2 +- .devcontainer/load-env.sh | 5 +++-- .../BlazorBundler/Set-EnvVars.psm1 | 6 ++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c268002..9900647 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,5 +17,5 @@ "ghcr.io/devcontainers/features/powershell:1": {} }, "postCreateCommand": "cd /workspaces/PersistedAssemblyBuilder.ConsoleApp/.devcontainer/ && sudo chmod +x initializebashfiles.sh && ./initializebashfiles.sh", - "postStartCommand": "" + "postStartCommand": "/bin/bash" } diff --git a/.devcontainer/load-env.sh b/.devcontainer/load-env.sh index 6de7341..3e7f0de 100644 --- a/.devcontainer/load-env.sh +++ b/.devcontainer/load-env.sh @@ -12,11 +12,12 @@ if [ -f "$ENV_FILE_PATH" ]; then key=$(echo "$key" | xargs) value=$(echo "$value" | xargs) export "$key=$value" + echo "export $key=\"$value\"" >> ~/.bashrc echo "Set $key = $value" # Debug output done < "$ENV_FILE_PATH" + # Apply the changes to the current session + source ~/.bashrc else echo "Environment file not found: $ENV_FILE_PATH" ls -l "$ENV_FILE_PATH" # Show file details fi - - diff --git a/PersistedAssemblyBuilder.ConsoleApp/BlazorBundler/Set-EnvVars.psm1 b/PersistedAssemblyBuilder.ConsoleApp/BlazorBundler/Set-EnvVars.psm1 index 9d8bfa6..6f9cda9 100644 --- a/PersistedAssemblyBuilder.ConsoleApp/BlazorBundler/Set-EnvVars.psm1 +++ b/PersistedAssemblyBuilder.ConsoleApp/BlazorBundler/Set-EnvVars.psm1 @@ -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 -NugetApiKey "YOUR_API_Key" -Publish $false -IsRelease $false -GitComment "Updated project with the latest changes" + Set-EnvVars -MajorVersion 3 -MinorVersion 1 -PatchVersion 8 -RevisionVersion 0 -Publish $false -IsRelease $false -GitComment "Updated project with the latest changes" To remove: Remove-Module -Name Set-EnvVars @@ -21,8 +21,6 @@ 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" @@ -53,7 +51,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 $NugetApiKey + Set-Item -Path "Env:NugetApiKey" -Value $Env:NugetApiKey Set-Item -Path "Env:Publish" -Value $Publish Set-Item -Path "Env:IsRelease" -Value $IsRelease Set-Item -Path "Env:GitComment" -Value $GitComment