clocktopus 1.1.4 → 1.1.5
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.
|
@@ -2,12 +2,13 @@ import { Hono } from 'hono';
|
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
|
+
import { createRequire } from 'module';
|
|
5
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
7
|
const __dirname = path.dirname(__filename);
|
|
7
8
|
const SCRIPT_PATH = path.resolve(__dirname, '../../index.js');
|
|
8
9
|
const isDev = SCRIPT_PATH.includes('/Projects/') || SCRIPT_PATH.includes('/src/');
|
|
9
10
|
const PM2_NAME = isDev ? 'clocktopus-monitor-dev' : 'clocktopus-monitor';
|
|
10
|
-
const pm2Bin = path.resolve(
|
|
11
|
+
const pm2Bin = path.join(path.dirname(createRequire(import.meta.url).resolve('pm2')), 'bin', 'pm2');
|
|
11
12
|
const monitorRoutes = new Hono();
|
|
12
13
|
function pm2Exec(command) {
|
|
13
14
|
try {
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { Clockify } from './clockify.js';
|
|
|
6
6
|
import * as fs from 'fs';
|
|
7
7
|
import * as path from 'path';
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
|
+
import { createRequire } from 'module';
|
|
9
10
|
import { completeLatestSession, getLatestSession } from './lib/db.js';
|
|
10
11
|
import { stopJiraTimer } from './lib/jira.js';
|
|
11
12
|
import { startDashboard } from './dashboard/server.js';
|
|
@@ -287,7 +288,7 @@ program
|
|
|
287
288
|
const isDev = __dirname.includes('/Projects/') || __dirname.includes('/src/');
|
|
288
289
|
const MONITOR_PM2_NAME = isDev ? 'clocktopus-monitor-dev' : 'clocktopus-monitor';
|
|
289
290
|
const DASH_PM2_NAME = isDev ? 'clocktopus-dash-dev' : 'clocktopus-dash';
|
|
290
|
-
const pm2Bin = path.join(
|
|
291
|
+
const pm2Bin = path.join(path.dirname(createRequire(import.meta.url).resolve('pm2')), 'bin', 'pm2');
|
|
291
292
|
program
|
|
292
293
|
.command('monitor')
|
|
293
294
|
.description('Start idle monitor as a background daemon.')
|