@oclif/core 2.13.0 → 2.14.0

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.
@@ -4,7 +4,6 @@ const chalk = require("chalk");
4
4
  const supportsColor = require("supports-color");
5
5
  const stripAnsi = require('strip-ansi');
6
6
  const ansiStyles = require('ansi-styles');
7
- const ansiEscapes = require('ansi-escapes');
8
7
  const screen_1 = require("../../screen");
9
8
  const spinners_1 = require("./spinners");
10
9
  const base_1 = require("./base");
@@ -65,6 +64,7 @@ class SpinnerAction extends base_1.ActionBase {
65
64
  _reset() {
66
65
  if (!this.output)
67
66
  return;
67
+ const ansiEscapes = require('ansi-escapes');
68
68
  const lines = this._lines(this.output);
69
69
  this._write(this.std, ansiEscapes.cursorLeft + ansiEscapes.cursorUp(lines) + ansiEscapes.eraseDown);
70
70
  this.output = undefined;
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.config = exports.Config = void 0;
4
- const semver = require("semver");
5
4
  const util_1 = require("../util");
6
5
  const spinner_1 = require("./action/spinner");
7
6
  const spinner_2 = require("./action/spinner");
8
7
  const pride_spinner_1 = require("./action/pride-spinner");
9
- const version = semver.parse((0, util_1.requireJson)(__dirname, '..', '..', 'package.json').version);
10
8
  const g = global;
11
9
  const globals = g['cli-ux'] || (g['cli-ux'] = {});
12
10
  const actionType = (Boolean(process.stderr.isTTY) &&
@@ -38,10 +36,11 @@ class Config {
38
36
  }
39
37
  exports.Config = Config;
40
38
  function fetch() {
41
- if (globals[version.major])
42
- return globals[version.major];
43
- globals[version.major] = new Config();
44
- return globals[version.major];
39
+ const major = (0, util_1.requireJson)(__dirname, '..', '..', 'package.json').version.split('.')[0];
40
+ if (globals[major])
41
+ return globals[major];
42
+ globals[major] = new Config();
43
+ return globals[major];
45
44
  }
46
45
  exports.config = fetch();
47
46
  exports.default = exports.config;
@@ -5,8 +5,6 @@ const Errors = require("../errors");
5
5
  const config_1 = require("./config");
6
6
  const chalk = require("chalk");
7
7
  const stream_1 = require("./stream");
8
- const ansiEscapes = require('ansi-escapes');
9
- const passwordPrompt = require('password-prompt');
10
8
  function normal(options, retries = 100) {
11
9
  if (retries < 0)
12
10
  throw new Error('no input');
@@ -58,6 +56,7 @@ async function single(options) {
58
56
  return response;
59
57
  }
60
58
  function replacePrompt(prompt) {
59
+ const ansiEscapes = require('ansi-escapes');
61
60
  stream_1.stderr.write(ansiEscapes.cursorHide + ansiEscapes.cursorUp(1) + ansiEscapes.cursorLeft + prompt +
62
61
  ansiEscapes.cursorDown(1) + ansiEscapes.cursorLeft + ansiEscapes.cursorShow);
63
62
  }
@@ -72,6 +71,7 @@ async function _prompt(name, inputOptions = {}) {
72
71
  default: '',
73
72
  ...inputOptions,
74
73
  };
74
+ const passwordPrompt = require('password-prompt');
75
75
  switch (options.type) {
76
76
  case 'normal':
77
77
  return normal(options);
@@ -15,9 +15,8 @@ const help_1 = require("../help");
15
15
  const stream_1 = require("../cli-ux/stream");
16
16
  const performance_1 = require("../performance");
17
17
  const settings_1 = require("../settings");
18
- const node_os_1 = require("node:os");
19
- const node_path_1 = require("node:path");
20
- const semver_1 = require("semver");
18
+ const os_1 = require("os");
19
+ const path_1 = require("path");
21
20
  // eslint-disable-next-line new-cap
22
21
  const debug = (0, util_2.Debug)();
23
22
  const _pjson = (0, util_3.requireJson)(__dirname, '..', '..', 'package.json');
@@ -98,6 +97,7 @@ class Config {
98
97
  if (typeof opts === 'string')
99
98
  opts = { root: opts };
100
99
  if (isConfig(opts)) {
100
+ const { lt } = await import('semver');
101
101
  const currentConfigBase = BASE.replace('@oclif/core@', '');
102
102
  const incomingConfigBase = opts._base.replace('@oclif/core@', '');
103
103
  /**
@@ -110,7 +110,7 @@ class Config {
110
110
  * exists in the version of Config required by the command but may not exist on the
111
111
  * root's instance of Config.
112
112
  */
113
- if ((0, semver_1.lt)(incomingConfigBase, currentConfigBase)) {
113
+ if (lt(incomingConfigBase, currentConfigBase)) {
114
114
  debug(`reloading config from ${opts._base} to ${BASE}`);
115
115
  return new Config({ ...opts.options, config: opts });
116
116
  }
@@ -523,7 +523,7 @@ class Config {
523
523
  _shell() {
524
524
  let shellPath;
525
525
  const COMSPEC = process.env.COMSPEC;
526
- const SHELL = process.env.SHELL ?? (0, node_os_1.userInfo)().shell?.split(node_path_1.sep)?.pop();
526
+ const SHELL = process.env.SHELL ?? (0, os_1.userInfo)().shell?.split(path_1.sep)?.pop();
527
527
  if (SHELL) {
528
528
  shellPath = SHELL.split('/');
529
529
  }
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Logger = void 0;
4
- const fs = require("fs-extra");
5
- const path = require("path");
4
+ const fs = require("fs/promises");
5
+ const path_1 = require("path");
6
6
  const stripAnsi = require("strip-ansi");
7
7
  const timestamp = () => new Date().toISOString();
8
8
  let timer;
@@ -35,7 +35,7 @@ class Logger {
35
35
  return;
36
36
  const mylines = this.buffer;
37
37
  this.buffer = [];
38
- await fs.mkdirp(path.dirname(this.file));
38
+ await fs.mkdir((0, path_1.dirname)(this.file), { recursive: true });
39
39
  await fs.appendFile(this.file, mylines.join('\n') + '\n');
40
40
  });
41
41
  await this.flushing;
package/lib/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.stdout = exports.stderr = exports.execute = exports.ux = exports.flush = exports.settings = exports.toConfiguredId = exports.toStandardizedId = exports.tsPath = exports.toCached = exports.run = exports.Performance = 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
- const semver = require("semver");
5
4
  const command_1 = require("./command");
6
5
  Object.defineProperty(exports, "Command", { enumerable: true, get: function () { return command_1.Command; } });
7
6
  const main_1 = require("./main");
@@ -34,7 +33,6 @@ const settings_1 = require("./settings");
34
33
  Object.defineProperty(exports, "settings", { enumerable: true, get: function () { return settings_1.settings; } });
35
34
  const ux = require("./cli-ux");
36
35
  exports.ux = ux;
37
- const util_2 = require("./util");
38
36
  const stream_1 = require("./cli-ux/stream");
39
37
  Object.defineProperty(exports, "stderr", { enumerable: true, get: function () { return stream_1.stderr; } });
40
38
  Object.defineProperty(exports, "stdout", { enumerable: true, get: function () { return stream_1.stdout; } });
@@ -52,11 +50,4 @@ function checkCWD() {
52
50
  }
53
51
  }
54
52
  }
55
- function checkNodeVersion() {
56
- const pjson = (0, util_2.requireJson)(__dirname, '..', 'package.json');
57
- if (!semver.satisfies(process.versions.node, pjson.engines.node)) {
58
- 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`);
59
- }
60
- }
61
53
  checkCWD();
62
- checkNodeVersion();
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const path = require("path");
4
4
  const url = require("url");
5
- const fs = require("fs-extra");
5
+ const fs_1 = require("fs");
6
6
  const errors_1 = require("./errors");
7
7
  const Config = require("./config");
8
8
  const getPackageType = require('get-package-type');
@@ -131,10 +131,10 @@ class ModuleLoader {
131
131
  filePath = isPlugin(config) ? Config.tsPath(config.root, modulePath, config.type) : Config.tsPath(config.root, modulePath);
132
132
  let fileExists = false;
133
133
  let isDirectory = false;
134
- if (fs.existsSync(filePath)) {
134
+ if ((0, fs_1.existsSync)(filePath)) {
135
135
  fileExists = true;
136
136
  try {
137
- if (fs.lstatSync(filePath)?.isDirectory?.()) {
137
+ if ((0, fs_1.lstatSync)(filePath)?.isDirectory?.()) {
138
138
  fileExists = false;
139
139
  isDirectory = true;
140
140
  }
@@ -167,7 +167,7 @@ class ModuleLoader {
167
167
  // eslint-disable-next-line camelcase
168
168
  for (const extension of s_EXTENSIONS) {
169
169
  const testPath = `${filePath}${extension}`;
170
- if (fs.existsSync(testPath)) {
170
+ if ((0, fs_1.existsSync)(testPath)) {
171
171
  return testPath;
172
172
  }
173
173
  }
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.13.0",
4
+ "version": "2.14.0",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {
@@ -14,7 +14,6 @@
14
14
  "cli-progress": "^3.12.0",
15
15
  "debug": "^4.3.4",
16
16
  "ejs": "^3.1.8",
17
- "fs-extra": "^9.1.0",
18
17
  "get-package-type": "^0.1.0",
19
18
  "globby": "^11.1.0",
20
19
  "hyperlinker": "^1.0.0",
@@ -24,7 +23,7 @@
24
23
  "natural-orderby": "^2.0.3",
25
24
  "object-treeify": "^1.1.33",
26
25
  "password-prompt": "^1.1.2",
27
- "semver": "^7.5.3",
26
+ "semver": "^7.5.4",
28
27
  "slice-ansi": "^4.0.0",
29
28
  "string-width": "^4.2.3",
30
29
  "strip-ansi": "^6.0.1",
@@ -47,7 +46,6 @@
47
46
  "@types/chai-as-promised": "^7.1.5",
48
47
  "@types/clean-stack": "^2.1.1",
49
48
  "@types/ejs": "^3.1.2",
50
- "@types/fs-extra": "^9.0.13",
51
49
  "@types/indent-string": "^4.0.1",
52
50
  "@types/js-yaml": "^3.12.7",
53
51
  "@types/mocha": "^8.2.3",
@@ -55,7 +53,7 @@
55
53
  "@types/node": "^16",
56
54
  "@types/node-notifier": "^8.0.2",
57
55
  "@types/proxyquire": "^1.3.28",
58
- "@types/semver": "^7.5.0",
56
+ "@types/semver": "^7.5.1",
59
57
  "@types/shelljs": "^0.8.11",
60
58
  "@types/slice-ansi": "^4.0.0",
61
59
  "@types/strip-ansi": "^5.2.1",
@@ -120,4 +118,4 @@
120
118
  "test:perf": "ts-node test/perf/parser.perf.ts"
121
119
  },
122
120
  "types": "lib/index.d.ts"
123
- }
121
+ }