refactor: finish moving ssh-* scripts to own installers
[webi-installers/.git] / shellcheck / releases.js
1 'use strict';
2
3 var github = require('../_common/github.js');
4 var owner = 'koalaman';
5 var repo = 'shellcheck';
6
7 module.exports = function (request) {
8   return github(request, owner, repo).then(function (all) {
9     all.releases = all.releases.filter(function (rel) {
10       // don't include meta versions as actual versions
11       if (
12         ['latest', 'stable'].includes(rel.version) ||
13         'v' !== rel.version[0]
14       ) {
15         return false;
16       }
17       return true;
18     });
19
20     all.releases.forEach(function (rel) {
21       // if there is no os or arch or source designation, and it's a .zip, it's Windows amd64
22       if (
23         !/(darwin|mac|linux|x86_64|arm|src|source)/i.test(rel.name) &&
24         /\.zip$/.test(rel.name)
25       ) {
26         rel.os = 'windows';
27         rel.arch = 'amd64';
28       }
29     });
30     return all;
31   });
32 };
33
34 if (module === require.main) {
35   module.exports(require('@root/request')).then(function (all) {
36     all = require('../_webi/normalize.js')(all);
37     // just select the first 5 for demonstration
38     all.releases = all.releases.slice(0, 5);
39     console.info(JSON.stringify(all, null, 2));
40   });
41 }