-
-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathBuild-Module.ps1
More file actions
108 lines (91 loc) · 5.81 KB
/
Build-Module.ps1
File metadata and controls
108 lines (91 loc) · 5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
Invoke-ModuleBuild -ModuleName 'PSWriteHTML' {
# Usual defaults as per standard module
$Manifest = [ordered] @{
ModuleVersion = '1.X.0'
CompatiblePSEditions = @('Desktop', 'Core')
GUID = 'a7bdf640-f5cb-4acf-9de0-365b322d245c'
Author = 'Przemyslaw Klys'
CompanyName = 'Evotec'
Copyright = "(c) 2011 - $((Get-Date).Year) Przemyslaw Klys @ Evotec. All rights reserved."
Description = 'PSWriteHTML is PowerShell Module to generate beautiful HTML reports, pages, emails without any knowledge of HTML, CSS or JavaScript. To get started basics PowerShell knowledge is required.'
PowerShellVersion = '5.1'
Tags = @('HTML', 'WWW', 'JavaScript', 'CSS', 'Reports', 'Reporting', 'Windows', 'MacOS', 'Linux')
IconUri = 'https://evotec.xyz/wp-content/uploads/2018/12/PSWriteHTML.png'
ProjectUri = 'https://github.com/EvotecIT/PSWriteHTML'
#DotNetFrameworkVersion = '4.5.2'
}
New-ConfigurationManifest @Manifest #-Prerelease "Alpha02"
New-ConfigurationModule -Type RequiredModule -Name 'PSSharedGoods' -Guid Auto -Version Latest
#New-ConfigurationModule -Type ExternalModule -Name 'Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.Management','Microsoft.PowerShell.Security'
New-ConfigurationModule -Type ApprovedModule -Name 'PSSharedGoods', 'PSWriteColor', 'Connectimo', 'PSUnifi', 'PSWebToolbox', 'PSMyPassword'
New-ConfigurationModuleSkip -IgnoreModuleName @(
# this are builtin into PowerShell, so not critical
'Microsoft.PowerShell.Management'
'Microsoft.PowerShell.Security'
'Microsoft.PowerShell.Utility'
# this is optional, and checked for existance in the source codes directly
'PSParseHTML'
) -IgnoreFunctionName 'Select-Unique', 'Compare-TwoArrays', 'IsNumeric', 'IsOfType', 'Format-HTML', 'Optimize-HTML' # those functions are internal within private function
$ConfigurationFormat = [ordered] @{
RemoveComments = $true
RemoveEmptyLines = $true
PlaceOpenBraceEnable = $true
PlaceOpenBraceOnSameLine = $true
PlaceOpenBraceNewLineAfter = $true
PlaceOpenBraceIgnoreOneLineBlock = $false
PlaceCloseBraceEnable = $true
PlaceCloseBraceNewLineAfter = $false
PlaceCloseBraceIgnoreOneLineBlock = $true
PlaceCloseBraceNoEmptyLineBefore = $false
UseConsistentIndentationEnable = $true
UseConsistentIndentationKind = 'space'
UseConsistentIndentationPipelineIndentation = 'IncreaseIndentationAfterEveryPipeline'
UseConsistentIndentationIndentationSize = 4
UseConsistentWhitespaceEnable = $true
UseConsistentWhitespaceCheckInnerBrace = $true
UseConsistentWhitespaceCheckOpenBrace = $true
UseConsistentWhitespaceCheckOpenParen = $true
UseConsistentWhitespaceCheckOperator = $true
UseConsistentWhitespaceCheckPipe = $true
UseConsistentWhitespaceCheckSeparator = $true
AlignAssignmentStatementEnable = $true
AlignAssignmentStatementCheckHashtable = $true
UseCorrectCasingEnable = $true
}
# format PSD1 and PSM1 files when merging into a single file
# enable formatting is not required as Configuration is provided
New-ConfigurationFormat -ApplyTo 'OnMergePSM1', 'OnMergePSD1' -Sort None @ConfigurationFormat
# format PSD1 and PSM1 files within the module
# enable formatting is required to make sure that formatting is applied (with default settings)
New-ConfigurationFormat -ApplyTo 'DefaultPSD1', 'DefaultPSM1' -EnableFormatting -Sort None
# when creating PSD1 use special style without comments and with only required parameters
New-ConfigurationFormat -ApplyTo 'DefaultPSD1', 'OnMergePSD1' -PSD1Style 'Minimal'
# configuration for documentation, at the same time it enables documentation processing
$documentationConfiguration = @{
Enable = $true
StartClean = $true
UpdateWhenNew = $true
PathReadme = 'Docs\Readme.md'
Path = 'Docs'
}
if ((Get-Command New-ConfigurationDocumentation).Parameters.ContainsKey('SyncExternalHelpToProjectRoot')) {
$documentationConfiguration.SyncExternalHelpToProjectRoot = $true
}
New-ConfigurationDocumentation @documentationConfiguration
New-ConfigurationImportModule -ImportSelf
$newConfigurationBuildSplat = @{
Enable = $true
SignModule = $true
MergeModuleOnBuild = $true
MergeFunctionsFromApprovedModules = $true
CertificateThumbprint = '483292C9E317AA13B07BB7A96AE9D1A5ED9E7703'
RefreshPSD1Only = $env:RefreshPSD1Only -eq 'true'
}
New-ConfigurationBuild @newConfigurationBuildSplat
#New-ConfigurationTest -TestsPath "$PSScriptRoot\..\Tests" -Enable
New-ConfigurationArtefact -Type Unpacked -Enable -Path "$PSScriptRoot\..\Artefacts\Unpacked" -AddRequiredModules
New-ConfigurationArtefact -Type Packed -Enable -Path "$PSScriptRoot\..\Artefacts\Packed" -ArtefactName '<ModuleName>.v<ModuleVersion>.zip'
# options for publishing to github/psgallery
#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
} -ExitCode