add version info to deno downloads

This commit is contained in:
AJ ONeal
2020-12-02 13:23:53 -07:00
committed by AJ ONeal
parent 5927fa9041
commit 448e66c339
2 changed files with 21 additions and 5 deletions
+2 -1
View File
@@ -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 + "'")
+19 -4
View File
@@ -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));
});
}