Allow for nightly SVR.JS versions
This commit is contained in:
parent
b512233577
commit
3aae68c2f2
2 changed files with 8 additions and 5 deletions
|
@ -16,7 +16,6 @@ if(!version) {
|
||||||
console.log(" 'latest' -> latest SVR.JS version");
|
console.log(" 'latest' -> latest SVR.JS version");
|
||||||
console.log(" 'lts' -> latest LTS SVR.JS version");
|
console.log(" 'lts' -> latest LTS SVR.JS version");
|
||||||
console.log(" '3.6.1' -> SVR.JS 3.6.1");
|
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") {
|
} else if(version == "latest" || version == "lts") {
|
||||||
https.get({
|
https.get({
|
||||||
hostname: "svrjs.org",
|
hostname: "svrjs.org",
|
||||||
|
@ -55,18 +54,22 @@ if(!version) {
|
||||||
downloadSVRJS(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({
|
https.get({
|
||||||
hostname: "svrjs.org",
|
hostname: "svrjs.org",
|
||||||
port: 443,
|
port: 443,
|
||||||
path: "/dl/svr.js." + version + ".zip",
|
path: path,
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
"User-Agent": "create-svrjs-server"
|
"User-Agent": "create-svrjs-server"
|
||||||
}
|
}
|
||||||
}, function(res) {
|
}, function(res) {
|
||||||
if(res.statusCode != 200) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
var zipFile = fs.createWriteStream("svrjs.zip");
|
var zipFile = fs.createWriteStream("svrjs.zip");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "svrjs",
|
"name": "svrjs",
|
||||||
"version": "3.6.1-stub",
|
"version": "3.6.1-stub3",
|
||||||
"description": "A web server running on Node.JS",
|
"description": "A web server running on Node.JS",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Loading…
Reference in a new issue