hedgequantx 1.2.125 → 1.2.127
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/app.js +25 -6
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -666,7 +666,7 @@ const dashboardMenu = async (service) => {
|
|
|
666
666
|
* Handles the update process with auto-restart
|
|
667
667
|
*/
|
|
668
668
|
const handleUpdate = async () => {
|
|
669
|
-
const {
|
|
669
|
+
const { execSync: exec } = require('child_process');
|
|
670
670
|
const pkg = require('../package.json');
|
|
671
671
|
const currentVersion = pkg.version;
|
|
672
672
|
const spinner = ora('Checking for updates...').start();
|
|
@@ -679,38 +679,57 @@ const handleUpdate = async () => {
|
|
|
679
679
|
latestVersion = exec('npm view hedgequantx version', { stdio: 'pipe' }).toString().trim();
|
|
680
680
|
} catch (e) {
|
|
681
681
|
spinner.fail('Cannot reach npm registry');
|
|
682
|
+
console.log();
|
|
683
|
+
await inquirer.prompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
682
684
|
return;
|
|
683
685
|
}
|
|
684
686
|
|
|
685
687
|
if (currentVersion === latestVersion) {
|
|
686
688
|
spinner.succeed('Already up to date!');
|
|
687
|
-
console.log(
|
|
689
|
+
console.log();
|
|
690
|
+
console.log(chalk.green(` ✓ You have the latest version of HedgeQuantX CLI: v${currentVersion}`));
|
|
691
|
+
console.log();
|
|
692
|
+
await inquirer.prompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
688
693
|
return;
|
|
689
694
|
}
|
|
690
695
|
|
|
691
696
|
// Update via npm
|
|
692
697
|
spinner.text = `Updating v${currentVersion} -> v${latestVersion}...`;
|
|
693
698
|
try {
|
|
694
|
-
|
|
699
|
+
exec('npm install -g hedgequantx@latest', { stdio: 'pipe' });
|
|
695
700
|
} catch (e) {
|
|
696
701
|
spinner.fail('Update failed - try manually: npm install -g hedgequantx@latest');
|
|
697
702
|
console.log(chalk.gray(` Error: ${e.message}`));
|
|
703
|
+
console.log();
|
|
704
|
+
await inquirer.prompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
698
705
|
return;
|
|
699
706
|
}
|
|
700
707
|
|
|
701
708
|
spinner.succeed('CLI updated!');
|
|
702
709
|
console.log();
|
|
703
|
-
console.log(chalk.green(` Updated: v${currentVersion} -> v${latestVersion}`));
|
|
710
|
+
console.log(chalk.green(` ✓ Updated: v${currentVersion} -> v${latestVersion}`));
|
|
704
711
|
console.log();
|
|
705
|
-
console.log(chalk.cyan('
|
|
712
|
+
console.log(chalk.cyan(' Restarting HedgeQuantX CLI...'));
|
|
706
713
|
console.log();
|
|
707
714
|
|
|
708
|
-
//
|
|
715
|
+
// Small delay so user can see the message
|
|
716
|
+
await new Promise(resolve => setTimeout(resolve, 1500));
|
|
717
|
+
|
|
718
|
+
// Restart the CLI automatically
|
|
719
|
+
const { spawn } = require('child_process');
|
|
720
|
+
const child = spawn('hedgequantx', [], {
|
|
721
|
+
stdio: 'inherit',
|
|
722
|
+
detached: true,
|
|
723
|
+
shell: true
|
|
724
|
+
});
|
|
725
|
+
child.unref();
|
|
709
726
|
process.exit(0);
|
|
710
727
|
|
|
711
728
|
} catch (error) {
|
|
712
729
|
spinner.fail('Update failed: ' + error.message);
|
|
713
730
|
console.log(chalk.yellow(' Try manually: npm install -g hedgequantx@latest'));
|
|
731
|
+
console.log();
|
|
732
|
+
await inquirer.prompt([{ type: 'input', name: 'continue', message: 'Press Enter to continue...' }]);
|
|
714
733
|
}
|
|
715
734
|
};
|
|
716
735
|
|