clocktopus 1.1.1 → 1.1.2
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 +1 -1
- package/package.json +3 -2
- package/scripts/postinstall.cjs +67 -0
package/dist/index.js
CHANGED
|
@@ -186,7 +186,7 @@ program
|
|
|
186
186
|
const eligible = latestSession.isAutoCompleted && completedAt > twoHoursAgo && !!latestSession.projectId;
|
|
187
187
|
if (!eligible)
|
|
188
188
|
return;
|
|
189
|
-
await clockify.startTimer(workspaceId, latestSession.projectId, latestSession.description);
|
|
189
|
+
await clockify.startTimer(workspaceId, latestSession.projectId, latestSession.description, latestSession.jiraTicket ?? undefined);
|
|
190
190
|
console.log(chalk.green('Timer restarted for the last used project.'));
|
|
191
191
|
lastResumeAt = Date.now();
|
|
192
192
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clocktopus",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -10,12 +10,13 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"data/.gitkeep",
|
|
13
|
+
"scripts/postinstall.cjs",
|
|
13
14
|
"!dist/desktop"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|
|
16
17
|
"build": "bunx tsc",
|
|
17
18
|
"prepublishOnly": "bunx tsc",
|
|
18
|
-
"postinstall": "node
|
|
19
|
+
"postinstall": "node scripts/postinstall.cjs",
|
|
19
20
|
"lint": "eslint . --ext .ts",
|
|
20
21
|
"clock": "bun dist/index.js",
|
|
21
22
|
"monitor": "bun dist/index.js monitor",
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execSync } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const nativeModules = ['macos-notification-state', 'desktop-idle'];
|
|
7
|
+
|
|
8
|
+
function findNodeGyp() {
|
|
9
|
+
// Try plain node-gyp first (globally installed)
|
|
10
|
+
try {
|
|
11
|
+
execSync('node-gyp --version', { stdio: 'ignore' });
|
|
12
|
+
return 'node-gyp';
|
|
13
|
+
} catch {}
|
|
14
|
+
|
|
15
|
+
// Try npx (comes with Node.js)
|
|
16
|
+
try {
|
|
17
|
+
execSync('npx --version', { stdio: 'ignore' });
|
|
18
|
+
return 'npx node-gyp';
|
|
19
|
+
} catch {}
|
|
20
|
+
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function rebuildModule(moduleName, nodeGypCmd) {
|
|
25
|
+
let modulePath;
|
|
26
|
+
try {
|
|
27
|
+
modulePath = path.dirname(require.resolve(`${moduleName}/package.json`));
|
|
28
|
+
} catch {
|
|
29
|
+
// Module not installed (e.g. optional dependency on wrong platform)
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const bindingGyp = path.join(modulePath, 'binding.gyp');
|
|
34
|
+
try {
|
|
35
|
+
require('fs').accessSync(bindingGyp);
|
|
36
|
+
} catch {
|
|
37
|
+
// No binding.gyp, not a native module
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
console.log(`Building native addon: ${moduleName}...`);
|
|
43
|
+
execSync(`${nodeGypCmd} rebuild`, { cwd: modulePath, stdio: 'inherit' });
|
|
44
|
+
console.log(`Built ${moduleName} successfully.`);
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.warn(`Warning: Failed to build ${moduleName}. The monitor feature may not work.`);
|
|
47
|
+
console.warn(` You can try manually: cd ${modulePath} && npx node-gyp rebuild`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Only build on macOS — these are macOS-only native addons
|
|
52
|
+
if (process.platform !== 'darwin') {
|
|
53
|
+
console.log('Skipping native addon build (not macOS).');
|
|
54
|
+
process.exit(0);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const nodeGypCmd = findNodeGyp();
|
|
58
|
+
if (!nodeGypCmd) {
|
|
59
|
+
console.warn('Warning: node-gyp not found. Native addons were not built.');
|
|
60
|
+
console.warn(' Install node-gyp: npm install -g node-gyp');
|
|
61
|
+
console.warn(' Then rebuild: cd node_modules/macos-notification-state && node-gyp rebuild');
|
|
62
|
+
process.exit(0);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
for (const mod of nativeModules) {
|
|
66
|
+
rebuildModule(mod, nodeGypCmd);
|
|
67
|
+
}
|