cloggi 1.0.8 → 1.0.10

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/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ declare class ClogBuilder {
3
3
  private _modifiers;
4
4
  private _timed;
5
5
  private _overwrite;
6
- private _lastWasOverwrite;
6
+ private _lastOverwriteLines;
7
7
  private _print;
8
8
  get red(): this;
9
9
  get green(): this;
package/dist/index.js CHANGED
@@ -6,9 +6,10 @@ class ClogBuilder {
6
6
  this._modifiers = [];
7
7
  this._timed = false;
8
8
  this._overwrite = false;
9
- this._lastWasOverwrite = false;
9
+ this._lastOverwriteLines = 0;
10
10
  }
11
11
  _print(text) {
12
+ var _a, _b;
12
13
  const str = typeof text === 'object'
13
14
  ? prettyjson.render(text)
14
15
  : typeof text === 'number'
@@ -17,16 +18,17 @@ class ClogBuilder {
17
18
  const output = `${this._timed ? `[${new Date().toTimeString().slice(0, 8)}]${typeof text === 'object' ? '\n' : ' - '}` : ''}${str}`;
18
19
  const formats = [this._color, ...this._modifiers];
19
20
  const styled = st(formats, output, { validateStream: false });
20
- if (this._lastWasOverwrite) {
21
- process.stdout.write('\r\x1B[2K');
21
+ if (this._lastOverwriteLines > 0) {
22
+ const up = '\x1B[1A\x1B[2K'.repeat(this._lastOverwriteLines - 1);
23
+ process.stdout.write(up + '\r\x1B[2K');
22
24
  }
23
25
  if (this._overwrite) {
24
26
  process.stdout.write(styled);
25
- this._lastWasOverwrite = true;
27
+ this._lastOverwriteLines = ((_b = (_a = output.match(/\n/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) + 1;
26
28
  }
27
29
  else {
28
30
  console.log(styled);
29
- this._lastWasOverwrite = false;
31
+ this._lastOverwriteLines = 0;
30
32
  }
31
33
  this._color = 'white';
32
34
  this._modifiers = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloggi",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "author": "Claudio Santancini",
5
5
  "description": "cloggish!",
6
6
  "main": "dist/index.js",