lsh-framework 0.5.4 → 0.5.6
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/dist/commands/self.js +59 -3
- package/package.json +1 -1
package/dist/commands/self.js
CHANGED
|
@@ -60,7 +60,7 @@ async function fetchLatestVersion() {
|
|
|
60
60
|
const options = {
|
|
61
61
|
hostname: 'registry.npmjs.org',
|
|
62
62
|
port: 443,
|
|
63
|
-
path: '/
|
|
63
|
+
path: '/lsh-framework',
|
|
64
64
|
method: 'GET',
|
|
65
65
|
headers: {
|
|
66
66
|
'User-Agent': 'lsh-cli',
|
|
@@ -239,7 +239,7 @@ selfCommand
|
|
|
239
239
|
// Install update
|
|
240
240
|
console.log(chalk.cyan(`📦 Installing lsh ${latestVersion}...`));
|
|
241
241
|
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
242
|
-
const updateProcess = spawn(npmCmd, ['install', '-g', '
|
|
242
|
+
const updateProcess = spawn(npmCmd, ['install', '-g', 'lsh-framework@latest'], {
|
|
243
243
|
stdio: 'inherit',
|
|
244
244
|
});
|
|
245
245
|
updateProcess.on('close', (code) => {
|
|
@@ -249,7 +249,7 @@ selfCommand
|
|
|
249
249
|
}
|
|
250
250
|
else {
|
|
251
251
|
console.log(chalk.red('✗ Update failed'));
|
|
252
|
-
console.log(chalk.yellow('ℹ Try running with sudo: sudo npm install -g
|
|
252
|
+
console.log(chalk.yellow('ℹ Try running with sudo: sudo npm install -g lsh-framework@latest'));
|
|
253
253
|
}
|
|
254
254
|
});
|
|
255
255
|
}
|
|
@@ -315,4 +315,60 @@ selfCommand
|
|
|
315
315
|
console.log();
|
|
316
316
|
console.log(chalk.dim('For more info, visit: https://github.com/gwicho38/lsh'));
|
|
317
317
|
});
|
|
318
|
+
/**
|
|
319
|
+
* Uninstall command - remove LSH from the system
|
|
320
|
+
*/
|
|
321
|
+
selfCommand
|
|
322
|
+
.command('uninstall')
|
|
323
|
+
.description('Uninstall LSH from your system')
|
|
324
|
+
.option('-y, --yes', 'Skip confirmation prompt')
|
|
325
|
+
.action(async (options) => {
|
|
326
|
+
try {
|
|
327
|
+
console.log(chalk.yellow('╔════════════════════════════════════╗'));
|
|
328
|
+
console.log(chalk.yellow('║ Uninstall LSH Framework ║'));
|
|
329
|
+
console.log(chalk.yellow('╚════════════════════════════════════╝'));
|
|
330
|
+
console.log();
|
|
331
|
+
// Ask for confirmation unless --yes flag is used
|
|
332
|
+
if (!options.yes) {
|
|
333
|
+
const readline = await import('readline');
|
|
334
|
+
const rl = readline.createInterface({
|
|
335
|
+
input: process.stdin,
|
|
336
|
+
output: process.stdout,
|
|
337
|
+
});
|
|
338
|
+
const answer = await new Promise((resolve) => {
|
|
339
|
+
rl.question(chalk.yellow('Are you sure you want to uninstall LSH? (y/N) '), (ans) => {
|
|
340
|
+
rl.close();
|
|
341
|
+
resolve(ans);
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
if (answer.toLowerCase() !== 'y' && answer.toLowerCase() !== 'yes') {
|
|
345
|
+
console.log(chalk.yellow('Uninstall cancelled'));
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
console.log(chalk.cyan('📦 Uninstalling lsh-framework...'));
|
|
350
|
+
console.log();
|
|
351
|
+
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
352
|
+
const uninstallProcess = spawn(npmCmd, ['uninstall', '-g', 'lsh-framework'], {
|
|
353
|
+
stdio: 'inherit',
|
|
354
|
+
});
|
|
355
|
+
uninstallProcess.on('close', (code) => {
|
|
356
|
+
if (code === 0) {
|
|
357
|
+
console.log();
|
|
358
|
+
console.log(chalk.green('✓ LSH has been uninstalled successfully'));
|
|
359
|
+
console.log();
|
|
360
|
+
console.log(chalk.dim('Thank you for using LSH!'));
|
|
361
|
+
console.log(chalk.dim('You can reinstall anytime with: npm install -g lsh-framework'));
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
console.log();
|
|
365
|
+
console.log(chalk.red('✗ Uninstall failed'));
|
|
366
|
+
console.log(chalk.yellow('ℹ Try running with sudo: sudo npm uninstall -g lsh-framework'));
|
|
367
|
+
}
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
console.error(chalk.red('✗ Error during uninstall:'), error);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
318
374
|
export default selfCommand;
|