File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -37,15 +37,21 @@ const version = async args => {
3737 case 0 :
3838 return list ( )
3939 case 1 :
40- return output ( await libversion ( args [ 0 ] , {
41- ...npm . flatOptions ,
42- path : npm . prefix ,
43- } ) )
40+ return version_ ( args )
4441 default :
4542 throw usage
4643 }
4744}
4845
46+ const version_ = async ( args ) => {
47+ const prefix = npm . flatOptions . tagVersionPrefix
48+ const version = await libversion ( args [ 0 ] , {
49+ ...npm . flatOptions ,
50+ path : npm . prefix ,
51+ } )
52+ return output ( `${ prefix } ${ version } ` )
53+ }
54+
4955const list = async ( ) => {
5056 const results = { }
5157 const { promisify } = require ( 'util' )
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ let result = []
66const noop = ( ) => null
77const npm = {
88 flatOptions : {
9+ tagVersionPrefix : 'v' ,
910 json : false ,
1011 } ,
1112 prefix : '' ,
@@ -144,17 +145,20 @@ t.test('with one arg', t => {
144145 t . deepEqual (
145146 opts ,
146147 {
148+ tagVersionPrefix : 'v' ,
147149 json : false ,
148150 path : '' ,
149151 } ,
150152 'should forward expected options'
151153 )
152- t . end ( )
154+ return '4.0.0'
153155 } ,
154156 } )
155157
156158 version ( [ 'major' ] , err => {
157159 if ( err )
158160 throw err
161+ t . same ( result , [ 'v4.0.0' ] , 'outputs the new version prefixed by the tagVersionPrefix' )
162+ t . end ( )
159163 } )
160164} )
You can’t perform that action at this time.
0 commit comments