mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Use the version number from the package.json file
Instead of the old separate version.txt file
This commit is contained in:
parent
2e0e74a353
commit
898e86db79
@ -23,7 +23,7 @@ var Command = function(params,commander) {
|
||||
};
|
||||
|
||||
Command.prototype.execute = function() {
|
||||
this.commander.streams.output.write($tw.utils.getVersionString() + "\n");
|
||||
this.commander.streams.output.write($tw.version + "\n");
|
||||
return null; // No error
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,7 @@ exports.info = {
|
||||
};
|
||||
|
||||
exports.executeMacro = function() {
|
||||
return $tw.Tree.Text($tw.utils.getVersionString());
|
||||
return $tw.Tree.Text($tw.version);
|
||||
};
|
||||
|
||||
})();
|
||||
|
@ -249,36 +249,6 @@ exports.unHyphenateCss = function(propName) {
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Parse a version number string of the form "1.2.3", "1.2.3.a4", or "1.2.3.b4" into:
|
||||
{major: <number>, minor: <number>, revision: <number>, alpha: <number>, beta: <number>}
|
||||
*/
|
||||
exports.parseVersion = function(versionString) {
|
||||
versionString = versionString || "0.0.0";
|
||||
var components = versionString.split("."),
|
||||
version = {
|
||||
major: components[0] ? parseInt(components[0],10) : null,
|
||||
minor: components[1] ? parseInt(components[1],10) : null,
|
||||
revision: components[2] ? parseInt(components[2],10) : null
|
||||
};
|
||||
if(components[3]) {
|
||||
if(components[3].charAt(0) === "a") {
|
||||
version.alpha = parseInt(components[3].substr(1),10);
|
||||
} else if(components[3].charAt(0) === "b") {
|
||||
version.beta = parseInt(components[3].substr(1),10);
|
||||
}
|
||||
}
|
||||
return version;
|
||||
};
|
||||
|
||||
exports.getVersionString = function() {
|
||||
return ($tw.version.major || "0") + "." +
|
||||
($tw.version.minor || "0") + "." +
|
||||
($tw.version.revision || "0") +
|
||||
($tw.version.alpha ? ".a" + $tw.version.alpha : "") +
|
||||
($tw.version.beta ? ".b" + $tw.version.beta : "");
|
||||
};
|
||||
|
||||
/*
|
||||
Extract the version number from the meta tag or from the boot file
|
||||
*/
|
||||
@ -291,10 +261,10 @@ exports.extractVersionInfo = function() {
|
||||
for(var t=0; t<metatags.length; t++) {
|
||||
var m = metatags[t];
|
||||
if(m.name === "tiddlywiki-version") {
|
||||
return $tw.utils.parseVersion(m.content);
|
||||
return m.content;
|
||||
}
|
||||
}
|
||||
return $tw.utils.parseVersion();
|
||||
return null;
|
||||
};
|
||||
|
||||
} else {
|
||||
@ -302,7 +272,7 @@ exports.extractVersionInfo = function() {
|
||||
// Server version
|
||||
exports.extractVersionInfo = function() {
|
||||
var fs = require("fs");
|
||||
return $tw.utils.parseVersion(fs.readFileSync($tw.boot.bootPath + "/version.txt").toString("utf8"));
|
||||
return JSON.parse(fs.readFileSync($tw.boot.bootPath + "/../package.json")).version;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ type: text/x-tiddlywiki-html
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="application-name" content="TiddlyWiki" />
|
||||
<meta name="generator" content="TiddlyWiki" />
|
||||
<meta name="tiddlywiki-version" content="<<include "$:/core/version.txt" text/plain>>" />
|
||||
<meta name="tiddlywiki-version" content="<<version>>" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
|
@ -1 +0,0 @@
|
||||
5.0.0.a3
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "tiddlywiki",
|
||||
"preferGlobal": "true",
|
||||
"version": "0.0.1",
|
||||
"version": "5.0.0-alpha.4",
|
||||
"author": "Jeremy Ruston <jeremy@jermolene.com>",
|
||||
"description": "a reusable non-linear personal web notebook",
|
||||
"contributors": [
|
||||
|
Loading…
Reference in New Issue
Block a user