diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..10a8d70 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "ms-vscode.powershell", + "pspester.pester-test", + "tylerleonhardt.vscode-inline-values-powershell", + "psake.psake-vscode", + "DavidAnson.vscode-markdownlint" + ] +} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index cca4ceb..292e2a4 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,10 +5,28 @@ "version": "0.2.0", "configurations": [ { + "name": "PowerShell: Debug Tests", "type": "PowerShell", "request": "launch", - "name": "PowerShell Interactive Session", - "cwd": "" + "script": "./build.ps1", + "args": ["-Task", "Test"], + "createTemporaryIntegratedConsole": false + }, + { + "name": "PowerShell: Debug Tests (Temp Console)", + "type": "PowerShell", + "request": "launch", + "script": "./build.ps1", + "args": ["-Task", "Test"], + "createTemporaryIntegratedConsole": true + }, + { + "name": "PowerShell: Load Source Module (Temp Console)", + "type": "PowerShell", + "request": "launch", + "script": "./build.ps1", + "args": ["-Task", "Init"], + "createTemporaryIntegratedConsole": true } ] -} +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 67d2203..d3d607d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,5 +5,16 @@ "powershell.codeFormatting.whitespaceAroundOperator": false, "powershell.codeFormatting.whitespaceBeforeOpenParen": false, "powershell.codeFormatting.preset": "OTBS", - "powershell.codeFormatting.trimWhitespaceAroundPipe": true + "powershell.codeFormatting.trimWhitespaceAroundPipe": true, + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "editor.insertSpaces": true, + "editor.tabSize": 4, + "search.exclude": { + "**/node_modules": true, + "**/bower_components": true, + "**/*.code-search": true, + "**/.ruby-lsp": true, + "Output/**": true + } } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..1b1505a --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,83 @@ +{ + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + // Start PowerShell (pwsh on *nix) + "windows": { + "options": { + "shell": { + "executable": "pwsh.exe", + "args": [ + "-NoProfile", + "-ExecutionPolicy", + "Bypass", + "-Command" + ] + } + } + }, + "linux": { + "options": { + "shell": { + "executable": "/usr/bin/pwsh", + "args": [ + "-NoProfile", + "-Command" + ] + } + } + }, + "osx": { + "options": { + "shell": { + "executable": "/usr/local/bin/pwsh", + "args": [ + "-NoProfile", + "-Command" + ] + } + } + }, + "tasks": [ + { + "label": "Clean", + "type": "shell", + "command": "${cwd}/build.ps1 -Task Clean -Verbose" + }, + { + "label": "Test", + "type": "shell", + "command": "${cwd}/build.ps1 -Task Test -Verbose", + "group": { + "kind": "test", + "isDefault": true + }, + "problemMatcher": "$pester" + }, + { + "label": "Analyze", + "type": "shell", + "command": "${cwd}/build.ps1 -Task Analyze -Verbose" + }, + { + "label": "Pester", + "type": "shell", + "command": "${cwd}/build.ps1 -Task Pester -Verbose", + "problemMatcher": "$pester" + }, + { + "label": "Build", + "type": "shell", + "command": "${cwd}/build.ps1 -Task Build -Verbose", + "group": { + "kind": "build", + "isDefault": true + } + }, + { + "label": "Publish", + "type": "shell", + "command": "${cwd}/build.ps1 -Task Publish -Verbose" + } + ] +} diff --git a/PSDepend/PSDepend.psd1 b/PSDepend/PSDepend.psd1 index ec1e333..293e470 100644 --- a/PSDepend/PSDepend.psd1 +++ b/PSDepend/PSDepend.psd1 @@ -58,7 +58,17 @@ # NestedModules = @() # Functions to export from this module - FunctionsToExport = @('Get-Dependency','Get-PSDependScript','Get-PSDependType','Import-Dependency','Install-Dependency','Invoke-DependencyScript','Invoke-PSDepend','Test-Dependency') + # Generated by the build process + FunctionsToExport = @( + 'Get-Dependency', + 'Get-PSDependScript', + 'Get-PSDependType', + 'Import-Dependency', + 'Install-Dependency', + 'Invoke-DependencyScript', + 'Invoke-PSDepend', + 'Test-Dependency' + ) # Cmdlets to export from this module CmdletsToExport = '*' @@ -96,7 +106,10 @@ # IconUri = '' # ReleaseNotes of this module - ReleaseNotes = 'Added various PowerShell Core fixes thanks to @lipkau!' + ReleaseNotes = 'https://github.com/PowerShellOrg/PSDepend/blob/main/CHANGELOG.md' + + # Prerelease string (e.g. 'beta1', 'rc2'). Empty string = stable release. + Prerelease = '' } # End of PSData hashtable diff --git a/psakeFile.ps1 b/psakeFile.ps1 index 1547744..ca84cfa 100644 --- a/psakeFile.ps1 +++ b/psakeFile.ps1 @@ -29,6 +29,27 @@ Properties { # and Build-PSBuildMarkdown has a Remove-Module scope bug specific to PSDepend. $PSBBuildDependency = @('StageFiles') +# Override with: .\build.ps1 InstallLocal -Properties @{PreReleaseLabel='rc1'} +Task InstallLocal -Depends StageFiles { + $label = if ($PreReleaseLabel) { $PreReleaseLabel } else { "pre-$(git rev-parse --short HEAD)" } + + $moduleName = $PSBPreference.General.ModuleName + $stagedDir = $PSBPreference.Build.ModuleOutDir + $manifestPath = Join-Path $stagedDir "$moduleName.psd1" + $version = (Import-PowerShellDataFile $manifestPath).ModuleVersion + + Update-Metadata -Path $manifestPath -PropertyName Prerelease -Value $label + + $destRoot = Join-Path ([Environment]::GetFolderPath('MyDocuments')) 'PowerShell\Modules\PSDepend' + $destDir = Join-Path $destRoot "$version-$label" + + if (Test-Path $destDir) { + Remove-Item $destDir -Recurse -Force + } + Copy-Item -Path $stagedDir -Destination $destDir -Recurse + Write-Host "Installed PSDepend $version-$label -> $destDir" +} + Task Default -Depends Test # PowerShellBuild adds the following tasks: