Skip to content

Commit

Permalink
$mol_build: npm version fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jin committed Nov 7, 2024
1 parent 84026e6 commit 8dcaadb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions build/build.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]
Expand Down

0 comments on commit 8dcaadb

Please sign in to comment.