File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ const pack = async (args) => {
27
27
28
28
for ( const tar of tarballs ) {
29
29
logTar ( tar , { log, unicode } )
30
- output ( tar . filename )
30
+ output ( tar . filename . replace ( / ^ @ / , '' ) . replace ( / \/ / , '-' ) )
31
31
}
32
32
}
33
33
@@ -36,6 +36,7 @@ const pack_ = async (arg, opts) => {
36
36
const { dryRun } = opts
37
37
const manifest = await pacote . manifest ( spec , opts )
38
38
const filename = `${ manifest . name } -${ manifest . version } .tgz`
39
+ . replace ( / ^ @ / , '' ) . replace ( / \/ / , '-' )
39
40
const tarballData = await libpack ( arg , opts )
40
41
const pkgContents = await getContents ( manifest , tarballData )
41
42
Original file line number Diff line number Diff line change @@ -78,6 +78,40 @@ t.test('should pack given directory', (t) => {
78
78
} )
79
79
} )
80
80
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
+
81
115
t . test ( 'should log pack contents' , ( t ) => {
82
116
const pack = requireInject ( '../../lib/pack.js' , {
83
117
'../../lib/utils/output.js' : output ,
You can’t perform that action at this time.
0 commit comments