1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-26 10:00:34 +00:00
TiddlyWiki5/bin/get-version-number

22 lines
594 B
Plaintext
Raw Normal View History

#!/usr/bin/env node
// Extract raw version number from package.json (without the optional "-prerelease" suffix)
if(!process.env["TW5_BUILD_TIDDLYWIKI"]) {
throw "TW5_BUILD_TIDDLYWIKI environment variable not set";
}
var fs = require("fs"),
path = require("path");
var filename = path.resolve(path.dirname(process.env["TW5_BUILD_TIDDLYWIKI"]),"./package.json"),
json = JSON.parse(fs.readFileSync(filename,"utf8"));
console.log("Extracting version from ",filename)
if(!json.version) {
throw "Missing version number in package.json";
}
process.stdout.write(json.version.split("-")[0]);