@@ -282,8 +282,11 @@ Task Merge -depends Stage -requiredVariables ReleasePath, ModulePath, ModuleName
282
282
$moduleContent = New-Object - TypeName ' System.Collections.Generic.List[System.String]'
283
283
$moduleDefinition = New-Object - TypeName ' System.Collections.Generic.List[System.String]'
284
284
285
- # Load code of the module header
286
- $moduleContent.Add ((Get-Content - Path " $ModulePath \$moduleName \$moduleName .psm1" | Select-Object - First 12 ) -join " `r`n " )
285
+ # Load code of the module namespace loader
286
+ if ((Get-Content - Path " $ModulePath \$moduleName \$moduleName .psm1" - Raw) -match ' #region Namepsace Loader[\r\n](?<NamespaceLoader>[\S\s]*)[\r\n]#endregion Namepsace Loader' )
287
+ {
288
+ $moduleContent.Add ($matches [' NamespaceLoader' ])
289
+ }
287
290
288
291
# Load code for all class files
289
292
foreach ($file in (Get-ChildItem - Path " $ModulePath \$moduleName \Classes" - Filter ' *.ps1' - Recurse - File - ErrorAction ' SilentlyContinue' ))
@@ -303,8 +306,11 @@ Task Merge -depends Stage -requiredVariables ReleasePath, ModulePath, ModuleName
303
306
$moduleContent.Add ((Get-Content - Path $file.FullName - Raw))
304
307
}
305
308
306
- # Load code of the module file itself
307
- $moduleContent.Add ((Get-Content - Path " $ModulePath \$moduleName \$moduleName .psm1" | Select-Object - Skip 24 ) -join " `r`n " )
309
+ # Load code of the module namespace loader
310
+ if ((Get-Content - Path " $ModulePath \$moduleName \$moduleName .psm1" - Raw) -match ' #region Module Configuration[\r\n](?<ModuleConfiguration>[\S\s]*)#endregion Module Configuration' )
311
+ {
312
+ $moduleContent.Add ($matches [' ModuleConfiguration' ])
313
+ }
308
314
309
315
# Concatenate whole code into the module file
310
316
$moduleContent | Set-Content - Path " $ReleasePath \$moduleName \$moduleName .psm1" - Encoding UTF8 - Verbose:$VerbosePreference
@@ -330,7 +336,6 @@ Task Merge -depends Stage -requiredVariables ReleasePath, ModulePath, ModuleName
330
336
}
331
337
}
332
338
333
-
334
339
# Save the updated module definition
335
340
$moduleDefinition | Set-Content - Path " $ReleasePath \$moduleName \$moduleName .psd1" - Encoding UTF8 - Verbose:$VerbosePreference
336
341
}
@@ -403,7 +408,9 @@ Task ScriptAnalyzer -requiredVariables ReleasePath, ModulePath, ModuleNames, Scr
403
408
{
404
409
$moduleScriptAnalyzerFile = Join-Path - Path $ScriptAnalyzerPath - ChildPath " $moduleName -$ScriptAnalyzerFile "
405
410
411
+ # Invoke script analyzer on the module but exclude all examples
406
412
$analyzeResults = Invoke-ScriptAnalyzer - Path " $ReleasePath \$moduleName " - IncludeRule $ScriptAnalyzerRules - Recurse
413
+ $analyzeResults = $analyzeResults | Where-Object { $_.ScriptPath -notlike " $releasePath \$moduleName \Examples\*" }
407
414
$analyzeResults | ConvertTo-Json | Out-File - FilePath $moduleScriptAnalyzerFile - Encoding UTF8
408
415
409
416
Show-ScriptAnalyzerResult - ModuleName $moduleName - Rule $ScriptAnalyzerRules - Result $analyzeResults
@@ -567,6 +574,7 @@ function Get-GitMergeStatus($Branch)
567
574
function Show-ScriptAnalyzerResult ($ModuleName , $Rule , $Result )
568
575
{
569
576
$colorMap = @ {
577
+ ParseError = ' DarkRed'
570
578
Error = ' Red'
571
579
Warning = ' Yellow'
572
580
Information = ' Cyan'
0 commit comments