update version 0.5.5 to 0.5.6
This commit is contained in:
55
toolers/compress.js
Normal file
55
toolers/compress.js
Normal file
@@ -0,0 +1,55 @@
|
||||
var fs = require("fs"),
|
||||
path = require('path'),
|
||||
exec = require("child_process").exec;
|
||||
|
||||
var getCompressFiles = function (root) {
|
||||
var res = [],
|
||||
files = fs.readdirSync(root);
|
||||
|
||||
files.forEach(function(file) {
|
||||
var pathname = root + '/' + file,
|
||||
stat = fs.lstatSync(pathname);
|
||||
|
||||
if (!stat.isDirectory()) {
|
||||
if (pathname.indexOf("mobile") < 0 && path.basename(pathname).indexOf(".min") < 0) {
|
||||
if (path.dirname(pathname).indexOf("css") > -1) {
|
||||
res.push("css-" + pathname);
|
||||
}
|
||||
|
||||
if (path.dirname(pathname).indexOf("js") > -1) {
|
||||
res.push("js-" + pathname);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = res.concat(getCompressFiles(pathname));
|
||||
}
|
||||
});
|
||||
return res;
|
||||
};
|
||||
|
||||
(function () {
|
||||
var compressFiles = getCompressFiles("..");
|
||||
|
||||
for (var i = 0; i < compressFiles.length; i++) {
|
||||
// skin js compress
|
||||
if (compressFiles[i].indexOf("js-") > -1) {
|
||||
var pathname = compressFiles[i].split("js-")[1];
|
||||
console.log("compress js:" + pathname);
|
||||
exec("uglifyjs " + pathname + " > " + path.dirname(pathname) + "/" + path.basename(pathname, ".js") + ".min.js", function (error, stdout, stderr) {
|
||||
if (error !== null) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
// skin css compress
|
||||
if (compressFiles[i].indexOf("css-") > -1) {
|
||||
var pathname = compressFiles[i].split("css-")[1];
|
||||
console.log("compress css:" + pathname);
|
||||
exec("lessc -compress " + pathname + " > " + path.dirname(pathname) + "/" + path.basename(pathname, ".css") + ".min.css", function (error, stdout, stderr) {
|
||||
if (error !== null) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
42
toolers/update-version.js
Normal file
42
toolers/update-version.js
Normal file
@@ -0,0 +1,42 @@
|
||||
var version = "",
|
||||
newVersion = "";
|
||||
|
||||
process.argv.forEach(function (val, index) {
|
||||
if (index === 2) {
|
||||
version = val;
|
||||
}
|
||||
|
||||
if (index === 3) {
|
||||
newVersion = val;
|
||||
}
|
||||
});
|
||||
|
||||
var fs = require("fs"),
|
||||
path = require('path');
|
||||
var getPropertiesFiles = function (root) {
|
||||
var res = [],
|
||||
files = fs.readdirSync(root);
|
||||
|
||||
files.forEach(function (file) {
|
||||
var pathname = root + '/' + file,
|
||||
stat = fs.lstatSync(pathname);
|
||||
|
||||
if (!stat.isDirectory()) {
|
||||
if (path.basename(pathname) === "skin.properties") {
|
||||
res.push(pathname);
|
||||
}
|
||||
} else {
|
||||
res = res.concat(getPropertiesFiles(pathname));
|
||||
}
|
||||
});
|
||||
return res;
|
||||
};
|
||||
|
||||
(function () {
|
||||
var skins = getPropertiesFiles("..");
|
||||
|
||||
for (var i = 0; i < skins.length; i++) {
|
||||
var file = fs.readFileSync(skins[i], "UTF-8");
|
||||
fs.writeFileSync(skins[i], file.replace("forSolo=" + version, "forSolo=" + newVersion), "UTF-8");
|
||||
}
|
||||
})();
|
Reference in New Issue
Block a user