@nu-art/commando 0.204.37 → 0.204.39

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/cli/pnpm.js CHANGED
@@ -21,7 +21,7 @@ class Cli_PNPM extends ts_common_1.Logger {
21
21
  }
22
22
  this.logDebug(`installing PNPM version ${this._expectedVersion}`);
23
23
  await (commando !== null && commando !== void 0 ? commando : cli_1.Commando.create())
24
- .append(`curl -fsSL "https://get.pnpm.io/install.sh" | env PNPM_VERSION=${this._expectedVersion} sh -`)
24
+ .append(`curl -fsSL "https://get.pnpm.io/install.sh" | env PNPM_VERSION=${this._expectedVersion} bash -`)
25
25
  .execute();
26
26
  return this;
27
27
  };
package/core/cli.d.ts CHANGED
@@ -19,6 +19,7 @@ type Options = {
19
19
  indentation: number;
20
20
  };
21
21
  export declare class BaseCLI extends Logger {
22
+ protected stderrValidator: ((stdout: string) => boolean);
22
23
  protected stdoutProcessors: ((stdout: string) => void)[];
23
24
  protected stderrProcessors: ((stdout: string) => void)[];
24
25
  protected commands: string[];
package/core/cli.js CHANGED
@@ -20,11 +20,12 @@ class BaseCLI extends ts_common_1.Logger {
20
20
  */
21
21
  constructor(options = defaultOptions) {
22
22
  super();
23
+ this.stderrValidator = () => true;
23
24
  this.stdoutProcessors = [];
24
25
  this.stderrProcessors = [];
25
26
  this.commands = [];
26
27
  this.indentation = 0;
27
- this._debug = false;
28
+ this._debug = true;
28
29
  this.uid = (0, ts_common_1.generateHex)((8));
29
30
  this.getIndentation = () => {
30
31
  return ' '.repeat(this.option.indentation * this.indentation);
@@ -113,8 +114,10 @@ class CliInteractive extends BaseCLI {
113
114
  if (!message.length)
114
115
  return;
115
116
  try {
116
- this.stdoutProcessors.forEach(processor => processor(message));
117
- this.stderrProcessors.forEach(processor => processor(message));
117
+ if (!this.stderrValidator(message))
118
+ this.stdoutProcessors.forEach(processor => processor(message));
119
+ else
120
+ this.stderrProcessors.forEach(processor => processor(message));
118
121
  this.logInfo(`${message}`);
119
122
  }
120
123
  catch (e) {
@@ -150,8 +153,14 @@ class Cli extends BaseCLI {
150
153
  if (error) {
151
154
  reject(new CliError_1.CliError(`executing:\n${command}\n`, stdout, stderr, error));
152
155
  }
153
- if (stderr)
156
+ const errorLogs = stderr.split('\n');
157
+ const { filteredIn, filteredOut } = (0, ts_common_1.filterInOut)(errorLogs, this.stderrValidator);
158
+ stderr = filteredIn.join('\n').trim();
159
+ if (stderr && stderr.length > 0)
154
160
  reject(stderr);
161
+ const stdErrToOut = filteredOut.join('\n').trim();
162
+ if (stdErrToOut && stdErrToOut.length > 0)
163
+ stdout += `from stderr: \n${stdErrToOut}`;
155
164
  if (stdout) {
156
165
  this.stdoutProcessors.forEach(processor => processor(stdout));
157
166
  this.logInfo(stdout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/commando",
3
- "version": "0.204.37",
3
+ "version": "0.204.39",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "TacB0sS",