1- const util = require ( 'util' )
21const pacote = require ( 'pacote' )
32const libpack = require ( 'libnpmpack' )
43const npa = require ( 'npm-package-arg' )
5- const path = require ( 'path' )
64const log = require ( '../utils/log-shim' )
75const { getContents, logTar } = require ( '../utils/tar.js' )
8- const writeFile = util . promisify ( require ( 'fs' ) . writeFile )
96const BaseCommand = require ( '../base-command.js' )
107
118class Pack extends BaseCommand {
@@ -28,7 +25,6 @@ class Pack extends BaseCommand {
2825 }
2926
3027 const unicode = this . npm . config . get ( 'unicode' )
31- const dryRun = this . npm . config . get ( 'dry-run' )
3228 const json = this . npm . config . get ( 'json' )
3329
3430 // Get the manifests and filenames first so we can bail early on manifest
@@ -40,24 +36,15 @@ class Pack extends BaseCommand {
4036 if ( ! manifest . _id ) {
4137 throw new Error ( 'Invalid package, must have name and version' )
4238 }
43-
44- const filename = `${ manifest . name } -${ manifest . version } .tgz`
45- . replace ( / ^ @ / , '' ) . replace ( / \/ / , '-' )
46- manifests . push ( { arg, filename, manifest } )
39+ manifests . push ( { arg, manifest } )
4740 }
4841
4942 // Load tarball names up for printing afterward to isolate from the
5043 // noise generated during packing
5144 const tarballs = [ ]
52- for ( const { arg, filename , manifest } of manifests ) {
45+ for ( const { arg, manifest } of manifests ) {
5346 const tarballData = await libpack ( arg , this . npm . flatOptions )
5447 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-
6148 tarballs . push ( pkgContents )
6249 }
6350
0 commit comments