From: AJ ONeal Date: Thu, 19 Nov 2020 04:57:02 +0000 (+0000) Subject: add version info to deno downloads X-Git-Url: https://git.josue.xyz/?a=commitdiff_plain;h=448e66c33985374d57e15cfb167de48b183d2e76;p=webi-installers%2F.git add version info to deno downloads --- diff --git a/_webi/releases.js b/_webi/releases.js index f5ef319..c7b0b51 100644 --- a/_webi/releases.js +++ b/_webi/releases.js @@ -42,6 +42,7 @@ Releases.renderBash = function ( .replace(/[^+\-]*/, '') .replace(/^-/, '') }; + var pkgFile = rel.filename || rel.name; return fs.promises .readFile(path.join(__dirname, 'template.sh'), 'utf8') .then(function (tplTxt) { @@ -113,7 +114,7 @@ Releases.renderBash = function ( ) .replace( /^#?WEBI_PKG_FILE=.*/m, - "WEBI_PKG_FILE='" + rel.name + "'" + "WEBI_PKG_FILE='" + pkgFile + "'" ) // PKG details .replace(/^#?PKG_NAME=.*/m, "PKG_NAME='" + pkg + "'") diff --git a/deno/releases.js b/deno/releases.js index 0a597a9..e32f5a9 100644 --- a/deno/releases.js +++ b/deno/releases.js @@ -1,5 +1,7 @@ 'use strict'; +var path = require('path'); + var github = require('../_common/github.js'); var owner = 'denoland'; var repo = 'deno'; @@ -7,9 +9,22 @@ var repo = 'deno'; module.exports = function (request) { return github(request, owner, repo).then(function (all) { // remove checksums and .deb - all.releases = all.releases.filter(function (rel) { - return !/(\.txt)|(\.deb)$/i.test(rel.name); - }); + all.releases = all.releases + .filter(function (rel) { + return !/(\.txt)|(\.deb)$/i.test(rel.name); + }) + .map(function (rel) { + var ext; + if (!rel.name.match(rel.version)) { + ext = path.extname(rel.name); + rel.filename = + rel.name.slice(0, rel.name.length - ext.length) + + '-' + + rel.version + + ext; + } + return rel; + }); return all; }); }; @@ -17,6 +32,6 @@ module.exports = function (request) { if (module === require.main) { module.exports(require('@root/request')).then(function (all) { all = require('../_webi/normalize.js')(all); - console.info(JSON.stringify(all)); + console.info(JSON.stringify(all, null, 2)); }); }