@@ -24,21 +24,21 @@ program
2424 throw new Error ( `Couldn't find ${ framework } .` ) ;
2525 }
2626 // TODO detirmine the appropriate fallback pattern
27- const versionStackRank = [
27+ /* const versionStackRank = [
2828 `~${version.major}.${version.minor}.0`, // major.minor production match
2929 `~${version.major}.${version.minor}.0-0`, // major.minor rc match
3030 `^${version.major}.0.0 <${version.major}.${version.minor}.0`, // older production match
3131 `^${version.major}.${version.minor + 1}.0`, // newer production match
32- ] . join ( " || " ) ;
32+ ];*/
3333 const adapterName = `@apphosting/adapter-${ framework } ` ;
34- // TODO add types here
35- let npmInfo = JSON . parse ( spawnSync ( "npm" , [ "info" , `${ adapterName } @" ${ versionStackRank } " ` , "--json" ] ) . stdout . toString ( ) ) ;
36- if ( npmInfo . error ) npmInfo = JSON . parse ( spawnSync ( "npm" , [ "info" , adapterName , "--json" ] ) . stdout . toString ( ) ) ;
34+ // TODO add types here, use @next for now
35+ let npmInfo = JSON . parse ( spawnSync ( "npm" , [ "info" , `${ adapterName } @next ` , "--json" ] ) . stdout . toString ( ) ) ;
36+ // if (npmInfo.error) npmInfo = JSON.parse(spawnSync("npm", ["info", adapterName, "--json"]).stdout.toString());
3737 if ( npmInfo . error ) {
3838 throw new Error ( npmInfo . error . detail )
3939 }
40- npmInfo = [ ] . concat ( npmInfo ) ;
41- npmInfo = npmInfo . filter ( ( it :any ) => ! it . version . includes ( '-canary.' ) ) . sort ( ( a :any , b :any ) => new Date ( b . time [ b . version ] ) . getTime ( ) - new Date ( a . time [ a . version ] ) . getTime ( ) ) [ 0 ] ;
40+ // npmInfo = [].concat(npmInfo);
41+ // npmInfo = npmInfo.filter((it:any) => !it.version.includes('-canary.')).sort((a:any,b:any) => new Date(b.time[b.version]).getTime() - new Date(a.time[a.version]).getTime())[0];
4242 const adapterVersion = semverParse ( npmInfo . version ) ;
4343 if ( ! adapterVersion ) throw new Error ( `Unable to parse ${ adapterVersion } ` ) ;
4444 // TODO actually write a reasonable error message here & use a generator function
0 commit comments