contensis-cli 1.0.0-beta.63 → 1.0.0-beta.64

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.
@@ -2,8 +2,8 @@
2
2
  import chalk from 'chalk';
3
3
  import dateFormat from 'dateformat';
4
4
  import deepCleaner from 'deep-cleaner';
5
- import ProgressBar from 'progress';
6
- import { tryStringify } from '.';
5
+ // import ProgressBar from 'progress';
6
+ import { isSysError, tryStringify } from '.';
7
7
 
8
8
  type LogMethod = (content: string) => void;
9
9
  type LogErrorMethod = (content: string, err?: any, newline?: string) => void;
@@ -40,7 +40,11 @@ export class Logger {
40
40
  static error: LogErrorMethod = (content, err, newline = '\n') => {
41
41
  const message = `${Logger.getPrefix()} ${Logger.errorText(
42
42
  `${Logger.isUserTerminal ? '❌' : '[ERROR]'} ${content}${
43
- err ? `\n\n${JSON.stringify(err, null, 2)}` : ''
43
+ err
44
+ ? `\n\n${
45
+ isSysError(err) ? err.toString() : JSON.stringify(err, null, 2)
46
+ }`
47
+ : ''
44
48
  }`
45
49
  )}${newline}`;
46
50
  if (progress.active) progress.current.interrupt(message);
@@ -178,14 +182,20 @@ export class Logger {
178
182
  else Logger.objectRecurse(item, depth + 1, `${indent} `);
179
183
  } else Logger.raw(`${indent}${item}`);
180
184
  }
181
- } else
185
+ } else {
186
+ let pos = 0;
182
187
  for (const [key, value] of Object.entries(content)) {
183
188
  if (Array.isArray(value)) {
189
+ const thisIndent =
190
+ pos++ === 0
191
+ ? `${indent.substring(0, indent.length - 2)}- `
192
+ : indent;
193
+ if (value.length) Logger.raw(`${thisIndent}${chalk.bold.grey(key)}:`);
184
194
  for (const item of value) {
185
195
  if (item && typeof item === 'object') {
186
196
  if (Array.isArray(item) && depth > 3)
187
197
  Logger.raw(chalk.grey(`${indent} [${item.join(', ')}]`));
188
- else Logger.objectRecurse(item, depth + 1, `${indent}`);
198
+ else Logger.objectRecurse(item, depth + 1, `${indent} `);
189
199
  } else {
190
200
  Logger.raw(`${indent} ${item}`);
191
201
  }
@@ -199,6 +209,7 @@ export class Logger {
199
209
  Logger.raw(`${indent}${chalk.bold.grey(key)}: ${value}`);
200
210
  }
201
211
  }
212
+ }
202
213
  };
203
214
  static raw: LogMethod = (content: string) => {
204
215
  if (progress.active) progress.current.interrupt(content);
@@ -222,13 +233,14 @@ export const logError: LogErrorFunc = (
222
233
  };
223
234
 
224
235
  export const progress = {
236
+ current: { interrupt: (x: string) => {} },
225
237
  active: false,
226
- done: () => new ProgressBar('', 0),
227
- colours: { green: '\u001b[42m \u001b[0m', red: '\u001b[41m \u001b[0m' },
228
- current: new ProgressBar(`:bar`, {
229
- complete: '=',
230
- incomplete: ' ',
231
- width: 20,
232
- total: 100,
233
- }),
238
+ // done: () => new ProgressBar('', 0),
239
+ // colours: { green: '\u001b[42m \u001b[0m', red: '\u001b[41m \u001b[0m' },
240
+ // current: new ProgressBar(`:bar`, {
241
+ // complete: '=',
242
+ // incomplete: ' ',
243
+ // width: 20,
244
+ // total: 100,
245
+ // }),
234
246
  };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const LIB_VERSION = "1.0.0-beta.63";
1
+ export const LIB_VERSION = "1.0.0-beta.64";