clocktopus 1.6.12 → 1.6.13

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.
@@ -9,6 +9,15 @@ const SCRIPT_PATH = path.resolve(__dirname, '../../index.js');
9
9
  const isDev = SCRIPT_PATH.includes('/Projects/') || SCRIPT_PATH.includes('/src/');
10
10
  const PM2_NAME = isDev ? 'clocktopus-monitor-dev' : 'clocktopus-monitor';
11
11
  const pm2Bin = path.join(path.dirname(createRequire(import.meta.url).resolve('pm2')), 'bin', 'pm2');
12
+ const bunBin = (() => {
13
+ try {
14
+ return execSync('which bun', { encoding: 'utf-8' }).trim();
15
+ }
16
+ catch {
17
+ return 'bun';
18
+ }
19
+ })();
20
+ const pm2Cmd = `${bunBin} ${pm2Bin}`;
12
21
  const monitorRoutes = new Hono();
13
22
  function pm2Exec(command) {
14
23
  try {
@@ -22,7 +31,7 @@ function pm2Exec(command) {
22
31
  }
23
32
  monitorRoutes.get('/monitor/status', (c) => {
24
33
  try {
25
- const output = execSync(`${pm2Bin} jlist`, { encoding: 'utf-8', timeout: 10000 });
34
+ const output = execSync(`${pm2Cmd} jlist`, { encoding: 'utf-8', timeout: 10000 });
26
35
  const processes = JSON.parse(output);
27
36
  const proc = processes.find((p) => p.name === PM2_NAME);
28
37
  if (!proc) {
@@ -43,18 +52,18 @@ monitorRoutes.post('/monitor/start', (c) => {
43
52
  const bunPath = execSync('which bun', { encoding: 'utf-8' }).trim();
44
53
  // Delete any existing process to avoid duplicates
45
54
  try {
46
- execSync(`${pm2Bin} delete ${PM2_NAME}`, { stdio: 'ignore' });
55
+ execSync(`${pm2Cmd} delete ${PM2_NAME}`, { stdio: 'ignore' });
47
56
  }
48
57
  catch { }
49
- const result = pm2Exec(`${pm2Bin} start ${SCRIPT_PATH} --name ${PM2_NAME} --interpreter ${bunPath} -- monitor:run`);
58
+ const result = pm2Exec(`${pm2Cmd} start ${SCRIPT_PATH} --name ${PM2_NAME} --interpreter ${bunPath} -- monitor:run`);
50
59
  return c.json(result);
51
60
  });
52
61
  monitorRoutes.post('/monitor/stop', (c) => {
53
- const result = pm2Exec(`${pm2Bin} stop ${PM2_NAME}`);
62
+ const result = pm2Exec(`${pm2Cmd} stop ${PM2_NAME}`);
54
63
  return c.json(result);
55
64
  });
56
65
  monitorRoutes.post('/monitor/restart', (c) => {
57
- const result = pm2Exec(`${pm2Bin} restart ${PM2_NAME}`);
66
+ const result = pm2Exec(`${pm2Cmd} restart ${PM2_NAME}`);
58
67
  return c.json(result);
59
68
  });
60
69
  export default monitorRoutes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clocktopus",
3
- "version": "1.6.12",
3
+ "version": "1.6.13",
4
4
  "description": "Time-tracking automation for Clockify with idle monitoring, Jira integration, Google Calendar sync, CLI, web dashboard, and desktop app.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",