Skip to content

Commit 5db95b3

Browse files
isaacsnlf
authored andcommitted
pack: do not show individual files of bundled deps
We show a list of bundled dependencies, there's no need to ALSO show the individual files in each one. PR-URL: #2050 Credit: @isaacs Close: #2050 Reviewed-by: @nlf
1 parent f8f6e1f commit 5db95b3

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

lib/utils/tar.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
1-
'use strict'
2-
31
const tar = require('tar')
42
const ssri = require('ssri')
53
const npmlog = require('npmlog')
64
const byteSize = require('byte-size')
75
const columnify = require('columnify')
86

9-
module.exports = { logTar, getContents }
10-
11-
function logTar (tarball, opts = {}) {
7+
const logTar = (tarball, opts = {}) => {
128
const { unicode = false, log = npmlog } = opts
139
log.notice('')
1410
log.notice('', `${unicode ? '📦 ' : 'package:'} ${tarball.name}@${tarball.version}`)
1511
log.notice('=== Tarball Contents ===')
1612
if (tarball.files.length) {
1713
log.notice('', columnify(tarball.files.map((f) => {
1814
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), {
2118
include: ['size', 'path'],
2219
showHeaders: false,
2320
}))
@@ -49,7 +46,7 @@ function logTar (tarball, opts = {}) {
4946
log.notice('', '')
5047
}
5148

52-
async function getContents (manifest, tarball) {
49+
const getContents = async (manifest, tarball) => {
5350
const files = []
5451
const bundled = new Set()
5552
let totalEntries = 0
@@ -111,3 +108,5 @@ async function getContents (manifest, tarball) {
111108
bundled: Array.from(bundled),
112109
}
113110
}
111+
112+
module.exports = { logTar, getContents }

tap-snapshots/test-lib-utils-tar.js-TAP.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ exports[`test/lib/utils/tar.js TAP should log tarball contents > must match snap
1111
1212
=== Tarball Contents ===
1313
14-
4B node_modules/bundle-dep
15-
97B package.json
14+
97B package.json
1615
=== Bundled Dependencies ===
1716
1817
bundle-dep

0 commit comments

Comments
 (0)