Skip to content

Commit 13ada62

Browse files
authored
better
1 parent ffb9201 commit 13ada62

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

scripts/version.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { fileURLToPath } from 'url';
77
const __dirname = path.dirname(fileURLToPath(import.meta.url));
88
const resolve = (...args) => path.resolve(__dirname, ...args);
99

10+
const MAX_TAGS_LIMIT = 64;
11+
1012
const createRepo = (path, regex, mapVersion) => ({
1113
git: simpleGit(path),
1214
filter: tag => {
@@ -19,14 +21,15 @@ const createRepo = (path, regex, mapVersion) => ({
1921
});
2022

2123
// see: https://github.com/WebAssembly/binaryen/issues/1156
22-
const src = createRepo(resolve('../binaryen'), /^version_(\d+)$/, ([, maj]) => `${maj}.0.0`);
24+
const src = createRepo(resolve('../binaryen'), /^version_(\d+)(?:_.*)?$/, ([, maj]) => `${maj}.0.0`);
2325
const dst = createRepo(resolve('..'), /^v(\d+\.\d+\.\d+)(?:\-|$)/, ([, ver]) => ver);
2426

2527
async function latest(repo) {
2628
try {
27-
const tags = await repo.git.tags({ "--sort": "-committerdate" });
28-
for (let i = 0; i < tags.all.length; i++) {
29-
const tag = tags.all[i];
29+
const tagsRaw = await repo.git.raw(['tag', '--sort=-v:refname']);
30+
const allTags = tagsRaw.split('\n').filter(Boolean).slice(0, MAX_TAGS_LIMIT);
31+
32+
for (let tag of allTags) {
3033
const res = repo.filter(tag);
3134
if (res !== null) {
3235
return res;

0 commit comments

Comments
 (0)