(tarball, { unicode = false, json, key, redact } = {})
| 8 | }) |
| 9 | |
| 10 | const logTar = (tarball, { unicode = false, json, key, redact } = {}) => { |
| 11 | if (json) { |
| 12 | const meta = redact === false ? { [META]: true, redact: false } : undefined |
| 13 | output.buffer(key == null ? tarball : { [key]: tarball }, meta) |
| 14 | return |
| 15 | } |
| 16 | log.notice('') |
| 17 | log.notice('', `${unicode ? '📦 ' : 'package:'} ${tarball.name}@${tarball.version}`) |
| 18 | log.notice('Tarball Contents') |
| 19 | if (tarball.files.length) { |
| 20 | log.notice( |
| 21 | '', |
| 22 | tarball.files.map(f => |
| 23 | /^node_modules\//.test(f.path) ? null : `${formatBytes(f.size, false)} ${f.path}` |
| 24 | ).filter(f => f).join('\n') |
| 25 | ) |
| 26 | } |
| 27 | if (tarball.bundled.length) { |
| 28 | log.notice('Bundled Dependencies') |
| 29 | tarball.bundled.forEach(name => log.notice('', name)) |
| 30 | } |
| 31 | log.notice('Tarball Details') |
| 32 | log.notice('', `name: ${tarball.name}`) |
| 33 | log.notice('', `version: ${tarball.version}`) |
| 34 | if (tarball.filename) { |
| 35 | log.notice('', `filename: ${tarball.filename}`) |
| 36 | } |
| 37 | log.notice('', `package size: ${formatBytes(tarball.size)}`) |
| 38 | log.notice('', `unpacked size: ${formatBytes(tarball.unpackedSize)}`) |
| 39 | log.notice('', `shasum: ${tarball.shasum}`) |
| 40 | log.notice('', `integrity: ${tarball.integrity.toString().slice(0, 20)}[...]${tarball.integrity.toString().slice(80)}`) |
| 41 | if (tarball.bundled.length) { |
| 42 | log.notice('', `bundled deps: ${tarball.bundled.length}`) |
| 43 | log.notice('', `bundled files: ${tarball.entryCount - tarball.files.length}`) |
| 44 | log.notice('', `own files: ${tarball.files.length}`) |
| 45 | } |
| 46 | log.notice('', `total files: ${tarball.entryCount}`) |
| 47 | log.notice('', '') |
| 48 | } |
| 49 | |
| 50 | const getContents = async (manifest, tarball) => { |
| 51 | const files = [] |
no test coverage detected
searching dependent graphs…