Skip to content

Commit 8c9bf8b

Browse files
committed
Build: Fix commands in Makefile.js
1 parent e67721e commit 8c9bf8b

File tree

5 files changed

+33
-22
lines changed

5 files changed

+33
-22
lines changed

Makefile.js

+28-15
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ require("shelljs/make");
1414

1515
var checker = require("npm-license"),
1616
dateformat = require("dateformat"),
17-
nodeCLI = require("shelljs-nodecli");
17+
nodeCLI = require("shelljs-nodecli"),
18+
semver = require("semver");
1819

1920
//------------------------------------------------------------------------------
2021
// Settings
@@ -69,8 +70,26 @@ function release(type) {
6970
target.changelog();
7071
exec("git push origin master --tags");
7172
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);
7493
}
7594

7695
//------------------------------------------------------------------------------
@@ -97,11 +116,11 @@ target.lint = function() {
97116
errors++;
98117
}
99118

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+
}
105124

106125
if (errors) {
107126
exit(1);
@@ -164,7 +183,7 @@ target.browserify = function() {
164183
target.changelog = function() {
165184

166185
// get most recent two tags
167-
var tags = exec("git tag", { silent: true }).output.trim().split(/\s/g),
186+
var tags = getVersionTags(),
168187
rangeTags = tags.slice(tags.length - 2),
169188
now = new Date(),
170189
timestamp = dateformat(now, "mmmm d, yyyy");
@@ -188,14 +207,8 @@ target.changelog = function() {
188207
rm("CHANGELOG.tmp");
189208
rm("CHANGELOG.md");
190209
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-
196210
};
197211

198-
199212
target.checkLicenses = function() {
200213

201214
function isPermissible(dependency) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"npm-license": "^0.2.3",
4848
"optimist": "~0.6.0",
4949
"regenerate": "~0.5.4",
50-
"semver": "^4.1.0",
50+
"semver": "^4.1.1",
5151
"shelljs": "^0.3.0",
5252
"shelljs-nodecli": "^0.1.1",
5353
"unicode-6.3.0": "~0.1.0"

tests/lib/.eslintrc

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
env:
2+
mocha: true

tests/lib/attach-comments.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ describe("attachComment: true", function() {
5555
leche.withData(testFiles, function(filename) {
5656

5757
it("should produce correct AST when parsed with attachComments", function() {
58-
var input = shelljs.cat(filename + ".src.js"),
59-
output = require(path.resolve(__dirname, "../../", filename + ".ast.js"));
58+
var output = require(path.resolve(__dirname, "../../", filename + ".ast.js"));
59+
var input = shelljs.cat(filename + ".src.js");
6060

6161
var result = espree.parse(input, {
6262
loc: true,

tests/lib/tokenize.js

-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
//------------------------------------------------------------------------------
3232

3333
var assert = require("chai").assert,
34-
leche = require("leche"),
3534
espree = require("../../espree");
3635

3736
//------------------------------------------------------------------------------
@@ -98,6 +97,3 @@ describe("tokenize()", function() {
9897

9998

10099
});
101-
102-
103-

0 commit comments

Comments
 (0)