mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 09:39:51 +00:00
fix(sass): manually match arches { arm: armv7, ia32: x86, x64: amd64 }
This commit is contained in:
@@ -1,21 +1,46 @@
|
||||
'use strict';
|
||||
|
||||
var github = require('../_common/github.js');
|
||||
var owner = 'sass';
|
||||
var repo = 'dart-sass';
|
||||
let Releases = module.exports;
|
||||
|
||||
let Github = require('../_common/github.js');
|
||||
let owner = 'sass';
|
||||
let repo = 'dart-sass';
|
||||
|
||||
// https://github.com/sass/dart-sass/releases/
|
||||
|
||||
/** @type {Object.<String, String>} */
|
||||
let archMap = {
|
||||
ia32: 'x86',
|
||||
x64: 'amd64',
|
||||
arm: 'armv7',
|
||||
};
|
||||
let keys = Object.keys(archMap);
|
||||
let keyList = keys.join('|');
|
||||
let archRe = new RegExp(`\\b(${keyList})\\b`);
|
||||
|
||||
Releases.latest = function () {
|
||||
return Github.getDistributables(null, owner, repo).then(function (all) {
|
||||
Object.assign(all, {
|
||||
_names: ['dart-sass', 'sass'],
|
||||
});
|
||||
|
||||
for (let asset of all.releases) {
|
||||
let m = asset.name.match(archRe);
|
||||
let arch = m?.[1];
|
||||
if (arch) {
|
||||
asset.arch = archMap[arch];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
return github(null, owner, repo).then(function (all) {
|
||||
all._names = ['dart-sass', 'sass'];
|
||||
return all;
|
||||
});
|
||||
};
|
||||
|
||||
if (module === require.main) {
|
||||
module.exports().then(function (all) {
|
||||
Releases.latest().then(function (all) {
|
||||
all = require('../_webi/normalize.js')(all);
|
||||
// just select the first 5 for demonstration
|
||||
all.releases = all.releases.slice(0, 5);
|
||||
all.releases = all.releases.slice(0, 10);
|
||||
console.info(JSON.stringify(all, null, 2));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user