yarn auditってつかってますか
yarn auditコマンドはpackageの脆弱性のチェックを出力してくれるコマンドですが、普段の開発では脆弱性を意識することは少ないと思います。
なのでpipelinesでやる
サンプルのymlファイル
やっていることとしては、
・nodeをインストールし
・audit結果をHTML化してくれるpackageをインストールし
・auditを実行しつつHTML化し
・publishしpipelineの結果としてHTMLで見れるようにする
です。
audit.yml
trigger: none
pool:
vmImage: ubuntu-latest
steps:
- task: NodeTool@0
inputs:
versionSource: 'spec'
versionSpec: '18.x'
checkLatest: true
displayName: 'Install Node.js'
- script: yarn global add yarn-audit-html
displayName: 'yarn install yarn-audit-html'
- script: yarn audit --json | yarn-audit-html
displayName: 'audit'
- task: PublishHtmlReport@1
inputs:
reportDir: './yarn-audit.html'
- script: yarn audit --json | yarn-audit-html --fatal-exit-code
displayName: 'audit fatal'