diff --git a/cortex-js/package.json b/cortex-js/package.json index f396f9a37..14967019c 100644 --- a/cortex-js/package.json +++ b/cortex-js/package.json @@ -52,7 +52,7 @@ "class-transformer": "^0.5.1", "class-validator": "^0.14.1", "cli-progress": "^3.12.0", - "cortex-cpp": "^0.4.24", + "cortex-cpp": "^0.4.25", "cortexso-node": "^0.0.4", "cpu-instructions": "^0.0.11", "decompress": "^4.2.1", diff --git a/cortex-js/src/infrastructure/commanders/usecases/init.cli.usecases.ts b/cortex-js/src/infrastructure/commanders/usecases/init.cli.usecases.ts index 10ad01654..be4437820 100644 --- a/cortex-js/src/infrastructure/commanders/usecases/init.cli.usecases.ts +++ b/cortex-js/src/infrastructure/commanders/usecases/init.cli.usecases.ts @@ -223,14 +223,16 @@ export class InitCliUsecases { let release = res?.data; if (Array.isArray(res?.data)) { - release = Array(res?.data)[0] - .sort((a, b) => a.name.length - b.name.length) // Sort by length, sortest first - for matching accuracy - .find((e) => e.name === version.replace('v', '')); + release = Array(res?.data)[0].find( + (e) => e.name === version.replace('v', ''), + ); } // Find the asset for the current platform - const toDownloadAsset = release.assets.find((asset: any) => - matchers.every((matcher) => asset.name.includes(matcher)), - ); + const toDownloadAsset = release.assets + .sort((a: any, b: any) => a.name.length - b.name.length) + .find((asset: any) => + matchers.every((matcher) => asset.name.includes(matcher)), + ); if (!toDownloadAsset) { console.log(