| 306 | } |
| 307 | |
| 308 | printSummary (summary) { |
| 309 | if (this.npm.flatOptions.json) { |
| 310 | output.buffer({ allowScripts: summary }) |
| 311 | return |
| 312 | } |
| 313 | const verb = this.verb === 'approve' ? 'Approved' : 'Denied' |
| 314 | let touched = 0 |
| 315 | for (const { name, changes } of summary) { |
| 316 | if (changes.length === 0) { |
| 317 | continue |
| 318 | } |
| 319 | touched++ |
| 320 | output.standard(`${verb} ${name}:`) |
| 321 | for (const { key, change } of changes) { |
| 322 | output.standard(` ${change} ${key}`) |
| 323 | } |
| 324 | } |
| 325 | if (touched === 0) { |
| 326 | output.standard(`Nothing to ${this.verb}; allowScripts unchanged.`) |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | // `npm install-scripts prune`: drop package.json#allowScripts entries that no |
| 331 | // longer match an installed package with an install script. Edits only |