refactor: finish moving ssh-* scripts to own installers
[webi-installers/.git] / node / releases.js
index c179da6f039ecd912d46977b8c32de8c4e944a72..04c6a548fde3db748f064a22656ed0ed2f9a7105 100644 (file)
@@ -5,7 +5,7 @@ var map = {
   // OSes
   osx: 'macos',
   linux: 'linux',
-  win: 'windows',
+  win: 'windows', // windows
   sunos: 'sunos',
   aix: 'aix',
   // CPU architectures
@@ -71,7 +71,8 @@ function getAllReleases(request) {
 
         var even = 0 === rel.version.slice(1).split('.')[0] % 2;
         var r = {
-          version: rel.version,
+          // nix leading 'v'
+          version: rel.version.slice(1),
           date: rel.date,
           lts: !!rel.lts,
           // historically odd releases have been beta and even have been stable
@@ -103,7 +104,7 @@ function getAllReleases(request) {
 
         if ('macos' === os) {
           r.download += '-darwin';
-        } else if ('win' === os) {
+        } else if ('windows' === os) {
           r.download += '-win';
         } else {
           r.download += '-' + os;
@@ -123,11 +124,11 @@ function getAllReleases(request) {
         r.download += '.' + ext;
 
         if ('tar.gz' === ext) {
-          r.download += '.xz';
-          r.ext = '.tar.xz';
+          r.download = r.download.replace(/\.tar\.gz$/, '.tar.xz');
+          r.ext = 'tar.xz';
           all.releases.push(JSON.parse(JSON.stringify(r)));
-          r.download = r.download.replace(/\.xz$/, '.gz');
-          r.ext = '.tar.gz';
+          r.download = r.download.replace(/\.tar\.xz$/, '.tar.gz');
+          r.ext = 'tar.gz';
         }
       });
     });
@@ -139,7 +140,8 @@ module.exports = getAllReleases;
 
 if (module === require.main) {
   getAllReleases(require('@root/request')).then(function (all) {
-    console.log(JSON.stringify(all));
-    //console.log(JSON.stringify(all, null, 2));
+    all = require('../_webi/normalize.js')(all);
+    console.info(JSON.stringify(all));
+    //console.info(JSON.stringify(all, null, 2));
   });
 }