@@ -38,27 +38,46 @@ module.exports = function( Release ) {
38
38
}
39
39
} ,
40
40
41
+ npmTags : function ( ) {
42
+ var tags = [ "beta" ] ;
43
+
44
+ if ( ! Release . preRelease ) {
45
+ tags . push ( "latest" ) ;
46
+ }
47
+
48
+ return tags ;
49
+ } ,
50
+
41
51
_publishNpm : function ( ) {
42
52
if ( ! Release . npmPublish ) {
43
53
return ;
44
54
}
45
55
46
56
Release . chdir ( Release . dir . repo ) ;
47
57
48
- var npmCommand = "npm publish" ;
58
+ var name = Release . readPackage ( ) . name ,
59
+ npmTags = Release . npmTags ( ) ,
60
+ npmCommand = "npm publish --tag " + npmTags . pop ( ) ;
49
61
50
- if ( Release . preRelease ) {
51
- npmCommand += " --tag beta" ;
62
+ if ( Release . isTest ) {
63
+ console . log ( "Actual release would now publish to npm using:" ) ;
64
+ } else {
65
+ console . log ( "Publishing to npm, running:" ) ;
52
66
}
53
67
54
- if ( Release . isTest ) {
55
- console . log ( "Actual release would now publish to npm" ) ;
56
- console . log ( "Would run: " + npmCommand . cyan ) ;
57
- return ;
68
+ console . log ( " " + npmCommand . cyan ) ;
69
+ if ( ! Release . isTest ) {
70
+ Release . exec ( npmCommand ) ;
71
+ }
72
+
73
+ while ( npmTags . length ) {
74
+ npmCommand = "npm tag " + name + "@" + Release . newVersion + " " + npmTags . pop ( ) ;
75
+ console . log ( " " + npmCommand . cyan ) ;
76
+ if ( ! Release . isTest ) {
77
+ Release . exec ( npmCommand ) ;
78
+ }
58
79
}
59
80
60
- console . log ( "Publishing to npm, running " + npmCommand . cyan ) ;
61
- Release . exec ( npmCommand ) ;
62
81
console . log ( ) ;
63
82
}
64
83
} ) ;
0 commit comments