diff --git a/.gitignore b/.gitignore index 2319b712f..0665bd5b1 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ node/docs/temp node/docs/*.js .DS_Store +# IDE +.vscode/settings.json + # Logs logs *.log diff --git a/azure-pipelines-steps-node.yml b/azure-pipelines-steps-node.yml index 331b16568..ae70b4c7f 100644 --- a/azure-pipelines-steps-node.yml +++ b/azure-pipelines-steps-node.yml @@ -34,24 +34,4 @@ steps: # PublishPipelineArtifact step is configured in the base template. # See the templateContext section in the azure-pipelines.yml file -# Only on Windows. Build VstsTaskSdk for powershell -- ${{ if eq(parameters.os, 'Windows_NT') }}: - # Build step for .NET source code. This is needed to enable CodeQL for C# code - - task: DotNetCoreCLI@2 - displayName: 'Build .NET project(s)' - inputs: - command: build - projects: 'powershell/CompiledHelpers/VstsTaskSdk.csproj' - arguments: '--configuration Release' - - - task: NpmAuthenticate@0 - inputs: - workingFile: .npmrc - - - script: npm ci - displayName: (VstsTaskSdk) npm ci - workingDirectory: powershell - - - script: npm test - displayName: (VstsTaskSdk) npm test - workingDirectory: powershell + diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 5e87603a9..9c1e82284 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -10,6 +10,8 @@ variables: - group: npm-tokens - name: nodeVersion value: '16.13.0' +- name: nodeVersionForPowershell + value: '20.x' resources: repositories: @@ -43,9 +45,9 @@ extends: image: abtt-windows-2022 os: windows steps: - - template: /azure-pipelines-steps-node.yml@self + - template: /ci/node/build-steps.yml@self parameters: - os: Windows_NT + os: Windows_NT ################################################# - job: linux @@ -61,7 +63,7 @@ extends: artifactType: 'pipeline' artifactName: 'npm-package' steps: - - template: /azure-pipelines-steps-node.yml@self + - template: /ci/node/build-steps.yml@self parameters: os: Linux @@ -73,6 +75,24 @@ extends: image: macOS-latest os: macOS steps: - - template: /azure-pipelines-steps-node.yml@self + - template: /ci/node/build-steps.yml@self parameters: - os: Darwin \ No newline at end of file + os: Darwin + + ################################################# + - job: powershell + ################################################# + pool: + name: 1ES-ABTT-Shared-Pool + image: abtt-windows-2022 + os: windows + templateContext: + outputs: + - output: pipelineArtifact + targetPath: 'powershell/_build' + artifactType: 'pipeline' + artifactName: 'powershell-module' + steps: + - template: /ci/powershell/build-steps.yml@self + parameters: + runTests: true \ No newline at end of file diff --git a/ci/node/build-steps.yml b/ci/node/build-steps.yml new file mode 100644 index 000000000..d9325e045 --- /dev/null +++ b/ci/node/build-steps.yml @@ -0,0 +1,23 @@ +parameters: +- name: os + type: string + +steps: +- task: NodeTool@0 + displayName: use node $(nodeVersion) + inputs: + versionSpec: $(nodeVersion) + +- task: NpmAuthenticate@0 + inputs: + workingFile: .npmrc + +- script: npm ci + displayName: (task-lib) npm ci + workingDirectory: node + +- script: npm test + workingDirectory: node + displayName: (task-lib) npm test + + diff --git a/ci/node/publish-job.yml b/ci/node/publish-job.yml new file mode 100644 index 000000000..0c55a88a5 --- /dev/null +++ b/ci/node/publish-job.yml @@ -0,0 +1,36 @@ +parameters: +- name: npmToken + type: string + default: '$(npm-automation.token)' + +jobs: +- job: PublishToNpm + displayName: 'Publish Node.js Package to npm' + pool: + vmImage: ubuntu-latest + variables: + nodeVersion: '16.13.0' + steps: + - checkout: self + displayName: 'Checkout source code' + + # Build and test the package + - template: /ci/node/build-steps.yml@self + parameters: + os: '' + + - bash: | + echo //registry.npmjs.org/:_authToken=\${NPM_TOKEN} > .npmrc + npm publish + displayName: (task-lib) npm publish + workingDirectory: node/_build + env: + NPM_TOKEN: ${{ parameters.npmToken }} + + - task: PublishPipelineArtifact@1 + displayName: 'Publish npm package artifact' + inputs: + targetPath: 'node/_build' + artifact: 'npm-package' + publishLocation: 'pipeline' + condition: succeededOrFailed() diff --git a/ci/powershell/build-steps.yml b/ci/powershell/build-steps.yml new file mode 100644 index 000000000..84edde653 --- /dev/null +++ b/ci/powershell/build-steps.yml @@ -0,0 +1,48 @@ +parameters: +- name: runTests + type: boolean + default: true + +steps: +# Build .NET project (requires Windows) +- task: DotNetCoreCLI@2 + displayName: 'Build .NET project(s)' + inputs: + command: build + projects: 'powershell/CompiledHelpers/VstsTaskSdk.csproj' + arguments: '--configuration Release' + +# Copy the built DLL to a location where make.js can use it instead of downloading +- pwsh: | + $sourceDll = "CompiledHelpers/bin/Release/netstandard2.1/VstsTaskSdk.dll" + $targetDir = "_lib" + New-Item -ItemType Directory -Force -Path $targetDir | Out-Null + Copy-Item -Path $sourceDll -Destination "$targetDir/VstsTaskSdk.dll" -Force + Write-Host "Copied locally built VstsTaskSdk.dll to $targetDir" + displayName: 'Copy locally built VstsTaskSdk.dll' + workingDirectory: powershell + +# Use Node.js 20.x for PowerShell SDK (required for newer dependencies) +- task: NodeTool@0 + displayName: use node $(nodeVersionForPowershell) for PowerShell SDK + inputs: + versionSpec: $(nodeVersionForPowershell) + +- task: NpmAuthenticate@0 + inputs: + workingFile: .npmrc + +- script: npm ci + displayName: (VstsTaskSdk) npm ci + workingDirectory: powershell + +# Build the PowerShell module +- script: node make.js build + displayName: (VstsTaskSdk) build module + workingDirectory: powershell + +# Run tests if requested +- ${{ if eq(parameters.runTests, true) }}: + - script: npm test + displayName: (VstsTaskSdk) npm test + workingDirectory: powershell \ No newline at end of file diff --git a/ci/powershell/publish-job.yml b/ci/powershell/publish-job.yml index 687008aab..667dec7e5 100644 --- a/ci/powershell/publish-job.yml +++ b/ci/powershell/publish-job.yml @@ -1,23 +1,94 @@ +parameters: +- name: apiKeyVariable + type: string + default: '$(PSGalleryApiKey)' +- name: enableSigning + type: boolean + default: true + jobs: - - job: Publish - displayName: Publish SDK to PowerShell gallery - pool: - vmImage: windows-2022 - steps: - - powershell: | - Install-Module -Name Microsoft.PowerShell.PSResourceGet -Verbose - displayName: Install new publish cmdlets - - - powershell: | - $publishOptions = @{ - Path = './VstsTaskSdk' - ApiKey = $env:API_KEY - Repository = 'PSGallery' - Verbose = $true - } - Publish-PSResource @publishOptions - - displayName: Publish to gallery - workingDirectory: powershell/_build - env: - API_KEY: $(PSGalleryApiKey) +- job: PublishToGallery + displayName: 'Publish PowerShell Module to Gallery' + pool: + name: 1ES-ABTT-Shared-Pool + image: abtt-windows-2022 + os: windows + variables: + nodeVersionForPowershell: '20.x' + steps: + - checkout: self + displayName: 'Checkout source code' + + # Build .NET project + - task: DotNetCoreCLI@2 + displayName: 'Build .NET project(s)' + inputs: + command: build + projects: 'powershell/CompiledHelpers/VstsTaskSdk.csproj' + arguments: '--configuration Release' + + # Sign the DLL if enabled + - ${{ if eq(parameters.enableSigning, true) }}: + - template: /ci/powershell/signing-steps.yml@self + parameters: + dllPath: 'powershell/CompiledHelpers/bin/Release/netstandard2.1' + + # Copy signed DLL to _lib folder + - pwsh: | + $sourceDll = "CompiledHelpers/bin/Release/netstandard2.1/VstsTaskSdk.dll" + $targetDir = "_lib" + New-Item -ItemType Directory -Force -Path $targetDir | Out-Null + Copy-Item -Path $sourceDll -Destination "$targetDir/VstsTaskSdk.dll" -Force + Write-Host "Copied signed VstsTaskSdk.dll to $targetDir" + displayName: 'Copy signed VstsTaskSdk.dll' + workingDirectory: powershell + + # Setup Node.js and build PowerShell module + - task: NodeTool@0 + displayName: use node $(nodeVersionForPowershell) for PowerShell SDK + inputs: + versionSpec: $(nodeVersionForPowershell) + + - task: NpmAuthenticate@0 + inputs: + workingFile: .npmrc + + - script: npm ci + displayName: (VstsTaskSdk) npm ci + workingDirectory: powershell + + - script: node make.js build + displayName: (VstsTaskSdk) build module + workingDirectory: powershell + + - script: npm test + displayName: (VstsTaskSdk) npm test + workingDirectory: powershell + + # Then publish to PowerShell Gallery + - powershell: | + Install-Module -Name Microsoft.PowerShell.PSResourceGet -Force -Verbose + displayName: 'Install PowerShell Gallery publish tools' + condition: succeeded() + + - powershell: | + $publishOptions = @{ + Path = '.\_build\VstsTaskSdk' + ApiKey = $env:API_KEY + Repository = 'PSGallery' + Verbose = $true + } + Publish-PSResource @publishOptions + displayName: 'Publish to PowerShell Gallery' + workingDirectory: powershell + condition: succeeded() + env: + API_KEY: ${{ parameters.apiKeyVariable }} + + - task: PublishPipelineArtifact@1 + displayName: 'Publish built module as artifact' + inputs: + targetPath: 'powershell/_build' + artifact: 'VstsTaskSdk-Published' + publishLocation: 'pipeline' + condition: succeededOrFailed() \ No newline at end of file diff --git a/ci/powershell/signing-steps.yml b/ci/powershell/signing-steps.yml new file mode 100644 index 000000000..3176df098 --- /dev/null +++ b/ci/powershell/signing-steps.yml @@ -0,0 +1,153 @@ +parameters: +- name: dllPath + type: string + default: 'powershell/CompiledHelpers/bin/Release/netstandard2.1' + +steps: +# Strong name sign +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5 + displayName: 'Strong name Sign VstsTaskSdk.dll' + inputs: + ConnectedServiceName: $(ConnectedServiceName) + UseMSIAuthentication: true + AppRegistrationClientId: $(AppRegistrationClientId) + AppRegistrationTenantId: $(AppRegistrationTenantId) + EsrpClientId: $(EsrpClientId) + AuthAKVName: $(AuthAKVName) + AuthSignCertName: $(AuthSignCertName) + FolderPath: '${{ parameters.dllPath }}' + Pattern: 'VstsTaskSdk.dll' + SessionTimeout: '60' + MaxConcurrency: '50' + MaxRetryAttempts: '5' + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "KeyCode": "CP-233907-SN", + "OperationCode": "StrongNameSign", + "ToolName": "sign", + "ToolVersion": "1.0", + "Parameters": {} + }, + { + "KeyCode": "CP-233907-SN", + "OperationCode": "StrongNameVerify", + "ToolName": "sign", + "ToolVersion": "1.0", + "Parameters": {} + } + ] + +# Authenticode Signing +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5 + displayName: 'Authenticode Sign VstsTaskSdk.dll' + inputs: + ConnectedServiceName: $(ConnectedServiceName) + UseMSIAuthentication: true + AppRegistrationClientId: $(AppRegistrationClientId) + AppRegistrationTenantId: $(AppRegistrationTenantId) + EsrpClientId: $(EsrpClientId) + AuthAKVName: $(AuthAKVName) + AuthSignCertName: $(AuthSignCertName) + FolderPath: '${{ parameters.dllPath }}' + Pattern: 'VstsTaskSdk.dll' + SessionTimeout: '60' + MaxConcurrency: '50' + MaxRetryAttempts: '5' + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + +# 3rd party signing +- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@5 + displayName: '3rd Party Sign VstsTaskSdk.dll' + inputs: + ConnectedServiceName: $(ConnectedServiceName) + UseMSIAuthentication: true + AppRegistrationClientId: $(AppRegistrationClientId) + AppRegistrationTenantId: $(AppRegistrationTenantId) + EsrpClientId: $(EsrpClientId) + AuthAKVName: $(AuthAKVName) + AuthSignCertName: $(AuthSignCertName) + FolderPath: '${{ parameters.dllPath }}' + Pattern: 'VstsTaskSdk.dll' + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-231522", + "operationSetCode": "SigntoolSign", + "parameters": [ + { + "parameterName": "OpusName", + "parameterValue": "Microsoft" + }, + { + "parameterName": "OpusInfo", + "parameterValue": "http://www.microsoft.com" + }, + { + "parameterName": "Append", + "parameterValue": "/as" + }, + { + "parameterName": "FileDigest", + "parameterValue": "/fd \"SHA256\"" + }, + { + "parameterName": "PageHash", + "parameterValue": "/NPH" + }, + { + "parameterName": "TimeStamp", + "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" + } + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-231522", + "operationSetCode": "SigntoolVerify", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" + } + ] diff --git a/ci/release-pipeline.yml b/ci/release-pipeline.yml new file mode 100644 index 000000000..48b5cf42e --- /dev/null +++ b/ci/release-pipeline.yml @@ -0,0 +1,51 @@ +# Release pipeline for publishing packages +# This pipeline should be triggered manually for publishing releases + +trigger: none # No CI trigger - manual trigger only +pr: none # No PR trigger + +variables: +- group: npm-tokens +- group: powershell-gallery-secrets +- group: TasksAndAgentEsrpSigning +- name: nodeVersion + value: '16.13.0' +- name: nodeVersionForPowershell + value: '20.x' + +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + settings: + skipBuildTagsForGitHubPullRequests: true + sdl: + baseline: + baselineSet: default + baselineFile: $(Build.SourcesDirectory)/.gdn/.gdnbaselines + sourceAnalysisPool: + name: 1ES-ABTT-Shared-Pool + image: abtt-windows-2022 + os: windows + customBuildTags: + - ES365AIMigrationTooling + stages: + - stage: PublishPackages + displayName: 'Publish Packages' + jobs: + # Publish Node.js package to npm + - template: /ci/node/publish-job.yml@self + parameters: + npmToken: $(npm-automation.token) + + # Publish PowerShell module to PowerShell Gallery (with signing) + - template: /ci/powershell/publish-job.yml@self + parameters: + apiKeyVariable: $(PSGalleryApiKey) + enableSigning: true diff --git a/powershell/Tests/lib/TestHelpersModule/PrivateFunctions.ps1 b/powershell/Tests/lib/TestHelpersModule/PrivateFunctions.ps1 index 0f5f807a9..0e219baa2 100644 --- a/powershell/Tests/lib/TestHelpersModule/PrivateFunctions.ps1 +++ b/powershell/Tests/lib/TestHelpersModule/PrivateFunctions.ps1 @@ -36,8 +36,11 @@ function Test-CanUnravel { [CmdletBinding()] param($Object) - return !([object]::ReferenceEquals($Object, $null)) -and - $Object.GetType().IsClass -and + if ([object]::ReferenceEquals($Object, $null)) { + return $false + } + + return $Object.GetType().IsClass -and !([object]::ReferenceEquals($Object, ($Object | ForEach-Object { $_ }))) } diff --git a/powershell/VstsTaskSdk/LocalizationFunctions.ps1 b/powershell/VstsTaskSdk/LocalizationFunctions.ps1 index b5549700f..edb60c4c0 100644 --- a/powershell/VstsTaskSdk/LocalizationFunctions.ps1 +++ b/powershell/VstsTaskSdk/LocalizationFunctions.ps1 @@ -50,7 +50,7 @@ function Get-LocString { if (!$ArgumentList.Count) { return $format } try { - [string]::Format($format, $ArgumentList) + [string]::Format([System.Globalization.CultureInfo]::InvariantCulture, $format, $ArgumentList) } catch { Write-Warning (Get-LocString -Key 'PSLIB_StringFormatFailed') $OFS = " " diff --git a/powershell/VstsTaskSdk/ToolFunctions.ps1 b/powershell/VstsTaskSdk/ToolFunctions.ps1 index 35e621887..82a0b6e99 100644 --- a/powershell/VstsTaskSdk/ToolFunctions.ps1 +++ b/powershell/VstsTaskSdk/ToolFunctions.ps1 @@ -208,6 +208,12 @@ function Invoke-Process { $procExitCode = $proc.ExitCode Write-Verbose "Exit code: $procExitCode" + + # Handle case where exit code might be null + if ($procExitCode -eq $null) { + Write-Warning "Process exit code is null, defaulting to 0" + $procExitCode = 0 + } if ($RequireExitCodeZero -and $procExitCode -ne 0) { Write-Error (Get-LocString -Key PSLIB_Process0ExitedWithCode1 -ArgumentList ([System.IO.Path]::GetFileName($FileName)), $procExitCode) @@ -215,7 +221,8 @@ function Invoke-Process { $global:LASTEXITCODE = $procExitCode - return $procExitCode + # Ensure we return an integer + return [int]$procExitCode } finally { Trace-LeavingInvocation $MyInvocation diff --git a/powershell/make.js b/powershell/make.js index 145824b2c..f6e196504 100644 --- a/powershell/make.js +++ b/powershell/make.js @@ -28,8 +28,16 @@ target.build = async function () { var minimatchPackage = await util.downloadArchiveAsync('https://www.nuget.org/api/v2/package/minimatch/1.1.0'); util.cp(path.join(minimatchPackage, 'lib', 'portable-net40%2Bsl50%2Bwin%2Bwp80', 'Minimatch.dll'), path.join(buildPath, 'VstsTaskSdk')); - var compiledHelperPackage = await util.downloadArchiveAsync('https://vstsagenttools.blob.core.windows.net/tools/VstsTaskSdkCompiledHelpers/3/VstsTaskSdk.zip'); - util.cp(path.join(compiledHelperPackage, 'VstsTaskSdk.dll'), path.join(buildPath, 'VstsTaskSdk')); + // Use locally built VstsTaskSdk.dll if available (from CI/release pipeline), otherwise download + var localDllPath = path.join(__dirname, '_lib', 'VstsTaskSdk.dll'); + if (fs.existsSync(localDllPath)) { + console.log('Using locally built VstsTaskSdk.dll'); + util.cp(localDllPath, path.join(buildPath, 'VstsTaskSdk')); + } else { + console.log('Downloading VstsTaskSdk.dll from remote location'); + var compiledHelperPackage = await util.downloadArchiveAsync('https://vstsagenttools.blob.core.windows.net/tools/VstsTaskSdkCompiledHelpers/3/VstsTaskSdk.zip'); + util.cp(path.join(compiledHelperPackage, 'VstsTaskSdk.dll'), path.join(buildPath, 'VstsTaskSdk')); + } // stamp the version number from the package.json onto the PowerShell module definition var targetPsd1 = path.join(buildPath, 'VstsTaskSdk', 'VstsTaskSdk.psd1'); @@ -61,8 +69,12 @@ target.build = async function () { } target.test = async function () { - util.ensureTool('tsc', '--version', 'Version 4.0.2'); - util.ensureTool('mocha', '--version', '5.2.0'); + util.ensureTool('tsc', '--version', function(version) { + if (!version.startsWith('Version 5.')) { + throw new Error('expected TypeScript 5.x, got: ' + version); + } + }); + util.ensureTool('mocha', '--version', '10.8.2'); await target.build(); util.mkdir('-p', testPath); @@ -94,9 +106,11 @@ target.loc = function () { process.on('uncaughtException', err => { console.error(`Uncaught exception: ${err.message}`); console.debug(err.stack); + process.exit(1); }); process.on('unhandledRejection', err => { console.error(`Unhandled rejection: ${err.message}`); console.debug(err.stack); + process.exit(1); }); \ No newline at end of file diff --git a/powershell/package-lock.json b/powershell/package-lock.json index 9ce07452c..ebe59b566 100644 --- a/powershell/package-lock.json +++ b/powershell/package-lock.json @@ -10,34 +10,142 @@ "license": "MIT", "devDependencies": { "@types/mocha": "^5.2.7", - "@types/node": "^10.17.60", + "@types/node": "^20.0.0", "@types/shelljs": "^0.8.14", "adm-zip": "^0.5.9", "minimatch": "^10.0.0", "mocha": "10.8.2", "nodejs-file-downloader": "^4.11.1", "shelljs": "^0.8.5", - "typescript": "4.0.2" + "typescript": "^5.4.5" } }, - "node_modules/@types/glob": { - "version": "7.2.0", - "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/@types/glob/-/glob-7.2.0.tgz", - "integrity": "sha1-vBtb86qS8lvV3TnzXFc2G9zlsus=", + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha1-MIHa28NGBmG3UedZHX+upd853Sk=", + "dev": true, + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha1-Sz2rq32OdaQpQUqWvWe/TB0T4PM=", "dev": true, "license": "MIT", "dependencies": { - "@types/minimatch": "*", - "@types/node": "*" + "@isaacs/balanced-match": "^4.0.1" + }, + "engines": { + "node": "20 || >=22" } }, - "node_modules/@types/minimatch": { - "version": "5.1.2", - "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha1-B1CLRXl8uB7D8nMBGwVM0HVe3co=", + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha1-s3Znt7wYHBaHgiWbq0JHT79StVA=", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha1-YCFu6kZNhkWXzigyAAc4oFiWUME=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha1-wETV3MUhoHZBNHJZehrLHxA8QEE=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha1-hAyIA7DYBH9P8M+WMXazLU7z7XI=", "dev": true, "license": "MIT" }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha1-FPja7G2B5yIdKjV+Zoyrc728p5Q=", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha1-Eyh1q95njH6o1pFTPy5+Irt0Tbo=", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha1-VtwiNo7lcPrOG0mBmXXZuaXq0hQ=", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@types/mocha": { "version": "5.2.7", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/@types/mocha/-/mocha-5.2.7.tgz", @@ -46,21 +154,48 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "10.17.60", - "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/@types/node/-/node-10.17.60.tgz", - "integrity": "sha1-NfPWIT2u2V2n8Pc+dbzGmA6QWXs=", + "version": "20.19.25", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/@types/node/-/node-20.19.25.tgz", + "integrity": "sha1-Rn2pSi/ZZrV8w5w1ckfWgEdhEZA=", "dev": true, - "license": "MIT" + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } }, "node_modules/@types/shelljs": { - "version": "0.8.15", - "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/@types/shelljs/-/shelljs-0.8.15.tgz", - "integrity": "sha1-Isarnf4FzsV9jmyxqV6hc67p/Kw=", + "version": "0.8.17", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/@types/shelljs/-/shelljs-0.8.17.tgz", + "integrity": "sha1-iyG493AVryY6fj5Qk/8rdzIORdI=", "dev": true, "license": "MIT", "dependencies": { - "@types/glob": "~7.2.0", - "@types/node": "*" + "@types/node": "*", + "glob": "^11.0.3" + } + }, + "node_modules/@types/shelljs/node_modules/glob": { + "version": "11.1.0", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/glob/-/glob-11.1.0.tgz", + "integrity": "sha1-T4JlduTrmcfa04N5PS+fCPZ+UKY=", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "foreground-child": "^3.3.1", + "jackspeak": "^4.1.1", + "minimatch": "^10.1.1", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/adm-zip": { @@ -300,6 +435,21 @@ "dev": true, "license": "MIT" }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha1-ilj+ePANzXDDcEUXWd+/rwPo7p8=", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/debug": { "version": "4.4.1", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/debug/-/debug-4.4.1.tgz", @@ -341,6 +491,13 @@ "node": ">=0.3.1" } }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha1-aWzi7Aqg5uqTo5f/zySqeEDIJ8s=", + "dev": true, + "license": "MIT" + }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -432,6 +589,23 @@ } } }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha1-Mujp7Rtoo0l777msK2rfkqY4V28=", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -700,6 +874,29 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true, + "license": "ISC" + }, + "node_modules/jackspeak": { + "version": "4.1.1", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/jackspeak/-/jackspeak-4.1.1.tgz", + "integrity": "sha1-lodgMPRQUCBH/H6Mf8+M6BJOQ64=", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/js-yaml/-/js-yaml-4.1.0.tgz", @@ -746,6 +943,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/lru-cache": { + "version": "11.2.2", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/lru-cache/-/lru-cache-11.2.2.tgz", + "integrity": "sha1-QP037f/PrkspQDecByLcbuqnXyQ=", + "dev": true, + "license": "ISC", + "engines": { + "node": "20 || >=22" + } + }, "node_modules/mime-db": { "version": "1.52.0", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/mime-db/-/mime-db-1.52.0.tgz", @@ -770,13 +977,13 @@ } }, "node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha1-zgUhhWtFPIbiXyxMDQPm/33cRAs=", + "version": "10.1.1", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/minimatch/-/minimatch-10.1.1.tgz", + "integrity": "sha1-5uYbmwwdyrEWtafRRY6LaunnOlU=", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^2.0.1" + "@isaacs/brace-expansion": "^5.0.0" }, "engines": { "node": "20 || >=22" @@ -785,6 +992,16 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha1-k6libOXl5mvU24aEnnUV6SNApwc=", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/mocha": { "version": "10.8.2", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/mocha/-/mocha-10.8.2.tgz", @@ -927,6 +1144,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha1-TxRxoBCCeob5TP2bByfjbSZ95QU=", + "dev": true, + "license": "BlueOak-1.0.0" + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/path-exists/-/path-exists-4.0.0.tgz", @@ -947,6 +1171,16 @@ "node": ">=0.10.0" } }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/path-parse/-/path-parse-1.0.7.tgz", @@ -954,6 +1188,23 @@ "dev": true, "license": "MIT" }, + "node_modules/path-scurry": { + "version": "2.0.1", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/path-scurry/-/path-scurry-2.0.1.tgz", + "integrity": "sha1-S2VyN2z9i4EfypzR9cJLPLrA/hA=", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/picomatch": { "version": "2.3.1", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/picomatch/-/picomatch-2.3.1.tgz", @@ -1071,6 +1322,29 @@ "randombytes": "^2.1.0" } }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/shelljs": { "version": "0.8.5", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/shelljs/-/shelljs-0.8.5.tgz", @@ -1089,6 +1363,19 @@ "node": ">=4" } }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha1-lSGIwcvVRgcOLdIND0HArgUwywQ=", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/string-width/-/string-width-4.2.3.tgz", @@ -1104,6 +1391,22 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha1-JpxxF9J7Ba0uU2gwqOyJXvnG0BA=", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/strip-ansi/-/strip-ansi-6.0.1.tgz", @@ -1117,6 +1420,20 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha1-nibGPTD1NEPpSJSVshBdN7Z6hdk=", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -1183,9 +1500,9 @@ } }, "node_modules/typescript": { - "version": "4.0.2", - "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/typescript/-/typescript-4.0.2.tgz", - "integrity": "sha1-fqfIh3fHI8aB4zv3mIvl0AjQWsI=", + "version": "5.9.3", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha1-W09Z4VMQqxeiFvXWz1PuR27eZw8=", "dev": true, "license": "Apache-2.0", "bin": { @@ -1193,9 +1510,16 @@ "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha1-aR0ArzkJvpOn+qE75hs6W1DvEss=", + "dev": true, + "license": "MIT" + }, "node_modules/utf8-byte-length": { "version": "1.0.5", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/utf8-byte-length/-/utf8-byte-length-1.0.5.tgz", @@ -1203,6 +1527,22 @@ "dev": true, "license": "(WTFPL OR MIT)" }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/which/-/which-2.0.2.tgz", + "integrity": "sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/workerpool": { "version": "6.5.1", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/workerpool/-/workerpool-6.5.1.tgz", @@ -1228,6 +1568,25 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha1-Z+FFz/UQpqaYS98RUpEdadLrnkM=", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/wrappy/-/wrappy-1.0.2.tgz", diff --git a/powershell/package.json b/powershell/package.json index 811761d2f..0077a95f7 100644 --- a/powershell/package.json +++ b/powershell/package.json @@ -10,13 +10,13 @@ "license": "MIT", "devDependencies": { "@types/mocha": "^5.2.7", - "@types/node": "^10.17.60", + "@types/node": "^20.0.0", "@types/shelljs": "^0.8.14", "adm-zip": "^0.5.9", - "mocha": "10.8.2", "minimatch": "^10.0.0", + "mocha": "10.8.2", "nodejs-file-downloader": "^4.11.1", "shelljs": "^0.8.5", - "typescript": "4.0.2" + "typescript": "^5.4.5" } } diff --git a/powershell/publish.ps1 b/powershell/publish.ps1 index 49f76b36a..8de5dfcd4 100644 --- a/powershell/publish.ps1 +++ b/powershell/publish.ps1 @@ -3,8 +3,20 @@ param( [string]$ApiKey ) -# Install newest version of powershell management api -Install-Module -Name Microsoft.PowerShell.PSResourceGet +# Install or update to the latest version of powershell management api +$moduleName = 'Microsoft.PowerShell.PSResourceGet' +$installedModule = Get-Module -ListAvailable -Name $moduleName | Sort-Object Version -Descending | Select-Object -First 1 +$latestModule = Find-Module -Name $moduleName -Repository PSGallery -ErrorAction SilentlyContinue + +if (-not $installedModule) { + Write-Host "Installing $moduleName..." + Install-Module -Name $moduleName -Force -Scope CurrentUser +} elseif ($latestModule -and $installedModule.Version -lt $latestModule.Version) { + Write-Host "Updating $moduleName from version $($installedModule.Version) to $($latestModule.Version)..." + Update-Module -Name $moduleName -Force +} else { + Write-Host "$moduleName is already up to date (Version: $($installedModule.Version))" +} $makePath = Join-Path $PSScriptRoot 'make.js' & node $makePath build @@ -18,4 +30,5 @@ $publishOptions = @{ Repository = 'PSGallery' Verbose = $true } +Write-Host "Publishing module from $moduleBuildPath to PSGallery..." Publish-PSResource @publishOptions