@@ -12,7 +12,8 @@ if (os.platform() === 'win32') {
1212
1313const getExpectedCliVersion = ( ) => {
1414 const packageVersion = require ( './package.json' ) . version ;
15- return packageVersion . split ( '+' ) [ 0 ] ;
15+ const parts = packageVersion . split ( '.' ) ;
16+ return parts [ 0 ] + '.' + parts [ 1 ] + '.0' ;
1617} ;
1718
1819const isBinaryInstalled = ( ) => {
@@ -60,7 +61,7 @@ const buildDownloadBinaryUrl = (version) => {
6061
6162async function installBinary ( ) {
6263 const packageVersion = require ( './package.json' ) . version ;
63- const cliVersion = packageVersion . split ( '-' ) [ 0 ] ;
64+ const cliVersion = getExpectedCliVersion
6465 const downloadUrl = buildDownloadBinaryUrl ( cliVersion ) ;
6566 if ( ! fs . existsSync ( path . join ( __dirname , 'bin' ) ) ) {
6667 fs . mkdirSync ( path . join ( __dirname , 'bin' ) ) ;
@@ -84,6 +85,11 @@ async function installBinary() {
8485 console . log ( 'Making binary executable...' ) ;
8586 fs . chmodSync ( binaryPath , 0o755 ) ;
8687 }
88+
89+ // Ensure binary exists and is executable before continuing
90+ if ( ! fs . existsSync ( binaryPath ) ) {
91+ throw new Error ( 'Binary file was not created!' ) ;
92+ }
8793}
8894
8995const linkToNodeModulesBin = ( ) => {
0 commit comments