stock-weekly-report 0.1.2 → 0.1.3

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/package.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "name": "stock-weekly-report",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Stock weekly podcast report pipeline — CLI and MCP server",
5
5
  "bin": {
6
6
  "swr": "bin/swr.js",
7
7
  "swr-mcp": "bin/swr-mcp.js"
8
8
  },
9
9
  "scripts": {
10
- "postinstall": "node scripts/postinstall.js"
10
+ "postinstall": "node scripts/postinstall.js",
11
+ "preuninstall": "node scripts/preuninstall.js"
11
12
  },
12
13
  "files": [
13
14
  "bin/",
14
- "scripts/",
15
+ "scripts/postinstall.js",
16
+ "scripts/preuninstall.js",
15
17
  "*.py",
16
18
  "pyproject.toml",
17
19
  "requirements.txt",
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "stock-weekly-report"
7
- version = "0.1.2"
7
+ version = "0.1.3"
8
8
  requires-python = ">=3.10"
9
9
  authors = [
10
10
  { name = "Chang Yu Chuan", email = "changyuchuanmicron@gmail.com" },
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * preuninstall.js
5
+ *
6
+ * Runs automatically before `npm uninstall -g stock-weekly-report`.
7
+ * Removes the cron job so it doesn't point to deleted files.
8
+ */
9
+
10
+ const { execSync } = require("child_process");
11
+
12
+ const CRON_MARKER = "# swr:stock-weekly-report";
13
+
14
+ function removeCronJob() {
15
+ try {
16
+ const current = execSync("crontab -l 2>/dev/null", {
17
+ encoding: "utf8",
18
+ }).trim();
19
+
20
+ if (!current.includes(CRON_MARKER)) {
21
+ return; // nothing to remove
22
+ }
23
+
24
+ const cleaned = current
25
+ .split("\n")
26
+ .filter((line) => !line.includes(CRON_MARKER))
27
+ .join("\n")
28
+ .trim();
29
+
30
+ if (cleaned) {
31
+ execSync(`echo "${cleaned}" | crontab -`);
32
+ } else {
33
+ execSync("crontab -r 2>/dev/null || true", { shell: true });
34
+ }
35
+
36
+ console.log("swr: removed cron job.");
37
+ } catch {
38
+ // crontab may not exist — not an error
39
+ }
40
+ }
41
+
42
+ removeCronJob();
43
+
44
+ console.log(
45
+ "\nswr: uninstalled.\n" +
46
+ " If you had Claude Desktop configured, remove the 'stock-weekly-report'\n" +
47
+ " entry from claude_desktop_config.json.\n"
48
+ );