Allow for nightly SVR.JS versions

This commit is contained in:
svrjs 2023-07-31 23:04:36 +02:00
parent b512233577
commit 3aae68c2f2
2 changed files with 8 additions and 5 deletions

View file

@ -16,7 +16,6 @@ if(!version) {
console.log(" 'latest' -> latest SVR.JS version");
console.log(" 'lts' -> latest LTS SVR.JS version");
console.log(" '3.6.1' -> SVR.JS 3.6.1");
console.log("WARNING: Doesn't support nightly SVR.JS versions!");
} else if(version == "latest" || version == "lts") {
https.get({
hostname: "svrjs.org",
@ -55,18 +54,22 @@ if(!version) {
downloadSVRJS(version);
}
function downloadSVRJS(version) {
function downloadSVRJS(oversion) {
var version = oversion.toLowerCase().replace(/[^0-9a-z.]/g,".");
var path = "/dl/svr.js." + version + ".zip";
if(version.indexOf("beta") != -1) path = "/dl/beta/svr.js." + version + ".zip";
if(version.indexOf("nightly") != -1) path = "/dl/nightly/svr.js." + version + ".zip";
https.get({
hostname: "svrjs.org",
port: 443,
path: "/dl/svr.js." + version + ".zip",
path: path,
method: "GET",
headers: {
"User-Agent": "create-svrjs-server"
}
}, function(res) {
if(res.statusCode != 200) {
console.log("Server returns " + res.statusCode + " HTTP code while trying to download");
console.log("Server returns " + res.statusCode + " HTTP code while trying to download SVR.JS " + oversion);
return;
}
var zipFile = fs.createWriteStream("svrjs.zip");

View file

@ -1,6 +1,6 @@
{
"name": "svrjs",
"version": "3.6.1-stub",
"version": "3.6.1-stub3",
"description": "A web server running on Node.JS",
"main": "index.js",
"scripts": {