@exreve/exk 1.0.8 → 1.0.10
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/index.js +33 -2
- package/dist/ttc-cli.tar.gz +0 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -190,8 +190,8 @@ async function connect() {
|
|
|
190
190
|
/** Read CLI version from the npm package.json (works when installed via npm i -g @exreve/exk) */
|
|
191
191
|
function getCliVersion() {
|
|
192
192
|
try {
|
|
193
|
-
//
|
|
194
|
-
const pkgPath = path.join(__dirname, 'package.json');
|
|
193
|
+
// Compiled JS is in dist/, package.json is one level up
|
|
194
|
+
const pkgPath = path.join(__dirname, '..', 'package.json');
|
|
195
195
|
const raw = fsSync.readFileSync(pkgPath, 'utf-8');
|
|
196
196
|
const pkg = JSON.parse(raw);
|
|
197
197
|
return pkg.version || '0.0.0';
|
|
@@ -2586,6 +2586,34 @@ program
|
|
|
2586
2586
|
execSync(`pm2 start "${exkBin}" --name cli --interpreter none -- daemon`, {
|
|
2587
2587
|
stdio: 'inherit'
|
|
2588
2588
|
});
|
|
2589
|
+
// Configure pm2 to start on boot (creates systemd/launchd service)
|
|
2590
|
+
let startupConfigured = false;
|
|
2591
|
+
try {
|
|
2592
|
+
const startupResult = execSync('pm2 startup 2>&1', { encoding: 'utf-8' });
|
|
2593
|
+
if (startupResult.includes('sudo') || startupResult.includes('[PM2] You have to run')) {
|
|
2594
|
+
// pm2 startup needs sudo - try running the suggested command
|
|
2595
|
+
const match = startupResult.match(/(sudo .+)/);
|
|
2596
|
+
if (match) {
|
|
2597
|
+
console.log('\n⚙ PM2 startup requires admin privileges.');
|
|
2598
|
+
console.log('Run this command to enable auto-start on reboot:');
|
|
2599
|
+
console.log(` ${match[1]}`);
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
else {
|
|
2603
|
+
startupConfigured = true;
|
|
2604
|
+
}
|
|
2605
|
+
}
|
|
2606
|
+
catch (err) {
|
|
2607
|
+
const execErr = err;
|
|
2608
|
+
const output = execErr.stderr || '';
|
|
2609
|
+
const match = output.match(/(sudo .+)/);
|
|
2610
|
+
if (match) {
|
|
2611
|
+
console.log('\n⚙ PM2 startup requires admin privileges.');
|
|
2612
|
+
console.log('Run this command to enable auto-start on reboot:');
|
|
2613
|
+
console.log(` ${match[1]}`);
|
|
2614
|
+
}
|
|
2615
|
+
// Non-critical - pm2 startup may need sudo
|
|
2616
|
+
}
|
|
2589
2617
|
// Save pm2 process list for auto-restart on reboot
|
|
2590
2618
|
try {
|
|
2591
2619
|
execSync('pm2 save', { stdio: 'inherit' });
|
|
@@ -2595,6 +2623,9 @@ program
|
|
|
2595
2623
|
}
|
|
2596
2624
|
console.log('\n✓ exk installation complete!');
|
|
2597
2625
|
console.log('The service is now running in the background.');
|
|
2626
|
+
if (startupConfigured) {
|
|
2627
|
+
console.log('✓ Auto-start on reboot is configured.');
|
|
2628
|
+
}
|
|
2598
2629
|
console.log('\nUseful commands:');
|
|
2599
2630
|
console.log(' pm2 logs cli - View logs');
|
|
2600
2631
|
console.log(' pm2 restart cli - Restart service');
|
package/dist/ttc-cli.tar.gz
CHANGED
|
Binary file
|