MCPcopy Create free account
hub / github.com/npm/cli / getAuditReport

Function getAuditReport

lib/utils/reify-output.js:151–175  ·  view source on GitHub ↗
(npm, report)

Source from the content-addressed store, hash-verified

149}
150
151const getAuditReport = (npm, report) => {
152 if (!report) {
153 return
154 }
155
156 // when in silent mode, we print nothing.
157 // the JSON output is going to just JSON.stringify() the report object.
158 const reporter = npm.silent ? 'quiet'
159 : npm.flatOptions.json ? 'quiet'
160 : npm.command !== 'audit' ? 'install'
161 : 'detail'
162 const defaultAuditLevel = npm.command !== 'audit' ? 'none' : 'low'
163 const auditLevel = npm.flatOptions.auditLevel || defaultAuditLevel
164
165 const res = npmAuditReport(report, {
166 reporter,
167 ...npm.flatOptions,
168 auditLevel,
169 chalk: npm.chalk,
170 })
171 if (npm.command === 'audit') {
172 process.exitCode = process.exitCode || res.exitCode
173 }
174 return res
175}
176
177const packagesChangedMessage = (npm, { added, removed, changed, audited }) => {
178 const msg = ['\n']

Callers 2

reifyOutputFunction · 0.85
printAuditReportFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected