From 5dbd5bdc3bbbffd06810711ba6c13fd89fe108cf Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sat, 30 Mar 2024 17:54:59 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A9=B9=20[Patch]:=20Simplify=20source=20c?= =?UTF-8?q?ode=20structure=20(#7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description - Simplify source code structure ## Type of change - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas --- .../linters/.powershell-psscriptanalyzer.psd1 | 17 ++++++++++ src/NerdFonts/NerdFonts.psd1 | 3 -- src/NerdFonts/NerdFonts.psm1 | 32 ------------------- src/{NerdFonts => }/private/common.ps1 | 0 src/{NerdFonts => }/public/Get-NerdFont.ps1 | 0 .../public/Install-NerdFont.ps1 | 0 6 files changed, 17 insertions(+), 35 deletions(-) create mode 100644 .github/linters/.powershell-psscriptanalyzer.psd1 delete mode 100644 src/NerdFonts/NerdFonts.psd1 delete mode 100644 src/NerdFonts/NerdFonts.psm1 rename src/{NerdFonts => }/private/common.ps1 (100%) rename src/{NerdFonts => }/public/Get-NerdFont.ps1 (100%) rename src/{NerdFonts => }/public/Install-NerdFont.ps1 (100%) diff --git a/.github/linters/.powershell-psscriptanalyzer.psd1 b/.github/linters/.powershell-psscriptanalyzer.psd1 new file mode 100644 index 0000000..570ac0d --- /dev/null +++ b/.github/linters/.powershell-psscriptanalyzer.psd1 @@ -0,0 +1,17 @@ +#Documentation: https://github.com/PowerShell/PSScriptAnalyzer/blob/master/docs/Cmdlets/Invoke-ScriptAnalyzer.md#-settings +@{ + #CustomRulePath='path\to\CustomRuleModule.psm1' + #RecurseCustomRulePath='path\of\customrules' + #Severity = @( + # 'Error' + # 'Warning' + #) + #IncludeDefaultRules=${true} + ExcludeRules = @( + 'PSMissingModuleManifestField' + ) + #IncludeRules = @( + # 'PSAvoidUsingWriteHost', + # 'MyCustomRuleName' + #) +} diff --git a/src/NerdFonts/NerdFonts.psd1 b/src/NerdFonts/NerdFonts.psd1 deleted file mode 100644 index 5f19855..0000000 --- a/src/NerdFonts/NerdFonts.psd1 +++ /dev/null @@ -1,3 +0,0 @@ -@{ - ModuleVersion = '0.0.1' -} diff --git a/src/NerdFonts/NerdFonts.psm1 b/src/NerdFonts/NerdFonts.psm1 deleted file mode 100644 index 573c80d..0000000 --- a/src/NerdFonts/NerdFonts.psm1 +++ /dev/null @@ -1,32 +0,0 @@ -[Cmdletbinding()] -param() - -Write-Verbose 'Importing subcomponents' -$Folders = 'classes', 'private', 'public' -# Import everything in these folders -Foreach ($Folder in $Folders) { - $Root = Join-Path -Path $PSScriptRoot -ChildPath $Folder - Write-Verbose "Processing folder: $Root" - if (Test-Path -Path $Root) { - Write-Verbose "Getting all files in $Root" - $Files = $null - $Files = Get-ChildItem -Path $Root -Include '*.ps1', '*.psm1' -Recurse - # dot source each file - foreach ($File in $Files) { - Write-Verbose "Importing $($File)" - Import-Module $File - Write-Verbose "Importing $($File): Done" - } - } -} - -$Param = @{ - Function = (Get-ChildItem -Path "$PSScriptRoot\public" -Include '*.ps1' -Recurse).BaseName - Variable = '*' - Cmdlet = '*' - Alias = '*' -} - -Write-Verbose 'Exporting module members' - -Export-ModuleMember @Param -Verbose diff --git a/src/NerdFonts/private/common.ps1 b/src/private/common.ps1 similarity index 100% rename from src/NerdFonts/private/common.ps1 rename to src/private/common.ps1 diff --git a/src/NerdFonts/public/Get-NerdFont.ps1 b/src/public/Get-NerdFont.ps1 similarity index 100% rename from src/NerdFonts/public/Get-NerdFont.ps1 rename to src/public/Get-NerdFont.ps1 diff --git a/src/NerdFonts/public/Install-NerdFont.ps1 b/src/public/Install-NerdFont.ps1 similarity index 100% rename from src/NerdFonts/public/Install-NerdFont.ps1 rename to src/public/Install-NerdFont.ps1