(unreviewed)
| 130 | } |
| 131 | |
| 132 | runPending (unreviewed) { |
| 133 | if (this.npm.flatOptions.json) { |
| 134 | output.buffer({ allowScripts: this.pendingSummary(unreviewed) }) |
| 135 | return |
| 136 | } |
| 137 | if (unreviewed.length === 0) { |
| 138 | output.standard('No packages with unreviewed install scripts.') |
| 139 | return |
| 140 | } |
| 141 | const count = unreviewed.length |
| 142 | const has = count === 1 ? 'has' : 'have' |
| 143 | const pkg = count === 1 ? 'package' : 'packages' |
| 144 | output.standard( |
| 145 | `${count} ${pkg} ${has} install scripts not yet covered by allowScripts:` |
| 146 | ) |
| 147 | for (const { node, scripts } of unreviewed) { |
| 148 | const { name, version } = trustedDisplay(node) |
| 149 | /* istanbul ignore next: every test node has a name */ |
| 150 | const display = name || '<unknown>' |
| 151 | const ver = version ? `@${version}` : '' |
| 152 | const events = Object.entries(scripts) |
| 153 | .map(([event, cmd]) => `${event}: ${cmd}`) |
| 154 | .join('; ') |
| 155 | output.standard(` ${display}${ver} (${events})`) |
| 156 | } |
| 157 | output.standard('') |
| 158 | output.standard( |
| 159 | 'Run `npm install-scripts approve <pkg>` to allow, ' + |
| 160 | 'or `npm install-scripts deny <pkg>` to deny.' |
| 161 | ) |
| 162 | } |
| 163 | |
| 164 | // Build the same `{ name, changes }` shape printSummary uses for writes, |
| 165 | // but tag every entry as `pending` since nothing is written. Names and |
no test coverage detected