2019-01-07 20:07:32 +00:00
|
|
|
#!/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");
|
|
|
|
|
2019-01-07 21:27:05 +00:00
|
|
|
var filename = path.resolve(path.dirname(process.env["TW5_BUILD_TIDDLYWIKI"]),"./package.json"),
|
|
|
|
json = JSON.parse(fs.readFileSync(filename,"utf8"));
|
|
|
|
|
2019-01-07 20:07:32 +00:00
|
|
|
if(!json.version) {
|
|
|
|
throw "Missing version number in package.json";
|
|
|
|
}
|
|
|
|
|
2019-01-08 10:34:50 +00:00
|
|
|
process.stdout.write("v" + json.version.split("-")[0]);
|