@oclif/core 4.13.2 → 4.13.4
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/lib/config/config.js +3 -36
- package/lib/help/util.js +5 -35
- package/lib/util/os.d.ts +1 -1
- package/lib/util/os.js +7 -6
- package/package.json +4 -4
package/lib/config/config.js
CHANGED
|
@@ -1,43 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
38
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
6
|
exports.Config = void 0;
|
|
40
|
-
const
|
|
7
|
+
const ejs_1 = __importDefault(require("ejs"));
|
|
41
8
|
const node_os_1 = require("node:os");
|
|
42
9
|
const node_path_1 = require("node:path");
|
|
43
10
|
const node_url_1 = require("node:url");
|
|
@@ -304,7 +271,7 @@ class Config {
|
|
|
304
271
|
if (this.platform === 'win32')
|
|
305
272
|
this.dirname = this.dirname.replace('/', '\\');
|
|
306
273
|
this.userAgent = `${this.name}/${this.version} ${this.platform}-${this.arch} node-${process.version}`;
|
|
307
|
-
this.shell = (0, os_1.getShell)();
|
|
274
|
+
this.shell = await (0, os_1.getShell)();
|
|
308
275
|
this.home = process.env.HOME || (this.windows && this.windowsHome()) || (0, os_1.getHomeDir)() || (0, node_os_1.tmpdir)();
|
|
309
276
|
this.cacheDir = this.scopedEnvVar('CACHE_DIR') || this.macosCacheDir() || this.dir('cache');
|
|
310
277
|
this.configDir = this.scopedEnvVar('CONFIG_DIR') || this.dir('config');
|
|
@@ -532,7 +499,7 @@ class Config {
|
|
|
532
499
|
else if (ext)
|
|
533
500
|
options.ext = ext;
|
|
534
501
|
const template = this.updateConfig.s3?.templates?.[options.platform ? 'target' : 'vanilla'][type] ?? '';
|
|
535
|
-
return
|
|
502
|
+
return ejs_1.default.render(template, { ...this, ...options });
|
|
536
503
|
}
|
|
537
504
|
s3Url(key) {
|
|
538
505
|
const { host } = this.updateConfig.s3 ?? { host: undefined };
|
package/lib/help/util.js
CHANGED
|
@@ -1,37 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
35
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
6
|
exports.template = template;
|
|
37
7
|
exports.standardizeIDFromArgv = standardizeIDFromArgv;
|
|
@@ -39,12 +9,12 @@ exports.getHelpFlagAdditions = getHelpFlagAdditions;
|
|
|
39
9
|
exports.formatFlagDeprecationWarning = formatFlagDeprecationWarning;
|
|
40
10
|
exports.formatCommandDeprecationWarning = formatCommandDeprecationWarning;
|
|
41
11
|
exports.normalizeArgv = normalizeArgv;
|
|
42
|
-
const
|
|
12
|
+
const ejs_1 = __importDefault(require("ejs"));
|
|
43
13
|
const util_1 = require("../config/util");
|
|
44
14
|
const ids_1 = require("../util/ids");
|
|
45
15
|
function template(context) {
|
|
46
16
|
function render(t) {
|
|
47
|
-
return
|
|
17
|
+
return ejs_1.default.render(t, context);
|
|
48
18
|
}
|
|
49
19
|
return render;
|
|
50
20
|
}
|
package/lib/util/os.d.ts
CHANGED
package/lib/util/os.js
CHANGED
|
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getHomeDir = getHomeDir;
|
|
7
7
|
exports.getPlatform = getPlatform;
|
|
8
8
|
exports.getShell = getShell;
|
|
9
|
-
const is_wsl_1 = __importDefault(require("is-wsl"));
|
|
10
9
|
const node_child_process_1 = require("node:child_process");
|
|
11
10
|
const node_os_1 = require("node:os");
|
|
12
11
|
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
+
// eslint-disable-next-line perfectionist/sort-imports -- Conflicts with other import rules in the case of `require` statements.
|
|
13
|
+
const wslUtils = require('wsl-utils');
|
|
13
14
|
/**
|
|
14
15
|
* Call os.homedir() and return the result
|
|
15
16
|
*
|
|
@@ -30,25 +31,25 @@ function getHomeDir() {
|
|
|
30
31
|
* @returns The process' platform
|
|
31
32
|
*/
|
|
32
33
|
function getPlatform() {
|
|
33
|
-
return
|
|
34
|
+
return wslUtils.isWsl ? 'wsl' : (0, node_os_1.platform)();
|
|
34
35
|
}
|
|
35
|
-
function getShell() {
|
|
36
|
+
async function getShell() {
|
|
36
37
|
let shellPath;
|
|
37
38
|
const SHELL = process.env.SHELL ?? (0, node_os_1.userInfo)().shell?.split(node_path_1.default.sep)?.pop();
|
|
38
39
|
if (SHELL) {
|
|
39
40
|
shellPath = SHELL.split('/');
|
|
40
41
|
}
|
|
41
42
|
else if (getPlatform() === 'win32') {
|
|
42
|
-
shellPath = determineWindowsShell().split(node_path_1.default.sep);
|
|
43
|
+
shellPath = (await determineWindowsShell()).split(node_path_1.default.sep);
|
|
43
44
|
}
|
|
44
45
|
else {
|
|
45
46
|
shellPath = ['unknown'];
|
|
46
47
|
}
|
|
47
48
|
return shellPath.at(-1) ?? 'unknown';
|
|
48
49
|
}
|
|
49
|
-
function determineWindowsShell() {
|
|
50
|
+
async function determineWindowsShell() {
|
|
50
51
|
try {
|
|
51
|
-
const parentProcessName = (0, node_child_process_1.execSync)(
|
|
52
|
+
const parentProcessName = (0, node_child_process_1.execSync)(`${await wslUtils.powerShellPath()} -NoProfile -Command "(Get-CimInstance Win32_Process -Filter 'ProcessID = ${process.ppid}').Name"`, { encoding: 'utf8' });
|
|
52
53
|
return parentProcessName.includes('powershell') || parentProcessName.includes('pwsh')
|
|
53
54
|
? 'powershell'
|
|
54
55
|
: (process.env.COMSPEC ?? 'cmd.exe');
|
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": "4.13.
|
|
4
|
+
"version": "4.13.4",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
"clean-stack": "^3.0.1",
|
|
11
11
|
"cli-spinners": "^2.9.2",
|
|
12
12
|
"debug": "^4.4.3",
|
|
13
|
-
"ejs": "^
|
|
13
|
+
"ejs": "^6",
|
|
14
14
|
"get-package-type": "^0.1.0",
|
|
15
15
|
"indent-string": "^4.0.0",
|
|
16
|
-
"is-wsl": "^2.2.0",
|
|
17
16
|
"lilconfig": "^3.1.3",
|
|
18
17
|
"minimatch": "^10.2.5",
|
|
19
18
|
"semver": "^7.8.1",
|
|
@@ -22,7 +21,8 @@
|
|
|
22
21
|
"tinyglobby": "^0.2.17",
|
|
23
22
|
"widest-line": "^3.1.0",
|
|
24
23
|
"wordwrap": "^1.0.0",
|
|
25
|
-
"wrap-ansi": "^7.0.0"
|
|
24
|
+
"wrap-ansi": "^7.0.0",
|
|
25
|
+
"wsl-utils": "^0.4.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@commitlint/config-conventional": "^19",
|