@@ -7,6 +7,8 @@ import { fileURLToPath } from 'url';
77const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) ) ;
88const resolve = ( ...args ) => path . resolve ( __dirname , ...args ) ;
99
10+ const MAX_TAGS_LIMIT = 64 ;
11+
1012const 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' ) , / ^ v e r s i o n _ ( \d + ) $ / , ( [ , maj ] ) => `${ maj } .0.0` ) ;
24+ const src = createRepo ( resolve ( '../binaryen' ) , / ^ v e r s i o n _ ( \d + ) (?: _ . * ) ? $ / , ( [ , maj ] ) => `${ maj } .0.0` ) ;
2325const dst = createRepo ( resolve ( '..' ) , / ^ v ( \d + \. \d + \. \d + ) (?: \- | $ ) / , ( [ , ver ] ) => ver ) ;
2426
2527async 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