1
- const util = require ( 'util' )
2
1
const pacote = require ( 'pacote' )
3
2
const libpack = require ( 'libnpmpack' )
4
3
const npa = require ( 'npm-package-arg' )
5
- const path = require ( 'path' )
6
4
const log = require ( '../utils/log-shim' )
7
5
const { getContents, logTar } = require ( '../utils/tar.js' )
8
- const writeFile = util . promisify ( require ( 'fs' ) . writeFile )
9
6
const BaseCommand = require ( '../base-command.js' )
10
7
11
8
class Pack extends BaseCommand {
@@ -28,7 +25,6 @@ class Pack extends BaseCommand {
28
25
}
29
26
30
27
const unicode = this . npm . config . get ( 'unicode' )
31
- const dryRun = this . npm . config . get ( 'dry-run' )
32
28
const json = this . npm . config . get ( 'json' )
33
29
34
30
// Get the manifests and filenames first so we can bail early on manifest
@@ -40,24 +36,15 @@ class Pack extends BaseCommand {
40
36
if ( ! manifest . _id ) {
41
37
throw new Error ( 'Invalid package, must have name and version' )
42
38
}
43
-
44
- const filename = `${ manifest . name } -${ manifest . version } .tgz`
45
- . replace ( / ^ @ / , '' ) . replace ( / \/ / , '-' )
46
- manifests . push ( { arg, filename, manifest } )
39
+ manifests . push ( { arg, manifest } )
47
40
}
48
41
49
42
// Load tarball names up for printing afterward to isolate from the
50
43
// noise generated during packing
51
44
const tarballs = [ ]
52
- for ( const { arg, filename , manifest } of manifests ) {
45
+ for ( const { arg, manifest } of manifests ) {
53
46
const tarballData = await libpack ( arg , this . npm . flatOptions )
54
47
const pkgContents = await getContents ( manifest , tarballData )
55
- const tarballFilename = path . resolve ( this . npm . config . get ( 'pack-destination' ) , filename )
56
-
57
- if ( ! dryRun ) {
58
- await writeFile ( tarballFilename , tarballData )
59
- }
60
-
61
48
tarballs . push ( pkgContents )
62
49
}
63
50
0 commit comments