explainthisrepo 0.1.0 → 0.1.1

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.
Files changed (3) hide show
  1. package/README.md +4 -4
  2. package/dist/cli.js +17 -2
  3. package/package.json +4 -8
package/README.md CHANGED
@@ -16,7 +16,7 @@ Follow these steps to set up the project locally on your machine:
16
16
 
17
17
  1. **Clone the Repository**
18
18
  ```bash
19
- git clone https://github.com/Spectra010s/ExplainThisRepo.git
19
+ git clone https://github.com/calchiwo/ExplainThisRepo.git
20
20
  cd ExplainThisRepo/node_version
21
21
  ```
22
22
 
@@ -82,6 +82,6 @@ This project is licensed under the MIT License as specified in the package confi
82
82
 
83
83
  ## Author Info
84
84
 
85
- **Spectra010s**
86
- - [Portfolio](https://spectra010s.vercel.app)
87
- - [Twitter/X](https://x.com/Spectra010s)
85
+ [**Caleb Wodi**](https://github.com/calchiwo)
86
+
87
+ Node version contibuted by [@Spectra010s](https://github.com/spectra010s)
package/dist/cli.js CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import os from "node:os";
3
3
  import process from "node:process";
4
+ import { readFileSync } from "node:fs";
5
+ import path from "node:path";
6
+ import { fileURLToPath } from "node:url";
4
7
  import { fetchRepo, fetchReadme } from "./github.js";
5
8
  import { buildPrompt } from "./prompt.js";
6
9
  import { generateExplanation } from "./generate.js";
@@ -13,7 +16,16 @@ function usage() {
13
16
  console.log(" explainthisrepo --version");
14
17
  }
15
18
  function getPkgVersion() {
16
- return process.env.npm_package_version || "unknown";
19
+ try {
20
+ const __filename = fileURLToPath(import.meta.url);
21
+ const __dirname = path.dirname(__filename);
22
+ const pkgPath = path.join(__dirname, "..", "package.json");
23
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
24
+ return pkg.version ?? "unknown";
25
+ }
26
+ catch {
27
+ return "unknown";
28
+ }
17
29
  }
18
30
  function printVersion() {
19
31
  console.log(getPkgVersion());
@@ -36,7 +48,10 @@ async function checkUrl(url, timeoutMs = 6000) {
36
48
  }
37
49
  catch (e) {
38
50
  clearTimeout(t);
39
- return { ok: false, msg: `failed (${e?.name || "Error"}: ${e?.message || e})` };
51
+ return {
52
+ ok: false,
53
+ msg: `failed (${e?.name || "Error"}: ${e?.message || e})`,
54
+ };
40
55
  }
41
56
  }
42
57
  async function runDoctor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "explainthisrepo",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "CLI tool to explain a GitHub repository in plain English",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,11 +23,7 @@
23
23
  "developer-tools"
24
24
  ],
25
25
  "bin": {
26
- "explainthisrepo": "./dist/cli.js"
27
- },
28
- "main": "./dist/index.js",
29
- "exports": {
30
- ".": "./dist/index.js"
26
+ "explainthisrepo": "dist/cli.js"
31
27
  },
32
28
  "files": [
33
29
  "dist",
@@ -49,6 +45,6 @@
49
45
  },
50
46
  "devDependencies": {
51
47
  "@types/node": "^22.0.0",
52
- "typescript": "^5.0.0"
48
+ "typescript": "^5.6.0"
53
49
  }
54
- }
50
+ }