Skip to content

Commit

Permalink
f: no-info exts
Browse files Browse the repository at this point in the history
  • Loading branch information
coolaj86 committed Nov 14, 2023
1 parent e294ba7 commit 0f951de
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions _webi/list-all-releases.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ let NON_BUILD_EXTS = [
'.sbom',
'.json',
'.asc',
'.d.ts',
// TODO: we could include these, and just sort them much lower
// neither macos nor linux have zstd by default
// don't be ridiculous!
Expand All @@ -63,24 +62,35 @@ let NON_BUILD_EXTS = [

// many assets are bare - we'd have to check if any contain a '.'
// in the name before using these as a whitelist
// (ordered by OS for clarity, by length for matching)
let BUILD_EXTS = [
'.exe',
'.msi',
// Windows
'.exe.zip',
'.exe.xz',
'.exe',
'.msi',
// macOS
'.app.zip',
'.dmg.zip',
'.dmg',
'.pkg',
// Nondescript
'.zip',
'.tar.gz',
'.tar.xz',
'.gz',
'.git',
'.xz',
'.dmg',
'.pkg',
// this could be a setup script, or the runnable, installable thing
// POSIX
// (also, could be the runnable, installable thing, or an install script)
'.sh',
// Any (font, vim script)
'.git',
];

// these don't provide any clues as to which OS is used
// (counter-examples: .exe (windows) .dmg (mac) .deb (linux)
let NON_INFORMATIVE_EXTS = ['.gz', '.xz', '.zstd', '.zip', '.tar'];

var wordMap = {};
var unknownMap = {};

Expand Down Expand Up @@ -411,7 +421,7 @@ async function pkgToTriples(name) {
continue;
}

triplish = replaceTriples(triplish);
//triplish = replaceTriples(triplish);

triples.push(triplish);
console.log(triplish);
Expand Down Expand Up @@ -547,9 +557,16 @@ function trimNameAndVersion(name, build, pkg) {
// trim the start of any url
//download = download.replace(/https:\/\/[^\/]+\//, '');

// trim flutter url
// trim URLs up to the first {FOO}
download = download.replace(/^[^{]+\//, '');

for (let ext of NON_INFORMATIVE_EXTS) {
let hasNonInformativeExt = download.endsWith(ext);
if (hasNonInformativeExt) {
download = download.slice(0, -ext.length);
}
}

let words = download.split(/[_\{\}\/\.\-]+/g);
for (let word of words) {
wordMap[word] = true;
Expand Down Expand Up @@ -777,7 +794,7 @@ async function main() {
continue;
}

triplish = replaceTriples(triplish);
//triplish = replaceTriples(triplish);

//let row = `${build.download}\t${build.version}\t${build.name}`;
//console.info(`${build.name}\t${build.download}`);
Expand Down

0 comments on commit 0f951de

Please sign in to comment.