File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ const pack = async (args) => {
2727
2828 for ( const tar of tarballs ) {
2929 logTar ( tar , { log, unicode } )
30- output ( tar . filename )
30+ output ( tar . filename . replace ( / ^ @ / , '' ) . replace ( / \/ / , '-' ) )
3131 }
3232}
3333
@@ -36,6 +36,7 @@ const pack_ = async (arg, opts) => {
3636 const { dryRun } = opts
3737 const manifest = await pacote . manifest ( spec , opts )
3838 const filename = `${ manifest . name } -${ manifest . version } .tgz`
39+ . replace ( / ^ @ / , '' ) . replace ( / \/ / , '-' )
3940 const tarballData = await libpack ( arg , opts )
4041 const pkgContents = await getContents ( manifest , tarballData )
4142
Original file line number Diff line number Diff line change @@ -78,6 +78,40 @@ t.test('should pack given directory', (t) => {
7878 } )
7979} )
8080
81+ t . test ( 'should pack given directory for scoped package' , ( t ) => {
82+ const testDir = t . testdir ( {
83+ 'package.json' : JSON . stringify ( {
84+ name : '@cool/my-pkg' ,
85+ version : '1.0.0'
86+ } , null , 2 )
87+ } )
88+
89+ const pack = requireInject ( '../../lib/pack.js' , {
90+ '../../lib/utils/output.js' : output ,
91+ '../../lib/npm.js' : {
92+ flatOptions : {
93+ unicode : true ,
94+ json : true ,
95+ dryRun : true
96+ }
97+ } ,
98+ libnpmpack,
99+ npmlog : {
100+ notice : ( ) => { } ,
101+ 'showProgress' : ( ) => { } ,
102+ 'clearProgress' : ( ) => { }
103+ }
104+ } )
105+
106+ return pack ( [ testDir ] , er => {
107+ if ( er ) {
108+ throw er
109+ }
110+ const filename = 'cool-my-pkg-1.0.0.tgz'
111+ t . strictSame ( OUTPUT , [ [ filename ] ] )
112+ } )
113+ } )
114+
81115t . test ( 'should log pack contents' , ( t ) => {
82116 const pack = requireInject ( '../../lib/pack.js' , {
83117 '../../lib/utils/output.js' : output ,
You can’t perform that action at this time.
0 commit comments