mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 17:49:53 +00:00
fix(sass): manually match arches { arm: armv7, ia32: x86, x64: amd64 }
This commit is contained in:
@@ -1,21 +1,46 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var github = require('../_common/github.js');
|
let Releases = module.exports;
|
||||||
var owner = 'sass';
|
|
||||||
var repo = 'dart-sass';
|
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;
|
return all;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
if (module === require.main) {
|
if (module === require.main) {
|
||||||
module.exports().then(function (all) {
|
Releases.latest().then(function (all) {
|
||||||
all = require('../_webi/normalize.js')(all);
|
all = require('../_webi/normalize.js')(all);
|
||||||
// just select the first 5 for demonstration
|
// 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));
|
console.info(JSON.stringify(all, null, 2));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user