errlens 1.0.6 ā 1.0.7
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/index.js +9 -7
- package/package.json +4 -4
package/bin/index.js
CHANGED
|
@@ -2,27 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
const { Command } = require("commander");
|
|
4
4
|
const { spawn } = require("child_process");
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
const chalk = require("chalk");
|
|
7
7
|
const path = require("path");
|
|
8
8
|
const { findError } = require("../lib/matcher");
|
|
9
9
|
const { formatError } = require("../lib/formatter");
|
|
10
10
|
|
|
11
|
+
const { version } = require("../package.json");
|
|
11
12
|
const program = new Command();
|
|
12
13
|
|
|
13
14
|
program
|
|
14
15
|
.name("errlens")
|
|
15
16
|
.description("Professional JS Error Analytics")
|
|
16
|
-
.version(
|
|
17
|
+
.version(version);
|
|
17
18
|
|
|
18
19
|
// ----------------- RUN COMMAND -----------------
|
|
19
20
|
program
|
|
20
21
|
.command("run <file>")
|
|
21
22
|
.option('--json', 'Output JSON instead of pretty UI')
|
|
22
23
|
.description("Run a Javascript file and analyze crashes")
|
|
23
|
-
.action((file, options) => {
|
|
24
|
+
.action(async (file, options) => {
|
|
25
|
+
const { default: ora } = await import("ora");
|
|
24
26
|
const filePath = path.resolve(process.cwd(), file);
|
|
25
|
-
const isJson = Boolean(options.json
|
|
27
|
+
const isJson = Boolean(options.json);
|
|
26
28
|
const spinner = isJson ? null : ora(`Running ${chalk.yellow(file)}...`).start();
|
|
27
29
|
|
|
28
30
|
const child = spawn(process.execPath, [filePath], { stdio: ["inherit", "pipe", "pipe"] });
|
|
@@ -73,7 +75,7 @@ program
|
|
|
73
75
|
} else {
|
|
74
76
|
if (count > 0) {
|
|
75
77
|
console.log(chalk.bold.cyan(`\nš ErrLens Analysis (${count} Issue(s)):`));
|
|
76
|
-
matches.forEach(m => console.log(formatError(m))); // Pretty UI only here
|
|
78
|
+
matches.forEach(m => { console.log(formatError(m)); }); // Pretty UI only here
|
|
77
79
|
} else {
|
|
78
80
|
console.log(chalk.red.bold("\nā Crash detected (No known fix in database):"));
|
|
79
81
|
console.log(chalk.gray(errorOutput));
|
|
@@ -102,7 +104,7 @@ program
|
|
|
102
104
|
.action((errorString, options) => {
|
|
103
105
|
const { count, matches } = findError(errorString);
|
|
104
106
|
const exitCode = count > 0 ? 1 : 0;
|
|
105
|
-
const isJson = Boolean(options.json
|
|
107
|
+
const isJson = Boolean(options.json);
|
|
106
108
|
|
|
107
109
|
if (isJson) {
|
|
108
110
|
console.log(JSON.stringify({ code: exitCode, count, matches }, null, 2));
|
|
@@ -112,7 +114,7 @@ program
|
|
|
112
114
|
|
|
113
115
|
if (count > 0) {
|
|
114
116
|
console.log(chalk.bold.cyan(`\nš ErrLens Analysis (${count} Issue(s)):`));
|
|
115
|
-
matches.forEach(m => console.log(formatError(m))); // Pretty UI
|
|
117
|
+
matches.forEach(m => { console.log(formatError(m)); }); // Pretty UI
|
|
116
118
|
} else {
|
|
117
119
|
console.log(chalk.red.bold("\nā Crash detected (No known fix in database):"));
|
|
118
120
|
console.log(chalk.gray(errorString));
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "errlens",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Professional CLI tool that explains JavaScript and Node.js errors in plain English with actionable fixes directly in your terminal.",
|
|
5
5
|
"main": "./bin/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"errlens": "
|
|
7
|
+
"errlens": "bin/index.js"
|
|
8
8
|
},
|
|
9
9
|
"author": "BeyteFlow (https://github.com/BeyteFlow)",
|
|
10
10
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "https://github.com/BeyteFlow/errlens.git"
|
|
39
|
+
"url": "git+https://github.com/BeyteFlow/errlens.git"
|
|
40
40
|
},
|
|
41
41
|
"bugs": {
|
|
42
42
|
"url": "https://github.com/BeyteFlow/errlens/issues"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"boxen": "^5.1.2",
|
|
51
|
-
"chalk": "^
|
|
51
|
+
"chalk": "^4.1.2",
|
|
52
52
|
"commander": "^14.0.3",
|
|
53
53
|
"fuse.js": "^7.0.0",
|
|
54
54
|
"ora": "^9.3.0"
|