bunosh 0.4.7 → 0.4.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bunosh",
3
- "version": "0.4.7",
3
+ "version": "0.4.8",
4
4
  "type": "module",
5
5
  "module": "index.js",
6
6
  "bin": {
@@ -56,9 +56,8 @@ export class ConsoleFormatter extends BaseFormatter {
56
56
  let line = leftContent + padding + rightContent;
57
57
 
58
58
  if (icon.trim()) {
59
- // Apply underline to the task name/type only, not the status in parentheses
60
- const underlineContent = taskTypeFormatted + taskNameFormatted + padding;
61
- line = icon + ' ' + chalk.underline(underlineContent) + rightContent;
59
+ const underlineContent = taskTypeFormatted + taskNameFormatted;
60
+ line = icon + ' ' + chalk.underline(underlineContent) + padding + rightContent;
62
61
  }
63
62
 
64
63
  let result = line;
@@ -74,7 +73,40 @@ export class ConsoleFormatter extends BaseFormatter {
74
73
 
75
74
  formatOutput(line, isError = false) {
76
75
  if (!line.trim()) return '';
77
- return isError ? chalk.red(line) : line;
76
+
77
+ const indent = ' ';
78
+ const terminalWidth = process.stdout.columns || 100;
79
+ const maxLineWidth = terminalWidth - indent.length;
80
+
81
+ let formattedLine = line;
82
+ const plainLine = this._stripAnsi(line);
83
+
84
+ if (plainLine.length > maxLineWidth) {
85
+ const truncateAt = maxLineWidth - 3;
86
+ let charCount = 0;
87
+ let truncatedLine = '';
88
+
89
+ for (let i = 0; i < line.length; i++) {
90
+ if (line[i] === '\u001b') {
91
+ let j = i;
92
+ while (j < line.length && line[j] !== 'm') j++;
93
+ truncatedLine += line.substring(i, j + 1);
94
+ i = j;
95
+ continue;
96
+ }
97
+
98
+ if (charCount >= truncateAt) break;
99
+
100
+ truncatedLine += line[i];
101
+ charCount++;
102
+ }
103
+
104
+ formattedLine = truncatedLine + '...';
105
+ }
106
+
107
+ formattedLine = indent + formattedLine;
108
+
109
+ return isError ? chalk.red(formattedLine) : formattedLine;
78
110
  }
79
111
 
80
112
  _stripAnsi(str) {
package/src/task.js CHANGED
@@ -118,7 +118,7 @@ export class TaskInfo {
118
118
  }
119
119
  }
120
120
 
121
- export async function tryTask(name, fn, isSilent = false) {
121
+ export async function tryTask(name, fn, isSilent = true) {
122
122
  if (!fn) {
123
123
  fn = name;
124
124
  name = fn.toString().slice(0, 50).replace(/\s+/g, ' ').trim();