@guritso/terminal 1.1.2 → 1.1.4
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/index.d.ts +1 -1
- package/lib/cjs/terminal.cjs +13 -15
- package/lib/terminal.js +13 -15
- package/lib/utils.js +1 -1
- package/package.json +2 -2
package/index.d.ts
CHANGED
package/lib/cjs/terminal.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var fs = require('fs');
|
|
|
6
6
|
/*!
|
|
7
7
|
* Terminal
|
|
8
8
|
* Copyright (c) 2024 @GuriTso
|
|
9
|
-
* @license
|
|
9
|
+
* @license MIT
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
|
|
@@ -92,7 +92,7 @@ function formatUrl(host, port) {
|
|
|
92
92
|
/*!
|
|
93
93
|
* Terminal
|
|
94
94
|
* Copyright (c) 2024 @GuriTso
|
|
95
|
-
* @license
|
|
95
|
+
* @license MIT
|
|
96
96
|
*/
|
|
97
97
|
|
|
98
98
|
|
|
@@ -117,9 +117,9 @@ function formatUrl(host, port) {
|
|
|
117
117
|
const terminal = {
|
|
118
118
|
verbose: 2,
|
|
119
119
|
levels: {
|
|
120
|
-
info: color("%H100 INFO
|
|
121
|
-
fail: color("%H41 FAIL
|
|
122
|
-
pass: color("%H42 PASS
|
|
120
|
+
info: color("%H100 INFO %H"),
|
|
121
|
+
fail: color("%H41 FAIL %H"),
|
|
122
|
+
pass: color("%H42 PASS %H"),
|
|
123
123
|
},
|
|
124
124
|
};
|
|
125
125
|
|
|
@@ -171,7 +171,7 @@ terminal.pass = function pass(data) {
|
|
|
171
171
|
|
|
172
172
|
if (typeof data === "object") {
|
|
173
173
|
// skipcq: JS-0002
|
|
174
|
-
console.log(color(`\r%H1 ${levels.pass}%H`),data);
|
|
174
|
+
console.log(color(`\r%H1 ${levels.pass}%H`), data);
|
|
175
175
|
} else {
|
|
176
176
|
terminal.clear();
|
|
177
177
|
stdout.write(color(`\r%H1 ${levels.pass}%H ${String(data)}\n`));
|
|
@@ -202,13 +202,13 @@ terminal.log = function log(data) {
|
|
|
202
202
|
if (level === terminal.levels.info) {
|
|
203
203
|
if (typeof data === "object") {
|
|
204
204
|
// skipcq: JS-0002
|
|
205
|
-
console.log(color(`%H1 ${level}%H
|
|
205
|
+
console.log(color(`%H1 ${level}%H`), data);
|
|
206
206
|
} else {
|
|
207
207
|
stdout.write(color(`%H1 ${level}%H ${String(data)}\n`));
|
|
208
208
|
}
|
|
209
209
|
} else {
|
|
210
210
|
// skipcq: JS-0002
|
|
211
|
-
console.log(color(`%H1 ${level}%H
|
|
211
|
+
console.log(color(`%H1 ${level}%H`), data);
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
};
|
|
@@ -241,11 +241,10 @@ terminal.isError = (data) => {
|
|
|
241
241
|
*/
|
|
242
242
|
terminal.setup = () => {
|
|
243
243
|
if (typeof console === "object" && console.error) {
|
|
244
|
-
|
|
245
244
|
if (typeof console.backup === "function") {
|
|
246
|
-
return false
|
|
245
|
+
return false;
|
|
247
246
|
}
|
|
248
|
-
|
|
247
|
+
|
|
249
248
|
// backup the original console.error
|
|
250
249
|
console.backup = console.error;
|
|
251
250
|
} else {
|
|
@@ -255,7 +254,7 @@ terminal.setup = () => {
|
|
|
255
254
|
// replace the console.error with the terminal.log
|
|
256
255
|
console.error = terminal.log;
|
|
257
256
|
|
|
258
|
-
return true
|
|
257
|
+
return true;
|
|
259
258
|
};
|
|
260
259
|
|
|
261
260
|
/**
|
|
@@ -264,10 +263,10 @@ terminal.setup = () => {
|
|
|
264
263
|
terminal.clear = () => {
|
|
265
264
|
if (stdout.isTTY) {
|
|
266
265
|
stdout.clearLine();
|
|
267
|
-
return true
|
|
266
|
+
return true;
|
|
268
267
|
}
|
|
269
268
|
|
|
270
|
-
return false
|
|
269
|
+
return false;
|
|
271
270
|
};
|
|
272
271
|
|
|
273
272
|
/**
|
|
@@ -287,7 +286,6 @@ terminal.setVerbose = (verbose) => {
|
|
|
287
286
|
terminal.verbose = verboseLevel;
|
|
288
287
|
}
|
|
289
288
|
}
|
|
290
|
-
|
|
291
289
|
};
|
|
292
290
|
|
|
293
291
|
module.exports = terminal;
|
package/lib/terminal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Terminal
|
|
3
3
|
* Copyright (c) 2024 @GuriTso
|
|
4
|
-
* @license
|
|
4
|
+
* @license MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
"use strict";
|
|
@@ -30,9 +30,9 @@ import { readFileSync } from "fs";
|
|
|
30
30
|
const terminal = {
|
|
31
31
|
verbose: 2,
|
|
32
32
|
levels: {
|
|
33
|
-
info: co("%H100 INFO
|
|
34
|
-
fail: co("%H41 FAIL
|
|
35
|
-
pass: co("%H42 PASS
|
|
33
|
+
info: co("%H100 INFO %H"),
|
|
34
|
+
fail: co("%H41 FAIL %H"),
|
|
35
|
+
pass: co("%H42 PASS %H"),
|
|
36
36
|
},
|
|
37
37
|
};
|
|
38
38
|
|
|
@@ -84,7 +84,7 @@ terminal.pass = function pass(data) {
|
|
|
84
84
|
|
|
85
85
|
if (typeof data === "object") {
|
|
86
86
|
// skipcq: JS-0002
|
|
87
|
-
console.log(co(`\r%H1 ${levels.pass}%H`),data);
|
|
87
|
+
console.log(co(`\r%H1 ${levels.pass}%H`), data);
|
|
88
88
|
} else {
|
|
89
89
|
terminal.clear();
|
|
90
90
|
stdout.write(co(`\r%H1 ${levels.pass}%H ${String(data)}\n`));
|
|
@@ -115,13 +115,13 @@ terminal.log = function log(data) {
|
|
|
115
115
|
if (level === terminal.levels.info) {
|
|
116
116
|
if (typeof data === "object") {
|
|
117
117
|
// skipcq: JS-0002
|
|
118
|
-
console.log(co(`%H1 ${level}%H
|
|
118
|
+
console.log(co(`%H1 ${level}%H`), data);
|
|
119
119
|
} else {
|
|
120
120
|
stdout.write(co(`%H1 ${level}%H ${String(data)}\n`));
|
|
121
121
|
}
|
|
122
122
|
} else {
|
|
123
123
|
// skipcq: JS-0002
|
|
124
|
-
console.log(co(`%H1 ${level}%H
|
|
124
|
+
console.log(co(`%H1 ${level}%H`), data);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
};
|
|
@@ -154,11 +154,10 @@ terminal.isError = (data) => {
|
|
|
154
154
|
*/
|
|
155
155
|
terminal.setup = () => {
|
|
156
156
|
if (typeof console === "object" && console.error) {
|
|
157
|
-
|
|
158
157
|
if (typeof console.backup === "function") {
|
|
159
|
-
return false
|
|
158
|
+
return false;
|
|
160
159
|
}
|
|
161
|
-
|
|
160
|
+
|
|
162
161
|
// backup the original console.error
|
|
163
162
|
console.backup = console.error;
|
|
164
163
|
} else {
|
|
@@ -168,7 +167,7 @@ terminal.setup = () => {
|
|
|
168
167
|
// replace the console.error with the terminal.log
|
|
169
168
|
console.error = terminal.log;
|
|
170
169
|
|
|
171
|
-
return true
|
|
170
|
+
return true;
|
|
172
171
|
};
|
|
173
172
|
|
|
174
173
|
/**
|
|
@@ -177,10 +176,10 @@ terminal.setup = () => {
|
|
|
177
176
|
terminal.clear = () => {
|
|
178
177
|
if (stdout.isTTY) {
|
|
179
178
|
stdout.clearLine();
|
|
180
|
-
return true
|
|
179
|
+
return true;
|
|
181
180
|
}
|
|
182
181
|
|
|
183
|
-
return false
|
|
182
|
+
return false;
|
|
184
183
|
};
|
|
185
184
|
|
|
186
185
|
/**
|
|
@@ -200,7 +199,6 @@ terminal.setVerbose = (verbose) => {
|
|
|
200
199
|
terminal.verbose = verboseLevel;
|
|
201
200
|
}
|
|
202
201
|
}
|
|
203
|
-
|
|
204
202
|
};
|
|
205
203
|
|
|
206
|
-
export default terminal;
|
|
204
|
+
export default terminal;
|
package/lib/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guritso/terminal",
|
|
3
3
|
"description": "A terminal node utility for enhanced logging and error handling",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"main": "index.cjs",
|
|
6
6
|
"module": "index.js",
|
|
7
7
|
"types": "index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"author": "GuriTso",
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"jest": "^29.7.0",
|
|
35
|
-
"rollup": "^4.
|
|
35
|
+
"rollup": "^4.38.0"
|
|
36
36
|
},
|
|
37
37
|
"directories": {
|
|
38
38
|
"lib": "lib",
|