|
1 |
| -'use strict' |
2 |
| - |
3 | 1 | const tar = require('tar')
|
4 | 2 | const ssri = require('ssri')
|
5 | 3 | const npmlog = require('npmlog')
|
6 | 4 | const byteSize = require('byte-size')
|
7 | 5 | const columnify = require('columnify')
|
8 | 6 |
|
9 |
| -module.exports = { logTar, getContents } |
10 |
| - |
11 |
| -function logTar (tarball, opts = {}) { |
| 7 | +const logTar = (tarball, opts = {}) => { |
12 | 8 | const { unicode = false, log = npmlog } = opts
|
13 | 9 | log.notice('')
|
14 | 10 | log.notice('', `${unicode ? '📦 ' : 'package:'} ${tarball.name}@${tarball.version}`)
|
15 | 11 | log.notice('=== Tarball Contents ===')
|
16 | 12 | if (tarball.files.length) {
|
17 | 13 | log.notice('', columnify(tarball.files.map((f) => {
|
18 | 14 | const bytes = byteSize(f.size)
|
19 |
| - return { path: f.path, size: `${bytes.value}${bytes.unit}` } |
20 |
| - }), { |
| 15 | + return (/^node_modules\//.test(f.path)) ? null |
| 16 | + : { path: f.path, size: `${bytes.value}${bytes.unit}` } |
| 17 | + }).filter(f => f), { |
21 | 18 | include: ['size', 'path'],
|
22 | 19 | showHeaders: false,
|
23 | 20 | }))
|
@@ -49,7 +46,7 @@ function logTar (tarball, opts = {}) {
|
49 | 46 | log.notice('', '')
|
50 | 47 | }
|
51 | 48 |
|
52 |
| -async function getContents (manifest, tarball) { |
| 49 | +const getContents = async (manifest, tarball) => { |
53 | 50 | const files = []
|
54 | 51 | const bundled = new Set()
|
55 | 52 | let totalEntries = 0
|
@@ -111,3 +108,5 @@ async function getContents (manifest, tarball) {
|
111 | 108 | bundled: Array.from(bundled),
|
112 | 109 | }
|
113 | 110 | }
|
| 111 | + |
| 112 | +module.exports = { logTar, getContents } |
0 commit comments