@oclif/core 2.1.7 → 2.2.1

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.
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ActionBase = void 0;
4
4
  const util_1 = require("util");
5
5
  const util_2 = require("../../util");
6
+ const stream_1 = require("../stream");
6
7
  class ActionBase {
7
8
  constructor() {
8
9
  this.std = 'stderr';
9
10
  this.stdmockOrigs = {
10
- stdout: process.stdout.write,
11
- stderr: process.stderr.write,
11
+ stdout: stream_1.stdout.write,
12
+ stderr: stream_1.stderr.write,
12
13
  };
13
14
  }
14
15
  start(action, status, opts = {}) {
@@ -109,28 +110,30 @@ class ActionBase {
109
110
  // mock out stdout/stderr so it doesn't screw up the rendering
110
111
  _stdout(toggle) {
111
112
  try {
112
- const outputs = ['stdout', 'stderr'];
113
113
  if (toggle) {
114
114
  if (this.stdmocks)
115
115
  return;
116
116
  this.stdmockOrigs = {
117
- stdout: process.stdout.write,
118
- stderr: process.stderr.write,
117
+ stdout: stream_1.stdout.write,
118
+ stderr: stream_1.stderr.write,
119
119
  };
120
120
  this.stdmocks = [];
121
- for (const std of outputs) {
122
- process[std].write = (...args) => {
123
- this.stdmocks.push([std, args]);
124
- };
125
- }
121
+ stream_1.stdout.write = (...args) => {
122
+ this.stdmocks.push(['stdout', args]);
123
+ return true;
124
+ };
125
+ stream_1.stderr.write = (...args) => {
126
+ this.stdmocks.push(['stderr', args]);
127
+ return true;
128
+ };
126
129
  }
127
130
  else {
128
131
  if (!this.stdmocks)
129
132
  return;
130
133
  // this._write('stderr', '\nresetstdmock\n\n\n')
131
134
  delete this.stdmocks;
132
- for (const std of outputs)
133
- process[std].write = this.stdmockOrigs[std];
135
+ stream_1.stdout.write = this.stdmockOrigs.stdout;
136
+ stream_1.stderr.write = this.stdmockOrigs.stderr;
134
137
  }
135
138
  }
136
139
  catch (error) {
@@ -160,7 +163,16 @@ class ActionBase {
160
163
  }
161
164
  // write to the real stdout/stderr
162
165
  _write(std, s) {
163
- this.stdmockOrigs[std].apply(process[std], (0, util_2.castArray)(s));
166
+ switch (std) {
167
+ case 'stdout':
168
+ this.stdmockOrigs.stdout.apply(stream_1.stdout, (0, util_2.castArray)(s));
169
+ break;
170
+ case 'stderr':
171
+ this.stdmockOrigs.stderr.apply(stream_1.stderr, (0, util_2.castArray)(s));
172
+ break;
173
+ default:
174
+ throw new Error(`invalid std: ${std}`);
175
+ }
164
176
  }
165
177
  }
166
178
  exports.ActionBase = ActionBase;
@@ -18,7 +18,7 @@ export declare class ux {
18
18
  static get action(): ActionBase;
19
19
  static get prideAction(): ActionBase;
20
20
  static styledObject(obj: any, keys?: string[]): void;
21
- static get styledHeader(): typeof styled.styledHeader;
21
+ static styledHeader(header: string): void;
22
22
  static get styledJSON(): typeof styled.styledJSON;
23
23
  static get table(): typeof styled.Table.table;
24
24
  static get tree(): typeof styled.tree;
@@ -47,7 +47,7 @@ declare const log: typeof ux.log;
47
47
  declare const prideAction: ActionBase;
48
48
  declare const progress: typeof styled.progress;
49
49
  declare const prompt: typeof uxPrompt.prompt;
50
- declare const styledHeader: typeof styled.styledHeader;
50
+ declare const styledHeader: typeof ux.styledHeader;
51
51
  declare const styledJSON: typeof styled.styledJSON;
52
52
  declare const styledObject: typeof ux.styledObject;
53
53
  declare const table: typeof styled.Table.table;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.warn = exports.wait = exports.url = exports.tree = exports.trace = exports.Table = exports.table = exports.styledObject = exports.styledJSON = exports.styledHeader = exports.prompt = exports.progress = exports.prideAction = exports.log = exports.info = exports.flush = exports.ExitError = exports.exit = exports.error = exports.done = exports.debug = exports.confirm = exports.Config = exports.config = exports.anykey = exports.annotation = exports.ActionBase = exports.action = exports.ux = void 0;
4
4
  const Errors = require("../errors");
5
5
  const util = require("util");
6
+ const chalk = require("chalk");
6
7
  const base_1 = require("./action/base");
7
8
  Object.defineProperty(exports, "ActionBase", { enumerable: true, get: function () { return base_1.ActionBase; } });
8
9
  const config_1 = require("./config");
@@ -15,6 +16,7 @@ const styled_1 = require("./styled");
15
16
  Object.defineProperty(exports, "Table", { enumerable: true, get: function () { return styled_1.Table; } });
16
17
  const uxPrompt = require("./prompt");
17
18
  const wait_1 = require("./wait");
19
+ const stream_1 = require("./stream");
18
20
  const hyperlinker = require('hyperlinker');
19
21
  function timeout(p, ms) {
20
22
  function wait(ms, unref = false) {
@@ -28,9 +30,9 @@ function timeout(p, ms) {
28
30
  }
29
31
  async function _flush() {
30
32
  const p = new Promise(resolve => {
31
- process.stdout.once('drain', () => resolve(null));
33
+ stream_1.stdout.once('drain', () => resolve(null));
32
34
  });
33
- const flushed = process.stdout.write('');
35
+ const flushed = stream_1.stdout.write('');
34
36
  if (flushed) {
35
37
  return Promise.resolve();
36
38
  }
@@ -59,8 +61,8 @@ class ux {
59
61
  static styledObject(obj, keys) {
60
62
  this.info(styled.styledObject(obj, keys));
61
63
  }
62
- static get styledHeader() {
63
- return styled.styledHeader;
64
+ static styledHeader(header) {
65
+ this.info(chalk.dim('=== ') + chalk.bold(header) + '\n');
64
66
  }
65
67
  static get styledJSON() {
66
68
  return styled.styledJSON;
@@ -82,16 +84,16 @@ class ux {
82
84
  }
83
85
  static trace(format, ...args) {
84
86
  if (this.config.outputLevel === 'trace') {
85
- process.stdout.write(util.format(format, ...args) + '\n');
87
+ stream_1.stdout.write(util.format(format, ...args) + '\n');
86
88
  }
87
89
  }
88
90
  static debug(format, ...args) {
89
91
  if (['trace', 'debug'].includes(this.config.outputLevel)) {
90
- process.stdout.write(util.format(format, ...args) + '\n');
92
+ stream_1.stdout.write(util.format(format, ...args) + '\n');
91
93
  }
92
94
  }
93
95
  static info(format, ...args) {
94
- process.stdout.write(util.format(format, ...args) + '\n');
96
+ stream_1.stdout.write(util.format(format, ...args) + '\n');
95
97
  }
96
98
  static log(format, ...args) {
97
99
  this.info(format || '', ...args);
@@ -4,6 +4,7 @@ exports.anykey = exports.confirm = exports.prompt = void 0;
4
4
  const Errors = require("../errors");
5
5
  const config_1 = require("./config");
6
6
  const chalk = require("chalk");
7
+ const stream_1 = require("./stream");
7
8
  const ansiEscapes = require('ansi-escapes');
8
9
  const passwordPrompt = require('password-prompt');
9
10
  function normal(options, retries = 100) {
@@ -19,7 +20,7 @@ function normal(options, retries = 100) {
19
20
  timer.unref();
20
21
  }
21
22
  process.stdin.setEncoding('utf8');
22
- process.stderr.write(options.prompt);
23
+ stream_1.stderr.write(options.prompt);
23
24
  process.stdin.resume();
24
25
  process.stdin.once('data', b => {
25
26
  if (timer)
@@ -57,7 +58,7 @@ async function single(options) {
57
58
  return response;
58
59
  }
59
60
  function replacePrompt(prompt) {
60
- process.stderr.write(ansiEscapes.cursorHide + ansiEscapes.cursorUp(1) + ansiEscapes.cursorLeft + prompt +
61
+ stream_1.stderr.write(ansiEscapes.cursorHide + ansiEscapes.cursorUp(1) + ansiEscapes.cursorLeft + prompt +
61
62
  ansiEscapes.cursorDown(1) + ansiEscapes.cursorLeft + ansiEscapes.cursorShow);
62
63
  }
63
64
  async function _prompt(name, inputOptions = {}) {
@@ -140,7 +141,7 @@ async function anykey(message) {
140
141
  }
141
142
  const char = await prompt(message, { type: 'single', required: false });
142
143
  if (tty)
143
- process.stderr.write('\n');
144
+ stream_1.stderr.write('\n');
144
145
  if (char === 'q')
145
146
  Errors.error('quit');
146
147
  if (char === '\u0003')
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A wrapper around process.stdout and process.stderr that allows us to mock out the streams for testing.
3
+ */
4
+ declare class Stream {
5
+ channel: 'stdout' | 'stderr';
6
+ constructor(channel: 'stdout' | 'stderr');
7
+ get isTTY(): boolean;
8
+ getWindowSize(): number[];
9
+ write(data: string): boolean;
10
+ read(): boolean;
11
+ on(event: string, listener: (...args: any[]) => void): Stream;
12
+ once(event: string, listener: (...args: any[]) => void): Stream;
13
+ emit(event: string, ...args: any[]): boolean;
14
+ }
15
+ export declare const stdout: Stream;
16
+ export declare const stderr: Stream;
17
+ export {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.stderr = exports.stdout = void 0;
4
+ /**
5
+ * A wrapper around process.stdout and process.stderr that allows us to mock out the streams for testing.
6
+ */
7
+ class Stream {
8
+ constructor(channel) {
9
+ this.channel = channel;
10
+ }
11
+ get isTTY() {
12
+ return process[this.channel].isTTY;
13
+ }
14
+ getWindowSize() {
15
+ return process[this.channel].getWindowSize();
16
+ }
17
+ write(data) {
18
+ return process[this.channel].write(data);
19
+ }
20
+ read() {
21
+ return process[this.channel].read();
22
+ }
23
+ on(event, listener) {
24
+ process[this.channel].on(event, listener);
25
+ return this;
26
+ }
27
+ once(event, listener) {
28
+ process[this.channel].once(event, listener);
29
+ return this;
30
+ }
31
+ emit(event, ...args) {
32
+ return process[this.channel].emit(event, ...args);
33
+ }
34
+ }
35
+ exports.stdout = new Stream('stdout');
36
+ exports.stderr = new Stream('stderr');
@@ -1,7 +1,6 @@
1
- import styledHeader from './header';
2
1
  import styledJSON from './json';
3
2
  import styledObject from './object';
4
3
  import * as Table from './table';
5
4
  import tree from './tree';
6
5
  import progress from './progress';
7
- export { styledHeader, styledJSON, styledObject, Table, tree, progress, };
6
+ export { styledJSON, styledObject, Table, tree, progress, };
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.progress = exports.tree = exports.Table = exports.styledObject = exports.styledJSON = exports.styledHeader = void 0;
4
- const header_1 = require("./header");
5
- exports.styledHeader = header_1.default;
3
+ exports.progress = exports.tree = exports.Table = exports.styledObject = exports.styledJSON = void 0;
6
4
  const json_1 = require("./json");
7
5
  exports.styledJSON = json_1.default;
8
6
  const object_1 = require("./object");
@@ -7,6 +7,7 @@ const chalk = require("chalk");
7
7
  const util_1 = require("../../util");
8
8
  const js_yaml_1 = require("js-yaml");
9
9
  const util_2 = require("util");
10
+ const stream_1 = require("../stream");
10
11
  const sw = require('string-width');
11
12
  const { orderBy } = require('natural-orderby');
12
13
  class Table {
@@ -37,7 +38,7 @@ class Table {
37
38
  filter,
38
39
  'no-header': options['no-header'] ?? false,
39
40
  'no-truncate': options['no-truncate'] ?? false,
40
- printLine: printLine ?? ((s) => process.stdout.write(s + '\n')),
41
+ printLine: printLine ?? ((s) => stream_1.stdout.write(s + '\n')),
41
42
  rowStart: ' ',
42
43
  sort,
43
44
  title,
@@ -171,7 +172,7 @@ class Table {
171
172
  // truncation logic
172
173
  const shouldShorten = () => {
173
174
  // don't shorten if full mode
174
- if (options['no-truncate'] || (!process.stdout.isTTY && !process.env.CLI_UX_SKIP_TTY_CHECK))
175
+ if (options['no-truncate'] || (!stream_1.stdout.isTTY && !process.env.CLI_UX_SKIP_TTY_CHECK))
175
176
  return;
176
177
  // don't shorten if there is enough screen width
177
178
  const dataMaxWidth = (0, util_1.sumBy)(columns, c => c.width);
package/lib/command.d.ts CHANGED
@@ -76,7 +76,7 @@ export declare abstract class Command {
76
76
  * @param {LoadOptions} opts options
77
77
  * @returns {Promise<unknown>} result
78
78
  */
79
- static run<T extends Command>(this: new (argv: string[], config: Config) => T, argv?: string[], opts?: LoadOptions): Promise<unknown>;
79
+ static run<T extends Command>(this: new (argv: string[], config: Config) => T, argv?: string[], opts?: LoadOptions): Promise<ReturnType<T['run']>>;
80
80
  protected static _baseFlags: FlagInput;
81
81
  static get baseFlags(): FlagInput;
82
82
  static set baseFlags(flags: FlagInput);
@@ -88,7 +88,7 @@ export declare abstract class Command {
88
88
  protected debug: (...args: any[]) => void;
89
89
  constructor(argv: string[], config: Config);
90
90
  protected get ctor(): typeof Command;
91
- protected _run<T>(): Promise<T | undefined>;
91
+ protected _run<T>(): Promise<T>;
92
92
  exit(code?: number): void;
93
93
  warn(input: string | Error): string | Error;
94
94
  error(input: string | Error, options: {
@@ -114,6 +114,7 @@ export declare abstract class Command {
114
114
  protected finally(_: Error | undefined): Promise<any>;
115
115
  protected toSuccessJson(result: unknown): any;
116
116
  protected toErrorJson(err: unknown): any;
117
+ protected logJson(json: unknown): void;
117
118
  }
118
119
  export declare namespace Command {
119
120
  type Class = typeof Command & {
package/lib/command.js CHANGED
@@ -4,19 +4,20 @@ exports.Command = void 0;
4
4
  const url_1 = require("url");
5
5
  const chalk = require("chalk");
6
6
  const util_1 = require("util");
7
- const ux = require("./cli-ux");
7
+ const cli_ux_1 = require("./cli-ux");
8
8
  const config_1 = require("./config");
9
9
  const Errors = require("./errors");
10
10
  const Parser = require("./parser");
11
11
  const util_2 = require("./help/util");
12
12
  const flags_1 = require("./flags");
13
13
  const util_3 = require("./util");
14
+ const stream_1 = require("./cli-ux/stream");
14
15
  const pjson = (0, util_3.requireJson)(__dirname, '..', 'package.json');
15
16
  /**
16
17
  * swallows stdout epipe errors
17
18
  * this occurs when stdout closes such as when piping to head
18
19
  */
19
- process.stdout.on('error', (err) => {
20
+ stream_1.stdout.on('error', (err) => {
20
21
  if (err && err.code === 'EPIPE')
21
22
  return;
22
23
  throw err;
@@ -113,9 +114,8 @@ class Command {
113
114
  finally {
114
115
  await this.finally(err);
115
116
  }
116
- if (result && this.jsonEnabled()) {
117
- ux.styledJSON(this.toSuccessJson(result));
118
- }
117
+ if (result && this.jsonEnabled())
118
+ this.logJson(this.toSuccessJson(result));
119
119
  return result;
120
120
  }
121
121
  exit(code = 0) {
@@ -132,13 +132,13 @@ class Command {
132
132
  log(message = '', ...args) {
133
133
  if (!this.jsonEnabled()) {
134
134
  message = typeof message === 'string' ? message : (0, util_1.inspect)(message);
135
- process.stdout.write((0, util_1.format)(message, ...args) + '\n');
135
+ stream_1.stdout.write((0, util_1.format)(message, ...args) + '\n');
136
136
  }
137
137
  }
138
138
  logToStderr(message = '', ...args) {
139
139
  if (!this.jsonEnabled()) {
140
140
  message = typeof message === 'string' ? message : (0, util_1.inspect)(message);
141
- process.stderr.write((0, util_1.format)(message, ...args) + '\n');
141
+ stream_1.stderr.write((0, util_1.format)(message, ...args) + '\n');
142
142
  }
143
143
  }
144
144
  jsonEnabled() {
@@ -197,13 +197,13 @@ class Command {
197
197
  async catch(err) {
198
198
  process.exitCode = process.exitCode ?? err.exitCode ?? 1;
199
199
  if (this.jsonEnabled()) {
200
- ux.styledJSON(this.toErrorJson(err));
200
+ this.logJson(this.toErrorJson(err));
201
201
  }
202
202
  else {
203
203
  if (!err.message)
204
204
  throw err;
205
205
  try {
206
- ux.action.stop(chalk.bold.red('!'));
206
+ cli_ux_1.ux.action.stop(chalk.bold.red('!'));
207
207
  }
208
208
  catch { }
209
209
  throw err;
@@ -225,6 +225,9 @@ class Command {
225
225
  toErrorJson(err) {
226
226
  return { error: err };
227
227
  }
228
+ logJson(json) {
229
+ cli_ux_1.ux.styledJSON(json);
230
+ }
228
231
  }
229
232
  exports.Command = Command;
230
233
  Command._base = `${pjson.name}@${pjson.version}`;
@@ -12,6 +12,7 @@ const util_2 = require("./util");
12
12
  const util_3 = require("../util");
13
13
  const module_loader_1 = require("../module-loader");
14
14
  const util_4 = require("../help/util");
15
+ const stream_1 = require("../cli-ux/stream");
15
16
  // eslint-disable-next-line new-cap
16
17
  const debug = (0, util_2.Debug)();
17
18
  const _pjson = (0, util_3.requireJson)(__dirname, '..', '..', 'package.json');
@@ -220,7 +221,7 @@ class Config {
220
221
  (0, errors_1.exit)(code);
221
222
  },
222
223
  log(message, ...args) {
223
- process.stdout.write((0, util_1.format)(message, ...args) + '\n');
224
+ stream_1.stdout.write((0, util_1.format)(message, ...args) + '\n');
224
225
  },
225
226
  error(message, options = {}) {
226
227
  (0, errors_1.error)(message, options);
package/lib/help/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Help = exports.HelpBase = exports.normalizeArgv = exports.getHelpFlagAdditions = exports.loadHelpClass = exports.standardizeIDFromArgv = exports.CommandHelp = void 0;
4
4
  const stripAnsi = require("strip-ansi");
5
+ const util = require("util");
5
6
  const errors_1 = require("../errors");
6
7
  const command_1 = require("./command");
7
8
  const root_1 = require("./root");
@@ -9,6 +10,7 @@ const util_1 = require("../util");
9
10
  const util_2 = require("./util");
10
11
  const formatter_1 = require("./formatter");
11
12
  const config_1 = require("../config/config");
13
+ const stream_1 = require("../cli-ux/stream");
12
14
  var command_2 = require("./command");
13
15
  Object.defineProperty(exports, "CommandHelp", { enumerable: true, get: function () { return command_2.CommandHelp; } });
14
16
  var util_3 = require("./util");
@@ -268,7 +270,7 @@ class Help extends HelpBase {
268
270
  return this.formatCommand(command);
269
271
  }
270
272
  log(...args) {
271
- console.log(...args);
273
+ stream_1.stdout.write(util.format.apply(this, args) + '\n');
272
274
  }
273
275
  }
274
276
  exports.Help = Help;
package/lib/index.d.ts CHANGED
@@ -12,5 +12,6 @@ import { Hook } from './interfaces/hooks';
12
12
  import { settings, Settings } from './settings';
13
13
  import { HelpSection, HelpSectionRenderer, HelpSectionKeyValueTable } from './help/formatter';
14
14
  import * as ux from './cli-ux';
15
+ import { stderr, stdout } from './cli-ux/stream';
15
16
  declare const flush: typeof ux.ux.flush;
16
- export { Args, Command, CommandHelp, Config, Errors, Flags, loadHelpClass, Help, HelpBase, HelpSection, HelpSectionRenderer, HelpSectionKeyValueTable, Hook, Interfaces, Parser, Plugin, run, toCached, tsPath, toStandardizedId, toConfiguredId, settings, Settings, flush, ux, execute, };
17
+ export { Args, Command, CommandHelp, Config, Errors, Flags, loadHelpClass, Help, HelpBase, HelpSection, HelpSectionRenderer, HelpSectionKeyValueTable, Hook, Interfaces, Parser, Plugin, run, toCached, tsPath, toStandardizedId, toConfiguredId, settings, Settings, flush, ux, execute, stderr, stdout, };
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.execute = exports.ux = exports.flush = exports.settings = exports.toConfiguredId = exports.toStandardizedId = exports.tsPath = exports.toCached = exports.run = exports.Plugin = exports.Parser = exports.Interfaces = exports.HelpBase = exports.Help = exports.loadHelpClass = exports.Flags = exports.Errors = exports.Config = exports.CommandHelp = exports.Command = exports.Args = void 0;
3
+ exports.stdout = exports.stderr = exports.execute = exports.ux = exports.flush = exports.settings = exports.toConfiguredId = exports.toStandardizedId = exports.tsPath = exports.toCached = exports.run = exports.Plugin = exports.Parser = exports.Interfaces = exports.HelpBase = exports.Help = exports.loadHelpClass = exports.Flags = exports.Errors = exports.Config = exports.CommandHelp = exports.Command = exports.Args = void 0;
4
4
  const semver = require("semver");
5
5
  const command_1 = require("./command");
6
6
  Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return command_1.Command; } });
@@ -35,6 +35,9 @@ Object.defineProperty(exports, "settings", { enumerable: true, get: function ()
35
35
  const ux = require("./cli-ux");
36
36
  exports.ux = ux;
37
37
  const util_2 = require("./util");
38
+ const stream_1 = require("./cli-ux/stream");
39
+ Object.defineProperty(exports, "stderr", { enumerable: true, get: function () { return stream_1.stderr; } });
40
+ Object.defineProperty(exports, "stdout", { enumerable: true, get: function () { return stream_1.stdout; } });
38
41
  const flush = ux.flush;
39
42
  exports.flush = flush;
40
43
  function checkCWD() {
@@ -43,14 +46,14 @@ function checkCWD() {
43
46
  }
44
47
  catch (error) {
45
48
  if (error.code === 'ENOENT') {
46
- process.stderr.write('WARNING: current directory does not exist\n');
49
+ stream_1.stderr.write('WARNING: current directory does not exist\n');
47
50
  }
48
51
  }
49
52
  }
50
53
  function checkNodeVersion() {
51
54
  const pjson = (0, util_2.requireJson)(__dirname, '..', 'package.json');
52
55
  if (!semver.satisfies(process.versions.node, pjson.engines.node)) {
53
- process.stderr.write(`WARNING\nWARNING Node version must be ${pjson.engines.node} to use this CLI\nWARNING Current node version: ${process.versions.node}\nWARNING\n`);
56
+ stream_1.stderr.write(`WARNING\nWARNING Node version must be ${pjson.engines.node} to use this CLI\nWARNING Current node version: ${process.versions.node}\nWARNING\n`);
54
57
  }
55
58
  }
56
59
  checkCWD();
package/lib/main.js CHANGED
@@ -9,9 +9,10 @@ const help_1 = require("./help");
9
9
  const settings_1 = require("./settings");
10
10
  const _1 = require(".");
11
11
  const path_1 = require("path");
12
+ const stream_1 = require("./cli-ux/stream");
12
13
  const log = (message = '', ...args) => {
13
14
  message = typeof message === 'string' ? message : (0, util_1.inspect)(message);
14
- process.stdout.write((0, util_1.format)(message, ...args) + '\n');
15
+ stream_1.stdout.write((0, util_1.format)(message, ...args) + '\n');
15
16
  };
16
17
  const helpAddition = (argv, config) => {
17
18
  if (argv.length === 0 && !config.pjson.oclif.default)
package/lib/screen.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.errtermwidth = exports.stdtermwidth = void 0;
4
+ const stream_1 = require("./cli-ux/stream");
4
5
  const settings_1 = require("./settings");
5
6
  function termwidth(stream) {
6
7
  if (!stream.isTTY) {
@@ -16,5 +17,5 @@ function termwidth(stream) {
16
17
  return width;
17
18
  }
18
19
  const columns = Number.parseInt(process.env.OCLIF_COLUMNS, 10) || settings_1.settings.columns;
19
- exports.stdtermwidth = columns || termwidth(process.stdout);
20
- exports.errtermwidth = columns || termwidth(process.stderr);
20
+ exports.stdtermwidth = columns || termwidth(stream_1.stdout);
21
+ exports.errtermwidth = columns || termwidth(stream_1.stderr);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "2.1.7",
4
+ "version": "2.2.1",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {
@@ -1 +0,0 @@
1
- export default function styledHeader(header: string): void;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const chalk = require("chalk");
4
- const index_1 = require("../../index");
5
- function styledHeader(header) {
6
- index_1.ux.info(chalk.dim('=== ') + chalk.bold(header) + '\n');
7
- }
8
- exports.default = styledHeader;