@@ -14,7 +14,8 @@ require("shelljs/make");
14
14
15
15
var checker = require ( "npm-license" ) ,
16
16
dateformat = require ( "dateformat" ) ,
17
- nodeCLI = require ( "shelljs-nodecli" ) ;
17
+ nodeCLI = require ( "shelljs-nodecli" ) ,
18
+ semver = require ( "semver" ) ;
18
19
19
20
//------------------------------------------------------------------------------
20
21
// Settings
@@ -69,8 +70,26 @@ function release(type) {
69
70
target . changelog ( ) ;
70
71
exec ( "git push origin master --tags" ) ;
71
72
exec ( "npm publish" ) ;
72
- target . gensite ( ) ;
73
- target . publishsite ( ) ;
73
+ }
74
+
75
+ /**
76
+ * Splits a command result to separate lines.
77
+ * @param {string } result The command result string.
78
+ * @returns {array } The separated lines.
79
+ */
80
+ function splitCommandResultToLines ( result ) {
81
+ return result . trim ( ) . split ( "\n" ) ;
82
+ }
83
+
84
+ function getVersionTags ( ) {
85
+ var tags = splitCommandResultToLines ( exec ( "git tag" , { silent : true } ) . output ) ;
86
+
87
+ return tags . reduce ( function ( list , tag ) {
88
+ if ( semver . valid ( tag ) ) {
89
+ list . push ( tag ) ;
90
+ }
91
+ return list ;
92
+ } , [ ] ) . sort ( semver . compare ) ;
74
93
}
75
94
76
95
//------------------------------------------------------------------------------
@@ -97,11 +116,11 @@ target.lint = function() {
97
116
errors ++ ;
98
117
}
99
118
100
- // echo("Validating JavaScript test files");
101
- // lastReturn = nodeCLI.exec("eslint", TEST_FILES);
102
- // if (lastReturn.code !== 0) {
103
- // errors++;
104
- // }
119
+ echo ( "Validating JavaScript test files" ) ;
120
+ lastReturn = nodeCLI . exec ( "eslint" , TEST_FILES ) ;
121
+ if ( lastReturn . code !== 0 ) {
122
+ errors ++ ;
123
+ }
105
124
106
125
if ( errors ) {
107
126
exit ( 1 ) ;
@@ -164,7 +183,7 @@ target.browserify = function() {
164
183
target . changelog = function ( ) {
165
184
166
185
// get most recent two tags
167
- var tags = exec ( "git tag" , { silent : true } ) . output . trim ( ) . split ( / \s / g ) ,
186
+ var tags = getVersionTags ( ) ,
168
187
rangeTags = tags . slice ( tags . length - 2 ) ,
169
188
now = new Date ( ) ,
170
189
timestamp = dateformat ( now , "mmmm d, yyyy" ) ;
@@ -188,14 +207,8 @@ target.changelog = function() {
188
207
rm ( "CHANGELOG.tmp" ) ;
189
208
rm ( "CHANGELOG.md" ) ;
190
209
mv ( "CHANGELOG.md.tmp" , "CHANGELOG.md" ) ;
191
-
192
- // add into commit
193
- exec ( "git add CHANGELOG.md" ) ;
194
- exec ( "git commit --amend --no-edit" ) ;
195
-
196
210
} ;
197
211
198
-
199
212
target . checkLicenses = function ( ) {
200
213
201
214
function isPermissible ( dependency ) {
0 commit comments