From 8dcaadb3324d4156f1efdcfa24fa18516fae26ad Mon Sep 17 00:00:00 2001 From: jin Date: Thu, 7 Nov 2024 19:39:07 +0300 Subject: [PATCH] $mol_build: npm version fix --- build/build.node.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/build/build.node.ts b/build/build.node.ts index bedf33db51..755baab953 100644 --- a/build/build.node.ts +++ b/build/build.node.ts @@ -1376,10 +1376,10 @@ namespace $ { name = json.name || name try { - - const published = ( [] as string[] ).concat( JSON.parse( - this.$.$mol_run( { command: ['npm', 'view' , name , 'versions', '--json'], dir: '' } ).stdout.toString() - ) ).slice(-1)[0].split('.').map( Number ) + + const result = this.$.$mol_run( { command: ['npm', 'view' , name , 'versions', '--json'], dir: '.' } ) + const versions = ( [] as string[] ).concat( JSON.parse( result.stdout.toString() ) ) + const published = versions.at(-1)?.split('.').map( Number ) ?? [ 0, 0, 0 ] if( published[0] > version[0] ) { version = published @@ -1391,9 +1391,8 @@ namespace $ { version[2] = published[2] } - } catch (e) { - if ($mol_promise_like(e)) $mol_fail_hidden(e) - $mol_fail_log(e) + } catch( error ) { + $mol_fail_log( error ) } ++ version[2]