oopsx 1.1.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/bin/merr.js +6 -2
- package/package.json +8 -3
- package/scripts/uninstall.js +29 -0
package/bin/merr.js
CHANGED
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { existsSync, readFileSync, appendFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
|
-
import { join } from "node:path";
|
|
5
|
+
import { join, dirname } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
6
7
|
import { Command } from "commander";
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
7
11
|
import { runCommand } from "../src/runner.js";
|
|
8
12
|
import { resolveSound, playAudio, setDefault, setVolume } from "../src/sound.js";
|
|
9
13
|
import { readConfig } from "../src/config.js";
|
|
@@ -35,7 +39,7 @@ const program = new Command();
|
|
|
35
39
|
program
|
|
36
40
|
.name("oopsx")
|
|
37
41
|
.description("Play a meme sound when your terminal command fails")
|
|
38
|
-
.version(
|
|
42
|
+
.version(pkg.version);
|
|
39
43
|
|
|
40
44
|
// --- `oopsx init <shell>` — output shell hook snippet ---
|
|
41
45
|
program
|
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
|
+
}
|