Skip to content

Commit ba85cfd

Browse files
🩹 [Patch]: Update module requirements and function calls that use Ast (#86)
## Description This pull request includes updates to the `Set-ScriptFileRequirement` function in the `src/functions/public/PowerShell/Module/Set-ScriptFileRequirement.ps1` file. The most important changes involve updating module requirements and modifying function calls. Updates to module requirements and function calls: * Updated the required version of the `Ast` module from `0.2.3` to `0.3.0`. Note: The module holding the Ast* functions was renamed from `AST` to `Ast`. * Replaced calls to `Get-FunctionName` with `Get-ASTFunctionName` within the `Set-ScriptFileRequirement` function to reflect the updated module usage. [[1]](diffhunk://#diff-0d053936135695dd6f1399f5a7ef57233f17c702db7f937932f48a6444b60a1eL71-R71) [[2]](diffhunk://#diff-0d053936135695dd6f1399f5a7ef57233f17c702db7f937932f48a6444b60a1eL93-R93) ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [ ] 🪲 [Fix] - [x] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent b57d59b commit ba85cfd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/functions/public/PowerShell/Module/Set-ScriptFileRequirement.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Requires -Modules @{ ModuleName = 'AST'; RequiredVersion = '0.2.3' }
1+
#Requires -Modules @{ ModuleName = 'Ast'; RequiredVersion = '0.4.0' }
22

33
function Set-ScriptFileRequirement {
44
<#
@@ -68,7 +68,7 @@ function Set-ScriptFileRequirement {
6868

6969
foreach ($file in $ps1Files) {
7070
Write-Verbose "Gathering info from file: [$($file.FullName)]"
71-
$functionName = Get-FunctionName -Path $file.FullName
71+
$functionName = Get-AstFunctionName -Path $file.FullName
7272
Write-Verbose " - Name: $functionName"
7373
$localFunctions += $functionName
7474
Get-FunctionAlias -Path $file.FullName | Select-Object -ExpandProperty Alias | ForEach-Object {
@@ -90,8 +90,8 @@ function Set-ScriptFileRequirement {
9090
$requiredModules = @{}
9191

9292
Write-Verbose "Analyzing file: [$($file.FullName)]"
93-
$functionNames = Get-FunctionName -Path $file.FullName
94-
$scriptCommands = Get-ScriptCommand -Path $file.FullName
93+
$functionNames = Get-AstFunctionName -Path $file.FullName
94+
$scriptCommands = Get-AstScriptCommand -Path $file.FullName
9595
Write-Verbose " - Found $($scriptCommands.Count) commands"
9696
# $command = $scriptCommands[0]
9797
foreach ($command in $scriptCommands) {

0 commit comments

Comments
 (0)