From 23cab14d90b4ba66707a465b2d5df310be8ce453 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Mon, 18 Mar 2024 15:48:43 +0900 Subject: [PATCH] Adjust structure to exclude no crucial runtime from the package (#15) Follow #12 and #4 --- .github/workflows/release.yml | 5 +- PSFzfHistory.psd1 | 138 ------------------------ PSFzfHistory/PSFzfHistory.psd1 | 133 +++++++++++++++++++++++ {src => PSFzfHistory}/PSFzfHistory.psm1 | 0 Taskfile.yml | 2 +- tests/PSFzfHistory.Tests.ps1 | 2 +- tools/lint-fix.ps1 | 2 +- tools/repl.ps1 | 2 +- 8 files changed, 140 insertions(+), 144 deletions(-) delete mode 100644 PSFzfHistory.psd1 create mode 100644 PSFzfHistory/PSFzfHistory.psd1 rename {src => PSFzfHistory}/PSFzfHistory.psm1 (100%) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff8c990..504eda2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ jobs: id: meta run: | Get-PSRepository - Write-Output "version=$((Import-PowerShellDataFile ./PSFzfHistory.psd1).ModuleVersion)" | Tee-Object -Append -FilePath ${env:GITHUB_OUTPUT} + Write-Output "version=$((Import-PowerShellDataFile ./PSFzfHistory/PSFzfHistory.psd1).ModuleVersion)" | Tee-Object -Append -FilePath ${env:GITHUB_OUTPUT} - name: Wait other jobs uses: kachick/wait-other-jobs@v2.0.3 timeout-minutes: 30 @@ -52,5 +52,6 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # TODO: Upload zipped *.ps* files as the assets + Copy-Item -Path .\README.md .\LICENSE -Destination .\PSFzfHistory + # TODO: Upload zipped PSFzfHistory files as the assets gh release create 'v${{ needs.gallery.outputs.version }}' --generate-notes diff --git a/PSFzfHistory.psd1 b/PSFzfHistory.psd1 deleted file mode 100644 index 6e3a91a..0000000 --- a/PSFzfHistory.psd1 +++ /dev/null @@ -1,138 +0,0 @@ -# -# Module manifest for module 'PSFzfHistory' -# -# Generated by: Kenichi Kamiya -# -# Generated on: 3/3/2024 -# - -@{ - -# Script module or binary module file associated with this manifest. -RootModule = 'src/PSFzfHistory.psm1' - -# Version number of this module. -ModuleVersion = '0.0.3' - -# Supported PSEditions -# CompatiblePSEditions = @() - -# ID used to uniquely identify this module -GUID = '13b2772e-89a1-43f0-93a2-373d4c4c1c62' - -# Author of this module -Author = 'Kenichi Kamiya' - -# Company or vendor of this module -CompanyName = 'Unknown' - -# Copyright statement for this module -Copyright = '(c) Kenichi Kamiya. All rights reserved.' - -# Description of the functionality provided by this module -Description = 'fzf history integration with small code' - -# Minimum version of the PowerShell engine required by this module -# Adjust with bundled PSReadLine -PowerShellVersion = '5.1' - -# Name of the PowerShell host required by this module -# PowerShellHostName = '' - -# Minimum version of the PowerShell host required by this module -# PowerShellHostVersion = '' - -# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# DotNetFrameworkVersion = '' - -# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. -# ClrVersion = '' - -# Processor architecture (None, X86, Amd64) required by this module -# ProcessorArchitecture = '' - -# Modules that must be imported into the global environment prior to importing this module -# RequiredModules = @() - -# Assemblies that must be loaded prior to importing this module -# RequiredAssemblies = @() - -# Script files (.ps1) that are run in the caller's environment prior to importing this module. -# ScriptsToProcess = @() - -# Type files (.ps1xml) to be loaded when importing this module -# TypesToProcess = @() - -# Format files (.ps1xml) to be loaded when importing this module -# FormatsToProcess = @() - -# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess -# NestedModules = @('src/PSFzfHistory.psm1') - -# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = @('Invoke-FzfHistory', 'Set-FzfHistoryKeybind') - -# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. -CmdletsToExport = @() - -# Variables to export from this module -VariablesToExport = '*' - -# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. -AliasesToExport = @() - -# DSC resources to export from this module -# DscResourcesToExport = @() - -# List of all modules packaged with this module -# ModuleList = @() - -# List of all files packaged with this module -FileList = @( - 'src/PSFzfHistory.psm1', - 'PSFzfHistory.psd1', - 'README.md', - 'LICENSE' -) - -# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. -PrivateData = @{ - - PSData = @{ - - # Tags applied to this module. These help with module discovery in online galleries. - Tags = @('history', 'fzf') - - # A URL to the license for this module. - LicenseUri = 'https://github.com/kachick/PSFzfHistory/blob/main/LICENSE' - - # A URL to the main website for this project. - ProjectUri = 'https://github.com/kachick/PSFzfHistory' - - # A URL to an icon representing this module. - # IconUri = '' - - # ReleaseNotes of this module - # ReleaseNotes = '' - - # Prerelease string of this module - # Prerelease = '' - - # Flag to indicate whether the module requires explicit user acceptance for install/update/save - # RequireLicenseAcceptance = $false - - # External dependent modules of this module - # ExternalModuleDependencies = @() - - } # End of PSData hashtable - -} # End of PrivateData hashtable - -# HelpInfo URI of this module -# HelpInfoURI = '' - -# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. -# DefaultCommandPrefix = '' - -} - diff --git a/PSFzfHistory/PSFzfHistory.psd1 b/PSFzfHistory/PSFzfHistory.psd1 new file mode 100644 index 0000000..e11ef07 --- /dev/null +++ b/PSFzfHistory/PSFzfHistory.psd1 @@ -0,0 +1,133 @@ +# +# Module manifest for module 'PSFzfHistory' +# +# Generated by: Kenichi Kamiya +# +# Generated on: 3/3/2024 +# + +@{ + + # Script module or binary module file associated with this manifest. + RootModule = 'PSFzfHistory.psm1' + + # Version number of this module. + ModuleVersion = '0.0.4' + + # Supported PSEditions + # CompatiblePSEditions = @() + + # ID used to uniquely identify this module + GUID = '13b2772e-89a1-43f0-93a2-373d4c4c1c62' + + # Author of this module + Author = 'Kenichi Kamiya' + + # Company or vendor of this module + CompanyName = 'Unknown' + + # Copyright statement for this module + Copyright = '(c) Kenichi Kamiya. All rights reserved.' + + # Description of the functionality provided by this module + Description = 'fzf history integration with small code' + + # Minimum version of the PowerShell engine required by this module + # Adjust with bundled PSReadLine + PowerShellVersion = '5.1' + + # Name of the PowerShell host required by this module + # PowerShellHostName = '' + + # Minimum version of the PowerShell host required by this module + # PowerShellHostVersion = '' + + # Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # DotNetFrameworkVersion = '' + + # Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only. + # ClrVersion = '' + + # Processor architecture (None, X86, Amd64) required by this module + # ProcessorArchitecture = '' + + # Modules that must be imported into the global environment prior to importing this module + # RequiredModules = @() + + # Assemblies that must be loaded prior to importing this module + # RequiredAssemblies = @() + + # Script files (.ps1) that are run in the caller's environment prior to importing this module. + # ScriptsToProcess = @() + + # Type files (.ps1xml) to be loaded when importing this module + # TypesToProcess = @() + + # Format files (.ps1xml) to be loaded when importing this module + # FormatsToProcess = @() + + # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess + # NestedModules = @('PSFzfHistory.psm1') + + # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. + FunctionsToExport = @('Invoke-FzfHistory', 'Set-FzfHistoryKeybind') + + # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. + CmdletsToExport = @() + + # Variables to export from this module + VariablesToExport = '*' + + # Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export. + AliasesToExport = @() + + # DSC resources to export from this module + # DscResourcesToExport = @() + + # List of all modules packaged with this module + # ModuleList = @() + + # List of all files packaged with this module + # FileList = @() + + # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ + + PSData = @{ + + # Tags applied to this module. These help with module discovery in online galleries. + Tags = @('history', 'fzf') + + # A URL to the license for this module. + LicenseUri = 'https://github.com/kachick/PSFzfHistory/blob/main/LICENSE' + + # A URL to the main website for this project. + ProjectUri = 'https://github.com/kachick/PSFzfHistory' + + # A URL to an icon representing this module. + # IconUri = '' + + # ReleaseNotes of this module + # ReleaseNotes = '' + + # Prerelease string of this module + # Prerelease = '' + + # Flag to indicate whether the module requires explicit user acceptance for install/update/save + # RequireLicenseAcceptance = $false + + # External dependent modules of this module + # ExternalModuleDependencies = @() + + } # End of PSData hashtable + + } # End of PrivateData hashtable + + # HelpInfo URI of this module + # HelpInfoURI = '' + + # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. + # DefaultCommandPrefix = '' + +} + diff --git a/src/PSFzfHistory.psm1 b/PSFzfHistory/PSFzfHistory.psm1 similarity index 100% rename from src/PSFzfHistory.psm1 rename to PSFzfHistory/PSFzfHistory.psm1 diff --git a/Taskfile.yml b/Taskfile.yml index 7cc2a2a..fe96b0a 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -17,7 +17,7 @@ tasks: # pwsh exit with 0 even if ReadLine made errors, the 1+ code is special for an example as parser error # So returns 1+ with the result by yourself in each cmd - pwsh --File ./tools/test-all.ps1 - - pwsh --Command 'Test-ModuleManifest -Path *.psd1' + - pwsh --Command 'Test-ModuleManifest -Path ./PSFzfHistory/*.psd1' fmt: cmds: - dprint fmt diff --git a/tests/PSFzfHistory.Tests.ps1 b/tests/PSFzfHistory.Tests.ps1 index 789e7ec..49d406a 100644 --- a/tests/PSFzfHistory.Tests.ps1 +++ b/tests/PSFzfHistory.Tests.ps1 @@ -1,4 +1,4 @@ -Import-Module -Name .\src\PSFzfHistory.psm1 +Import-Module -Name .\PSFzfHistory\PSFzfHistory.psm1 InModuleScope PSFzfHistory { Describe 'AsOrderedSet' { diff --git a/tools/lint-fix.ps1 b/tools/lint-fix.ps1 index 16d460a..c316045 100644 --- a/tools/lint-fix.ps1 +++ b/tools/lint-fix.ps1 @@ -1,6 +1,6 @@ # Do NOT use 'Invoke-ScriptAnalyzer -Recurse -Path .' It includes dotfiles as .direnv # https://github.com/PowerShell/PSScriptAnalyzer/issues/561 -Get-ChildItem -Recurse -Path src -Include "*.ps*1" | +Get-ChildItem -Recurse -Path PSFzfHistory -Include "*.ps*1" | ForEach-Object { Write-Output $_.FullName Invoke-ScriptAnalyzer -Recurse -ReportSummary -EnableExit -Settings CodeFormatting -Fix -Path $_.FullName diff --git a/tools/repl.ps1 b/tools/repl.ps1 index 0ab8d8c..6f8825f 100644 --- a/tools/repl.ps1 +++ b/tools/repl.ps1 @@ -1 +1 @@ -Import-Module -Name .\src\PSFzfHistory.psm1 +Import-Module -Name .\PSFzfHistory\PSFzfHistory.psm1