File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,17 @@ module.exports = {
17
17
if ( version ) return version ;
18
18
19
19
var package = JSON . parse ( fs . readFileSync ( 'package.json' , 'UTF-8' ) ) ;
20
- // TODO(brian): change `(-|rc)` to `-` in the regex below after bower
21
- // fixes this issue: https://github.com/bower/bower/issues/782
22
- var match = package . version . match ( / ^ ( [ ^ \- ] * ) (?: ( - | r c ) ( .+ ) ) ? $ / ) ;
20
+ var match = package . version . match ( / ^ ( [ ^ \- ] * ) (?: \- ( .+ ) ) ? $ / ) ;
23
21
var semver = match [ 1 ] . split ( '.' ) ;
24
22
var hash = shell . exec ( 'git rev-parse --short HEAD' , { silent : true } ) . output . replace ( '\n' , '' ) ;
25
23
26
- var fullVersion = ( match [ 1 ] + ( match [ 2 ] ? '-' + hash : '' ) ) ;
24
+ var fullVersion = match [ 1 ] ;
25
+
26
+ if ( match [ 2 ] ) {
27
+ fullVersion += '-' ;
28
+ fullVersion += ( match [ 2 ] == 'snapshot' ) ? hash : match [ 2 ] ;
29
+ }
30
+
27
31
version = {
28
32
full : fullVersion ,
29
33
major : semver [ 0 ] ,
You can’t perform that action at this time.
0 commit comments