diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2e7d5a8300..574159b77a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,8 +9,28 @@ jobs: parallel: "4" pool: vmImage: ubuntu-latest - steps: + - powershell: | + # Gin up imitation v1 yarn.lock files to aid Component Governance Detection analysis. The method: + # Find v3 yarn-berry.lock files. From each, generate a yarn.lock file, deleting all occurrences of 'npm:'. + # This allows CG to work with yarn v3. + $find = 'npm:'; + $replace = ''; + + Get-ChildItem -Recurse -Path '**/yarn-berry.lock' | % { + $source = $_.FullName; + $dest = $_.DirectoryName + "/yarn.lock" + Write-Host $source; + Write-Host $dest; + Copy-Item -Path $source -Destination $dest -Force + + $content = Get-Content -Raw $dest; + $content -Replace "$find", "$replace" | Set-Content $dest; + + '--------------------'; get-content $dest; '===================='; + } + displayName: Generate "yarn.lock" files for CG Detection + continueOnError: true - task: UseDotNet@2 inputs: packageType: "runtime"