Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
89af177
Add Convert-FileEncoding utility
PrzemyslawKlys Jun 12, 2025
6396ced
Improve encoding conversion
PrzemyslawKlys Jun 12, 2025
52fbe20
Add WhatIf support
PrzemyslawKlys Jun 12, 2025
5d1a05e
Add rollback verification for encoding conversion
PrzemyslawKlys Jun 12, 2025
cc6ba23
feat: improve encoding conversion
PrzemyslawKlys Jun 12, 2025
a8fe181
Fix catch error message
PrzemyslawKlys Jun 12, 2025
674bad3
Add Pester tests for Convert-FileEncoding
PrzemyslawKlys Jun 12, 2025
c6fbcee
Improve encoding detection and conversion
PrzemyslawKlys Jun 12, 2025
d24dd5e
Document skipping when file already in target encoding
PrzemyslawKlys Jun 15, 2025
8582093
test: verify Get-FileEncoding default output
PrzemyslawKlys Jun 27, 2025
121a1c7
Adjust Get-FileEncoding output
PrzemyslawKlys Jun 27, 2025
c540f54
refactor: optimize ShouldProcess placement
PrzemyslawKlys Jun 27, 2025
3fd9627
refactor: ✨ restructure Build-Module script
PrzemyslawKlys Jul 7, 2025
e2961f1
docs: ✨ add documentation for project encoding and line ending cmdlets
PrzemyslawKlys Jul 7, 2025
d0ab660
feat: ✨ add Example.TestEncoding script for folder encoding analysis
PrzemyslawKlys Jul 7, 2025
236bcbb
refactor: 🔥 remove `Convert-FileEncoding` function
PrzemyslawKlys Jul 7, 2025
643aeb4
feat: ✨ add `Convert-FileEncoding` function for file encoding conversion
PrzemyslawKlys Jul 7, 2025
090bda8
refactor: 🔥 enhance `Convert-FileEncodingSingle` function with improv…
PrzemyslawKlys Jul 7, 2025
1501949
feat: ✨ add `Convert-FolderEncoding` function for batch file encoding…
PrzemyslawKlys Jul 7, 2025
dfc3330
feat: ✨ add `Convert-LineEndingSingle` function for line ending conve…
PrzemyslawKlys Jul 7, 2025
de852c6
feat: ✨ add `Get-CurrentLineEnding` function for detecting line endings
PrzemyslawKlys Jul 7, 2025
b2ad32c
refactor: 🔥 improve `Get-FileEncoding` function documentation and enc…
PrzemyslawKlys Jul 7, 2025
18aff53
feat: ✨ add `Get-FolderEncoding` function for analyzing file encodings
PrzemyslawKlys Jul 7, 2025
20772d7
feat: ✨ add `Get-LineEndingType` function for detecting line endings
PrzemyslawKlys Jul 7, 2025
583af38
refactor: 🔥 improve documentation and structure of `Resolve-Encoding`…
PrzemyslawKlys Jul 7, 2025
8b87cf4
feat: ✨ add `Convert-ProjectEncoding` function for encoding conversion
PrzemyslawKlys Jul 7, 2025
5c1833c
feat: ✨ add `Convert-ProjectLineEnding` function for line ending conv…
PrzemyslawKlys Jul 7, 2025
ee83243
feat: ✨ add `Get-ProjectConsistency` function for comprehensive proje…
PrzemyslawKlys Jul 7, 2025
c06d833
feat: ✨ add `Get-ProjectEncoding` function for analyzing encoding con…
PrzemyslawKlys Jul 7, 2025
2b5d462
feat: ✨ add `Get-ProjectLineEnding` function for analyzing line endin…
PrzemyslawKlys Jul 7, 2025
5a314ce
feat(tests): ✨ update tests for `Convert-ProjectEncoding`
PrzemyslawKlys Jul 7, 2025
16dc88e
feat: ✨ update `FunctionsToExport` and increment `ModuleVersion`
PrzemyslawKlys Jul 7, 2025
c11eb5f
feat: ✨ add `Get-RelativePath` function for PowerShell 5.1 compatibility
PrzemyslawKlys Jul 7, 2025
8b430b1
feat: ✨ update `Resolve-Encoding` function to support 'Any' encoding
PrzemyslawKlys Jul 7, 2025
d866f66
feat: ✨ enhance `Convert-ProjectEncoding` to support 'Any' source enc…
PrzemyslawKlys Jul 7, 2025
c9c2982
feat: ✨ update `Convert-ProjectLineEnding` to use `Get-RelativePath` …
PrzemyslawKlys Jul 7, 2025
78d7f14
feat: ✨ update `Get-ProjectLineEnding` to use `Get-RelativePath` for …
PrzemyslawKlys Jul 7, 2025
7b98a61
feat: ✨ update `Get-ProjectEncoding` to use `Get-RelativePath` for pa…
PrzemyslawKlys Jul 7, 2025
d5c5fdc
feat: ✨ add examples for encoding and line ending conversions
PrzemyslawKlys Jul 7, 2025
3ef0f1e
feat: ✨ enhance examples for project encoding and line ending convers…
PrzemyslawKlys Jul 7, 2025
4857280
Merge branch 'master' into create-encoding-conversion-function-in-pub…
PrzemyslawKlys Jul 7, 2025
84066a2
feat: ✨ conditionally enable module signing based on computer name
PrzemyslawKlys Jul 7, 2025
6cf6b4b
test: 🧪 update tests to use module import with PassThru for Get-FileE…
PrzemyslawKlys Jul 7, 2025
4ecf668
feat(docs): ✨ update examples and parameters for `Convert-ProjectEnco…
PrzemyslawKlys Jul 7, 2025
304dce5
fix(Build-Module): 🐛 remove unnecessary `Clear-Host` command
PrzemyslawKlys Jul 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 50 additions & 19 deletions Build/Build-Module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
# since PSD1 is not required for proper rebuilding, we use PSM1 for this module only
# most modules should be run via PSD1 or by it's name (which in the background uses PD1)

# This version is used for GitHub Actions and is used to build the module

# This version is for local building
# We need to rmeove library before we start, as it may contain old files, which will be in use once PSD1 loads
# This is only required for PSPublisModule, as it's the only module that is being built by itself
Remove-Item -Path "C:\Support\GitHub\PSPublishModule\Lib" -Recurse -Force -ErrorAction SilentlyContinue

Import-Module ([io.path]::Combine($PSScriptRoot, '..', 'PSPublishModule.psd1')) -Force
Import-Module "$PSScriptRoot\..\PSPublishModule.psd1" -Force

Build-Module -ModuleName 'PSPublishModule' {
# Usual defaults as per standard module
Expand Down Expand Up @@ -61,17 +60,17 @@ Build-Module -ModuleName 'PSPublishModule' {
'New-FileCatalog'
)


$ConfigurationFormat = [ordered] @{
RemoveComments = $false
RemoveComments = $true
RemoveEmptyLines = $true

PlaceOpenBraceEnable = $true
PlaceOpenBraceOnSameLine = $true
PlaceOpenBraceNewLineAfter = $true
PlaceOpenBraceIgnoreOneLineBlock = $false

PlaceCloseBraceEnable = $true
PlaceCloseBraceNewLineAfter = $false
PlaceCloseBraceNewLineAfter = $true
PlaceCloseBraceIgnoreOneLineBlock = $false
PlaceCloseBraceNoEmptyLineBefore = $true

Expand Down Expand Up @@ -103,30 +102,30 @@ Build-Module -ModuleName 'PSPublishModule' {
New-ConfigurationFormat -ApplyTo 'DefaultPSD1', 'OnMergePSD1' -PSD1Style 'Minimal'

# configuration for documentation, at the same time it enables documentation processing
New-ConfigurationDocumentation -Enable:$true -StartClean -UpdateWhenNew -PathReadme ([io.path]::Combine('Docs', 'Readme.md')) -Path 'Docs' -Tool HelpOut
New-ConfigurationDocumentation -Enable:$true -StartClean -UpdateWhenNew -PathReadme 'Docs\Readme.md' -Path 'Docs'

New-ConfigurationImportModule -ImportSelf

$newConfigurationBuildSplat = @{
Enable = $true
# temporary not signing
SignModule = $false
SignModule = if ($Env:COMPUTERNAME -eq 'EVOMONSTER') { $true } else { $false }
DeleteTargetModuleBeforeBuild = $true
MergeModuleOnBuild = $true
CertificateThumbprint = ''
CertificateThumbprint = '483292C9E317AA13B07BB7A96AE9D1A5ED9E7703'
#CertificatePFXBase64 = $BasePfx
#CertificatePFXPassword = "zGT"
DoNotAttemptToFixRelativePaths = $false
SkipBuiltinReplacements = $true

# required for Cmdlet/Alias functionality
NETProjectPath = [io.path]::Combine($PSScriptRoot, '..', 'Sources', 'PSPublishModule')
NETProjectPath = "$PSScriptRoot\..\Sources\PSPublishModule"
ResolveBinaryConflicts = $true
ResolveBinaryConflictsName = 'PSPublishModule'
NETProjectName = 'PSPublishModule'
NETConfiguration = 'Release'
NETFramework = 'net8.0', 'net472'
NETHandleAssemblyWithSameName = $true
#NETDocumentation = $true
DotSourceLibraries = $true
DotSourceClasses = $true

Expand All @@ -136,22 +135,54 @@ Build-Module -ModuleName 'PSPublishModule' {

New-ConfigurationBuild @newConfigurationBuildSplat

New-ConfigurationArtefact -Type Unpacked -Enable -Path ([io.path]::Combine($PSScriptRoot, '..', 'Artefacts', 'Unpacked', '<TagModuleVersionWithPreRelease>')) -RequiredModulesPath ([io.path]::Combine($PSScriptRoot, '..', 'Artefacts', 'Unpacked', '<TagModuleVersionWithPreRelease>', 'Modules')) -AddRequiredModules -CopyFiles @{
"Examples/Step01.CreateModuleProject.ps1" = "Examples/Step01.CreateModuleProject.ps1"
"Examples/Step02.BuildModuleOver.ps1" = "Examples/Step02.BuildModuleOver.ps1"
New-ConfigurationArtefact -Type Unpacked -Enable -Path "$PSScriptRoot\..\Artefacts\Unpacked\<TagModuleVersionWithPreRelease>" -RequiredModulesPath "$PSScriptRoot\..\Artefacts\Unpacked\<TagModuleVersionWithPreRelease>\Modules" -AddRequiredModules -CopyFiles @{
"Examples\Step01.CreateModuleProject.ps1" = "Examples\Step01.CreateModuleProject.ps1"
"Examples\Step02.BuildModuleOver.ps1" = "Examples\Step02.BuildModuleOver.ps1"
} -CopyFilesRelative

New-ConfigurationArtefact -Type Packed -Enable -Path ([io.path]::Combine($PSScriptRoot, '..', 'Artefacts', 'PackedWithModules')) -IncludeTagName -ID 'ToGitHub' -AddRequiredModules -CopyFiles @{
"Examples/Step01.CreateModuleProject.ps1" = "Examples/Step01.CreateModuleProject.ps1"
"Examples/Step02.BuildModuleOver.ps1" = "Examples/Step02.BuildModuleOver.ps1"
New-ConfigurationArtefact -Type Packed -Enable -Path "$PSScriptRoot\..\Artefacts\PackedWithModules" -IncludeTagName -ID 'ToGitHub' -AddRequiredModules -CopyFiles @{
"Examples\Step01.CreateModuleProject.ps1" = "Examples\Step01.CreateModuleProject.ps1"
"Examples\Step02.BuildModuleOver.ps1" = "Examples\Step02.BuildModuleOver.ps1"
} -CopyFilesRelative -ArtefactName "PSPublishModule.<TagModuleVersionWithPreRelease>-FullPackage.zip"

New-ConfigurationArtefact -Type Packed -Enable -Path ([io.path]::Combine($PSScriptRoot, '..', 'Artefacts', 'Packed')) -IncludeTagName -ID 'ToGitHub' -ArtefactName "PSPublishModule.<TagModuleVersionWithPreRelease>.zip"
New-ConfigurationArtefact -Type Packed -Enable -Path "$PSScriptRoot\..\Artefacts\Packed" -IncludeTagName -ID 'ToGitHub' -ArtefactName "PSPublishModule.<TagModuleVersionWithPreRelease>.zip"

New-ConfigurationTest -TestsPath ([io.path]::Combine($PSScriptRoot, '..', 'Tests')) -Enable
New-ConfigurationTest -TestsPath "$PSScriptRoot\..\Tests" -Enable

# global options for publishing to github/psgallery
# you can use FilePath where APIKey are saved in clear text or use APIKey directly
#New-ConfigurationPublish -Type PowerShellGallery -FilePath 'C:\Support\Important\PowerShellGalleryAPI.txt' -Enabled:$true
#New-ConfigurationPublish -Type GitHub -FilePath 'C:\Support\Important\GitHubAPI.txt' -UserName 'EvotecIT' -Enabled:$true -ID 'ToGitHub' -OverwriteTagName '<TagModuleVersionWithPreRelease>'


### FOR TESTING PURPOSES ONLY ###
### SHOWING HOW THINGS WORK HERE ###

#New-ConfigurationArtefact -Type Packed -Enable -Path "$PSScriptRoot\..\Artefacts\Packed2" -IncludeTagName -ID 'Packed2'
#New-ConfigurationArtefact -Type Packed -Enable -Path "$PSScriptRoot\..\Artefacts\Packed1" -IncludeTagName

# those 2 are only useful for testing purposes
# New-ConfigurationArtefact -Type Script -Enable -Path "$PSScriptRoot\..\Artefacts\Script" -IncludeTagName {
# # Lets test this, this will be added in the bottom of the script
# Invoke-ModuleBuilder
# } -ID 'ToGitHubAsScript'
# New-ConfigurationArtefact -Type ScriptPacked -Enable -Path "$PSScriptRoot\..\Artefacts\ScriptPacked" -ArtefactName "Script-<ModuleName>-$((Get-Date).ToString('yyyy-MM-dd')).zip" {
# Invoke-ModuleBuilder
# } -PreScriptMerge {
# # Lets test this
# param (
# [int]$Mode
# )
# } -ScriptName 'Invoke-ModuleBuilder.ps1'
# New-ConfigurationArtefact -Type Script -Enable -Path "$PSScriptRoot\..\Artefacts\Script" {
# Invoke-ModuleBuilder
# } -PreScriptMerge {
# # Lets test this
# param (
# [int]$Mode
# )
# } -ScriptName 'Invoke-ModuleBuilder.ps1'

#New-ConfigurationPublish -Type GitHub -FilePath 'C:\Support\Important\GitHubAPI.txt' -UserName 'EvotecIT' -Enabled:$true -ID 'ToGitHubWithoutModules' -OverwriteTagName 'v1.8.0-Preview1'
#New-ConfigurationPublish -Type GitHub -FilePath 'C:\Support\Important\GitHubAPI.txt' -UserName 'EvotecIT' -Enabled:$true -ID 'ToGitHubAsScript'
} -ExitCode
190 changes: 0 additions & 190 deletions Build/Build-ModuleSimplified.ps1

This file was deleted.

Loading