Skip to content

Commit 736c401

Browse files
Update module builder
1 parent 1e8a0e4 commit 736c401

File tree

1 file changed

+89
-175
lines changed

1 file changed

+89
-175
lines changed

Build/Manage-PowerBGInfo.ps1

Lines changed: 89 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -1,179 +1,93 @@
11
Clear-Host
22

3-
Import-Module "C:\Support\GitHub\PSPublishModule\PSPublishModule.psd1" -Force
4-
5-
$Configuration = @{
6-
Information = @{
7-
ModuleName = 'PowerBGInfo'
8-
DirectoryProjects = 'C:\Support\GitHub'
9-
10-
Manifest = @{
11-
# Minimum version of the Windows PowerShell engine required by this module
12-
PowerShellVersion = '5.1'
13-
# prevent using over CORE/PS 7
14-
CompatiblePSEditions = @('Desktop', 'Core')
15-
# ID used to uniquely identify this module
16-
GUID = '91b9c52d-6a39-4a65-a276-409b9390ee04'
17-
# Version number of this module.
18-
ModuleVersion = '0.0.X'
19-
# Author of this module
20-
Author = 'Przemyslaw Klys'
21-
# Company or vendor of this module
22-
CompanyName = 'Evotec'
23-
# Copyright statement for this module
24-
Copyright = "(c) 2011 - $((Get-Date).Year) Przemyslaw Klys @ Evotec. All rights reserved."
25-
# Description of the functionality provided by this module
26-
Description = 'PowerBGInfo is a module that allows you to create background images with information about your environment.'
27-
# Tags applied to this module. These help with module discovery in online galleries.
28-
Tags = @('windows', 'image', 'monitor', 'bginfo')
29-
# A URL to the main website for this project.
30-
ProjectUri = 'https://github.com/EvotecIT/PowerBGInfo'
31-
32-
IconUri = 'https://evotec.xyz/wp-content/uploads/2022/12/PowerBGInfo.png'
33-
34-
LicenseUri = 'https://github.com/EvotecIT/PowerBGInfo/blob/master/License'
35-
36-
RequiredModules = @(
37-
@{ ModuleName = 'DesktopManager'; ModuleVersion = "Latest"; Guid = '56f85fa6-c622-4204-8e97-3d99e3e06e75' }
38-
@{ ModuleName = 'ImagePlayground'; ModuleVersion = "Latest"; Guid = 'ff5469f2-c542-4318-909e-fd054d16821f' }
39-
@{ ModuleName = 'PSSharedGoods'; ModuleVersion = 'Latest'; Guid = 'ee272aa8-baaa-4edf-9f45-b6d6f7d844fe' }
40-
)
41-
DotNetFrameworkVersion = '4.7.2'
42-
}
3+
Invoke-ModuleBuild -ModuleName 'PowerBGInfo' {
4+
# Usual defaults as per standard module
5+
$Manifest = [ordered] @{
6+
# Minimum version of the Windows PowerShell engine required by this module
7+
PowerShellVersion = '5.1'
8+
# prevent using over CORE/PS 7
9+
CompatiblePSEditions = @('Desktop', 'Core')
10+
# ID used to uniquely identify this module
11+
GUID = '91b9c52d-6a39-4a65-a276-409b9390ee04'
12+
# Version number of this module.
13+
ModuleVersion = '0.0.X'
14+
# Author of this module
15+
Author = 'Przemyslaw Klys'
16+
# Company or vendor of this module
17+
CompanyName = 'Evotec'
18+
# Copyright statement for this module
19+
Copyright = "(c) 2011 - $((Get-Date).Year) Przemyslaw Klys @ Evotec. All rights reserved."
20+
# Description of the functionality provided by this module
21+
Description = 'PowerBGInfo is a module that allows you to create background images with information about your environment.'
22+
# Tags applied to this module. These help with module discovery in online galleries.
23+
Tags = @('windows', 'image', 'monitor', 'bginfo')
24+
# A URL to the main website for this project.
25+
ProjectUri = 'https://github.com/EvotecIT/PowerBGInfo'
26+
27+
IconUri = 'https://evotec.xyz/wp-content/uploads/2022/12/PowerBGInfo.png'
28+
29+
LicenseUri = 'https://github.com/EvotecIT/PowerBGInfo/blob/master/License'
30+
31+
DotNetFrameworkVersion = '4.7.2'
4332
}
44-
Options = @{
45-
Merge = @{
46-
Sort = 'None'
47-
FormatCodePSM1 = @{
48-
Enabled = $true
49-
RemoveComments = $true
50-
FormatterSettings = @{
51-
IncludeRules = @(
52-
'PSPlaceOpenBrace',
53-
'PSPlaceCloseBrace',
54-
'PSUseConsistentWhitespace',
55-
'PSUseConsistentIndentation',
56-
'PSAlignAssignmentStatement',
57-
'PSUseCorrectCasing'
58-
)
59-
60-
Rules = @{
61-
PSPlaceOpenBrace = @{
62-
Enable = $true
63-
OnSameLine = $true
64-
NewLineAfter = $true
65-
IgnoreOneLineBlock = $true
66-
}
67-
68-
PSPlaceCloseBrace = @{
69-
Enable = $true
70-
NewLineAfter = $false
71-
IgnoreOneLineBlock = $true
72-
NoEmptyLineBefore = $false
73-
}
74-
75-
PSUseConsistentIndentation = @{
76-
Enable = $true
77-
Kind = 'space'
78-
PipelineIndentation = 'IncreaseIndentationAfterEveryPipeline'
79-
IndentationSize = 4
80-
}
81-
82-
PSUseConsistentWhitespace = @{
83-
Enable = $true
84-
CheckInnerBrace = $true
85-
CheckOpenBrace = $true
86-
CheckOpenParen = $true
87-
CheckOperator = $true
88-
CheckPipe = $true
89-
CheckSeparator = $true
90-
}
91-
92-
PSAlignAssignmentStatement = @{
93-
Enable = $true
94-
CheckHashtable = $true
95-
}
96-
97-
PSUseCorrectCasing = @{
98-
Enable = $true
99-
}
100-
}
101-
}
102-
}
103-
FormatCodePSD1 = @{
104-
Enabled = $true
105-
RemoveComments = $false
106-
}
107-
Integrate = @{
108-
ApprovedModules = @('PSSharedGoods', 'PSWriteColor', 'Connectimo', 'PSUnifi', 'PSWebToolbox', 'PSMyPassword')
109-
}
110-
}
111-
Standard = @{
112-
FormatCodePSM1 = @{
113-
114-
}
115-
FormatCodePSD1 = @{
116-
Enabled = $true
117-
#RemoveComments = $true
118-
}
119-
}
120-
PowerShellGallery = @{
121-
ApiKey = 'C:\Support\Important\PowerShellGalleryAPI.txt'
122-
FromFile = $true
123-
}
124-
GitHub = @{
125-
ApiKey = 'C:\Support\Important\GithubAPI.txt'
126-
FromFile = $true
127-
UserName = 'EvotecIT'
128-
#RepositoryName = 'PSWriteHTML'
129-
}
130-
Documentation = @{
131-
Path = 'Docs'
132-
PathReadme = 'Docs\Readme.md'
133-
}
33+
New-ConfigurationManifest @Manifest
34+
35+
New-ConfigurationModule -Type RequiredModule -Name 'PSSharedGoods' -Guid Auto -Version Latest
36+
New-ConfigurationModule -Type RequiredModule -Name 'DesktopManager' -Guid Auto -Version '0.0.3'
37+
New-ConfigurationModule -Type RequiredModule -Name 'ImagePlayground' -Guid Auto -Version '0.0.8'
38+
New-ConfigurationModule -Type ApprovedModule -Name 'PSSharedGoods', 'PSWriteColor', 'Connectimo', 'PSUnifi', 'PSWebToolbox', 'PSMyPassword', 'PSPublishModule'
39+
New-ConfigurationModuleSkip -IgnoreModuleName @('NetTCPIP', 'Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.Management', 'CimCmdlets')
40+
41+
$ConfigurationFormat = [ordered] @{
42+
RemoveComments = $false
43+
44+
PlaceOpenBraceEnable = $true
45+
PlaceOpenBraceOnSameLine = $true
46+
PlaceOpenBraceNewLineAfter = $true
47+
PlaceOpenBraceIgnoreOneLineBlock = $true
48+
49+
PlaceCloseBraceEnable = $true
50+
PlaceCloseBraceNewLineAfter = $false
51+
PlaceCloseBraceIgnoreOneLineBlock = $true
52+
PlaceCloseBraceNoEmptyLineBefore = $false
53+
54+
UseConsistentIndentationEnable = $true
55+
UseConsistentIndentationKind = 'space'
56+
UseConsistentIndentationPipelineIndentation = 'IncreaseIndentationAfterEveryPipeline'
57+
UseConsistentIndentationIndentationSize = 4
58+
59+
UseConsistentWhitespaceEnable = $true
60+
UseConsistentWhitespaceCheckInnerBrace = $true
61+
UseConsistentWhitespaceCheckOpenBrace = $true
62+
UseConsistentWhitespaceCheckOpenParen = $true
63+
UseConsistentWhitespaceCheckOperator = $true
64+
UseConsistentWhitespaceCheckPipe = $true
65+
UseConsistentWhitespaceCheckSeparator = $true
66+
67+
AlignAssignmentStatementEnable = $true
68+
AlignAssignmentStatementCheckHashtable = $true
69+
70+
UseCorrectCasingEnable = $true
13471
}
135-
Steps = @{
136-
BuildModule = @{ # requires Enable to be on to process all of that
137-
Enable = $true
138-
DeleteBefore = $true
139-
Merge = $true
140-
MergeMissing = $true
141-
LibrarySeparateFile = $false
142-
LibraryDotSource = $true
143-
ClassesDotSource = $false
144-
SignMerged = $true
145-
CreateFileCatalog = $false # not working
146-
Releases = @{
147-
Enabled = $true
148-
Path = "$PSScriptRoot\..\Releases"
149-
}
150-
ReleasesUnpacked = @{
151-
Enabled = $true
152-
IncludeTagName = $true
153-
Path = "$PSScriptRoot\..\Artefacts"
154-
RequiredModules = $false
155-
DirectoryOutput = @{
156-
157-
}
158-
FilesOutput = @{
159-
160-
}
161-
}
162-
RefreshPSD1Only = $false
163-
}
164-
BuildDocumentation = $true
165-
ImportModules = @{
166-
Self = $false
167-
RequiredModules = $false
168-
Verbose = $false
169-
}
170-
PublishModule = @{ # requires Enable to be on to process all of that
171-
Enabled = $false
172-
Prerelease = ''
173-
RequireForce = $false
174-
GitHub = $false
175-
}
176-
}
177-
}
178-
179-
New-PrepareModule -Configuration $Configuration
72+
# format PSD1 and PSM1 files when merging into a single file
73+
# enable formatting is not required as Configuration is provided
74+
New-ConfigurationFormat -ApplyTo 'OnMergePSM1', 'OnMergePSD1' -Sort None @ConfigurationFormat
75+
# format PSD1 and PSM1 files within the module
76+
# enable formatting is required to make sure that formatting is applied (with default settings)
77+
New-ConfigurationFormat -ApplyTo 'DefaultPSD1', 'DefaultPSM1' -EnableFormatting -Sort None
78+
# when creating PSD1 use special style without comments and with only required parameters
79+
New-ConfigurationFormat -ApplyTo 'DefaultPSD1', 'OnMergePSD1' -PSD1Style 'Minimal'
80+
# configuration for documentation, at the same time it enables documentation processing
81+
New-ConfigurationDocumentation -Enable:$false -StartClean -UpdateWhenNew -PathReadme 'Docs\Readme.md' -Path 'Docs'
82+
83+
#New-ConfigurationImportModule -ImportSelf
84+
85+
New-ConfigurationBuild -Enable:$true -SignModule -MergeModuleOnBuild -MergeFunctionsFromApprovedModules -CertificateThumbprint '483292C9E317AA13B07BB7A96AE9D1A5ED9E7703'
86+
87+
New-ConfigurationArtefact -Type Unpacked -Enable -Path "$PSScriptRoot\..\Artefacts\Unpacked" -ModulesPath "$PSScriptRoot\..\Artefacts\Unpacked\Modules" -RequiredModulesPath "$PSScriptRoot\..\Artefacts\Unpacked\Modules" -AddRequiredModules
88+
New-ConfigurationArtefact -Type Packed -Enable -Path "$PSScriptRoot\..\Artefacts\Packed" -ArtefactName '<ModuleName>.v<ModuleVersion>.zip'
89+
90+
# options for publishing to github/psgallery
91+
#New-ConfigurationPublish -Type PowerShellGallery -FilePath 'C:\Support\Important\PowerShellGalleryAPI.txt' -Enabled
92+
#New-ConfigurationPublish -Type GitHub -FilePath 'C:\Support\Important\GitHubAPI.txt' -UserName 'EvotecIT' -Enabled
93+
}

0 commit comments

Comments
 (0)