oopsx 1.2.0 → 1.3.0
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 +8 -3
- package/scripts/uninstall.js +29 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oopsx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Play a meme sound when your terminal command fails",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"files": [
|
|
13
13
|
"bin/",
|
|
14
14
|
"src/",
|
|
15
|
-
"assets/"
|
|
15
|
+
"assets/",
|
|
16
|
+
"scripts/"
|
|
16
17
|
],
|
|
17
18
|
"keywords": [
|
|
18
19
|
"cli",
|
|
@@ -33,11 +34,15 @@
|
|
|
33
34
|
"url": "https://github.com/devesh760/oopsx/issues"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
37
|
+
"test": "vitest run",
|
|
36
38
|
"postinstall": "node bin/merr.js setup",
|
|
37
|
-
"preuninstall": "node
|
|
39
|
+
"preuninstall": "node scripts/uninstall.js"
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {
|
|
40
42
|
"commander": "^12.1.0",
|
|
41
43
|
"play-sound": "^1.1.6"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"vitest": "^4.0.18"
|
|
42
47
|
}
|
|
43
48
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync, rmSync } from "node:fs";
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
|
|
7
|
+
const HOOK_MARKER = "# oopsx shell hook";
|
|
8
|
+
const home = homedir();
|
|
9
|
+
|
|
10
|
+
const rcFiles = [join(home, ".zshrc"), join(home, ".bashrc")];
|
|
11
|
+
|
|
12
|
+
for (const rcFile of rcFiles) {
|
|
13
|
+
if (!existsSync(rcFile)) continue;
|
|
14
|
+
|
|
15
|
+
const contents = readFileSync(rcFile, "utf-8");
|
|
16
|
+
if (!contents.includes(HOOK_MARKER)) continue;
|
|
17
|
+
|
|
18
|
+
const cleaned = contents
|
|
19
|
+
.split("\n")
|
|
20
|
+
.filter((line) => !line.includes("oopsx") && line !== HOOK_MARKER)
|
|
21
|
+
.join("\n");
|
|
22
|
+
|
|
23
|
+
writeFileSync(rcFile, cleaned, "utf-8");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const merrDir = join(home, ".merr");
|
|
27
|
+
if (existsSync(merrDir)) {
|
|
28
|
+
rmSync(merrDir, { recursive: true, force: true });
|
|
29
|
+
}
|