From 603c4da30b1c05b871c27a89b8b41faf37c83b57 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sun, 28 Nov 2021 19:04:23 +0100 Subject: [PATCH] fix(pwsh): publish module without irrelevant files --- .../powershell/{oh-my-posh => }/README.md | 0 packages/powershell/deploy.ps1 | 27 +++++++++++++++++++ .../{oh-my-posh => }/oh-my-posh.psd1 | 15 +++++++++++ .../{oh-my-posh => }/oh-my-posh.psm1 | 0 packages/powershell/oh-my-posh/deploy.ps1 | 24 ----------------- 5 files changed, 42 insertions(+), 24 deletions(-) rename packages/powershell/{oh-my-posh => }/README.md (100%) create mode 100644 packages/powershell/deploy.ps1 rename packages/powershell/{oh-my-posh => }/oh-my-posh.psd1 (99%) rename packages/powershell/{oh-my-posh => }/oh-my-posh.psm1 (100%) delete mode 100644 packages/powershell/oh-my-posh/deploy.ps1 diff --git a/packages/powershell/oh-my-posh/README.md b/packages/powershell/README.md similarity index 100% rename from packages/powershell/oh-my-posh/README.md rename to packages/powershell/README.md diff --git a/packages/powershell/deploy.ps1 b/packages/powershell/deploy.ps1 new file mode 100644 index 00000000..0eddea58 --- /dev/null +++ b/packages/powershell/deploy.ps1 @@ -0,0 +1,27 @@ +Param +( + [parameter(Mandatory=$true)] + [string] + $ModuleVersion, + [parameter(Mandatory=$true)] + [string] + $Repository, + [parameter(Mandatory=$false)] + [string] + $RepositoryAPIKey +) + +$moduleDir = "./oh-my-posh" +New-Item -Path $moduleDir -ItemType Directory +# set the actual version number +(Get-Content './oh-my-posh.psd1' -Raw).Replace('0.0.0.1', $ModuleVersion) | Out-File -Encoding 'UTF8' "$moduleDir/oh-my-posh.psd1" +Copy-Item "./oh-my-posh.psm1" -Destination $moduleDir +Push-Location -Path $moduleDir +# publish the module +if ($RepositoryAPIKey) { + Publish-Module -Path . -Repository $Repository -NuGetApiKey $RepositoryAPIKey -Verbose +} else { + Publish-Module -Path . -Repository $Repository -Verbose +} +Pop-Location +Remove-Item -Path $moduleDir -Force -Recurse diff --git a/packages/powershell/oh-my-posh/oh-my-posh.psd1 b/packages/powershell/oh-my-posh.psd1 similarity index 99% rename from packages/powershell/oh-my-posh/oh-my-posh.psd1 rename to packages/powershell/oh-my-posh.psd1 index 858718c3..b6449bf7 100644 --- a/packages/powershell/oh-my-posh/oh-my-posh.psd1 +++ b/packages/powershell/oh-my-posh.psd1 @@ -91,6 +91,21 @@ + + + + + + + + + + + + + + + diff --git a/packages/powershell/oh-my-posh/oh-my-posh.psm1 b/packages/powershell/oh-my-posh.psm1 similarity index 100% rename from packages/powershell/oh-my-posh/oh-my-posh.psm1 rename to packages/powershell/oh-my-posh.psm1 diff --git a/packages/powershell/oh-my-posh/deploy.ps1 b/packages/powershell/oh-my-posh/deploy.ps1 deleted file mode 100644 index 20d15f15..00000000 --- a/packages/powershell/oh-my-posh/deploy.ps1 +++ /dev/null @@ -1,24 +0,0 @@ -Param -( - [parameter(Mandatory=$true)] - [string] - $ModuleVersion, - [parameter(Mandatory=$true)] - [string] - $Repository, - [parameter(Mandatory=$false)] - [string] - $RepositoryAPIKey -) - -# set the actual version number -(Get-Content '.\oh-my-posh.psd1' -Raw).Replace('0.0.0.1', $ModuleVersion) | Out-File -Encoding 'UTF8' '.\oh-my-posh.psd1' -# publish the module -$exclude = @('README.md','deploy.ps1') -if ($RepositoryAPIKey) { - Publish-Module -Path . -Repository $Repository -NuGetApiKey $RepositoryAPIKey -Exclude $exclude -Verbose -} else { - Publish-Module -Path . -Repository $Repository -Exclude $exclude -Verbose -} -# reset module version (for local testing only as we don't want PR's with changed version numbers all the time) -(Get-Content '.\oh-my-posh.psd1' -Raw).Replace($ModuleVersion, '0.0.0.1') | Out-File -Encoding 'UTF8' '.\oh-my-posh.psd1'