vmlive 1.0.10 → 1.0.11
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/cli.js +21 -1
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -680,6 +680,24 @@ const runLogin = async () => {
|
|
|
680
680
|
});
|
|
681
681
|
};
|
|
682
682
|
|
|
683
|
+
const runUpdate = async () => {
|
|
684
|
+
console.log('\x1b[36mUpdating vmlive to the latest version...\x1b[0m');
|
|
685
|
+
const { spawn } = await import('child_process');
|
|
686
|
+
|
|
687
|
+
const updateProcess = spawn('npm', ['install', 'vmlive@latest'], {
|
|
688
|
+
stdio: 'inherit'
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
updateProcess.on('exit', (code) => {
|
|
692
|
+
if (code === 0) {
|
|
693
|
+
console.log('\n\x1b[32m✔ vmlive updated successfully!\x1b[0m');
|
|
694
|
+
} else {
|
|
695
|
+
console.error(`\n\x1b[31m❌ Update failed with exit code ${code}\x1b[0m`);
|
|
696
|
+
}
|
|
697
|
+
process.exit(code || 0);
|
|
698
|
+
});
|
|
699
|
+
};
|
|
700
|
+
|
|
683
701
|
const main = async () => {
|
|
684
702
|
const command = process.argv[2];
|
|
685
703
|
if (command === 'init') {
|
|
@@ -692,12 +710,14 @@ const main = async () => {
|
|
|
692
710
|
await runLogin();
|
|
693
711
|
} else if (command === 'deploy') {
|
|
694
712
|
await runDeploy();
|
|
713
|
+
} else if (command === 'update') {
|
|
714
|
+
await runUpdate();
|
|
695
715
|
} else if (command === 'which' || command === '-v' || command === '--version' || command === 'v') {
|
|
696
716
|
const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json'), 'utf-8'));
|
|
697
717
|
console.log(`vmlive CLI v${pkg.version}`);
|
|
698
718
|
} else {
|
|
699
719
|
console.error(`\x1b[31m❌ Unknown command: ${command || 'missing'}\x1b[0m`);
|
|
700
|
-
console.log('Usage: vmlive init | vmlive add | vmlive dev | vmlive login | vmlive deploy | vmlive which');
|
|
720
|
+
console.log('Usage: vmlive init | vmlive add | vmlive dev | vmlive login | vmlive deploy | vmlive update | vmlive which');
|
|
701
721
|
process.exit(1);
|
|
702
722
|
}
|
|
703
723
|
};
|