@oclif/core 4.13.4 → 4.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.
- package/lib/config/config.js +1 -1
- package/lib/config/plugin.js +0 -1
- package/lib/errors/errors/cli.js +0 -2
- package/lib/errors/handle.js +1 -1
- package/lib/util/os.d.ts +1 -1
- package/lib/util/os.js +4 -6
- package/lib/util/util.js +0 -1
- package/package.json +3 -3
package/lib/config/config.js
CHANGED
|
@@ -258,7 +258,7 @@ class Config {
|
|
|
258
258
|
this.channel = this.options.channel || channelFromVersion(this.version);
|
|
259
259
|
this.valid = this.rootPlugin.valid;
|
|
260
260
|
this.arch = (0, node_os_1.arch)() === 'ia32' ? 'x86' : (0, node_os_1.arch)();
|
|
261
|
-
this.platform = (0, os_1.getPlatform)();
|
|
261
|
+
this.platform = await (0, os_1.getPlatform)();
|
|
262
262
|
this.windows = this.platform === 'win32';
|
|
263
263
|
this.bin = this.pjson.oclif.bin || this.name;
|
|
264
264
|
this.binAliases = this.pjson.oclif.binAliases;
|
package/lib/config/plugin.js
CHANGED
package/lib/errors/errors/cli.js
CHANGED
|
@@ -34,7 +34,6 @@ class CLIError extends Error {
|
|
|
34
34
|
this.code = options.code;
|
|
35
35
|
this.suggestions = options.suggestions;
|
|
36
36
|
}
|
|
37
|
-
// eslint-disable-next-line getter-return
|
|
38
37
|
get bang() {
|
|
39
38
|
try {
|
|
40
39
|
return (0, theme_1.colorize)('red', process.platform === 'win32' ? '»' : '›');
|
|
@@ -67,7 +66,6 @@ exports.CLIError = CLIError;
|
|
|
67
66
|
super(err instanceof Error ? err.message : err);
|
|
68
67
|
this.name = 'Warning';
|
|
69
68
|
}
|
|
70
|
-
// eslint-disable-next-line getter-return
|
|
71
69
|
get bang() {
|
|
72
70
|
try {
|
|
73
71
|
return (0, theme_1.colorize)('yellow', process.platform === 'win32' ? '»' : '›');
|
package/lib/errors/handle.js
CHANGED
|
@@ -19,7 +19,7 @@ const pretty_print_1 = __importDefault(require("./errors/pretty-print"));
|
|
|
19
19
|
*/
|
|
20
20
|
exports.Exit = {
|
|
21
21
|
exit(code = 0) {
|
|
22
|
-
// eslint-disable-next-line
|
|
22
|
+
// eslint-disable-next-line unicorn/no-process-exit
|
|
23
23
|
process.exit(code);
|
|
24
24
|
},
|
|
25
25
|
};
|
package/lib/util/os.d.ts
CHANGED
|
@@ -15,5 +15,5 @@ export declare function getHomeDir(): string;
|
|
|
15
15
|
*
|
|
16
16
|
* @returns The process' platform
|
|
17
17
|
*/
|
|
18
|
-
export declare function getPlatform(): 'wsl' | NodeJS.Platform
|
|
18
|
+
export declare function getPlatform(): Promise<'wsl' | NodeJS.Platform>;
|
|
19
19
|
export declare function getShell(): Promise<string>;
|
package/lib/util/os.js
CHANGED
|
@@ -9,8 +9,6 @@ exports.getShell = getShell;
|
|
|
9
9
|
const node_child_process_1 = require("node:child_process");
|
|
10
10
|
const node_os_1 = require("node:os");
|
|
11
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');
|
|
14
12
|
/**
|
|
15
13
|
* Call os.homedir() and return the result
|
|
16
14
|
*
|
|
@@ -30,8 +28,8 @@ function getHomeDir() {
|
|
|
30
28
|
*
|
|
31
29
|
* @returns The process' platform
|
|
32
30
|
*/
|
|
33
|
-
function getPlatform() {
|
|
34
|
-
return
|
|
31
|
+
async function getPlatform() {
|
|
32
|
+
return (await import('wsl-utils')).isWsl ? 'wsl' : (0, node_os_1.platform)();
|
|
35
33
|
}
|
|
36
34
|
async function getShell() {
|
|
37
35
|
let shellPath;
|
|
@@ -39,7 +37,7 @@ async function getShell() {
|
|
|
39
37
|
if (SHELL) {
|
|
40
38
|
shellPath = SHELL.split('/');
|
|
41
39
|
}
|
|
42
|
-
else if (getPlatform() === 'win32') {
|
|
40
|
+
else if ((await getPlatform()) === 'win32') {
|
|
43
41
|
shellPath = (await determineWindowsShell()).split(node_path_1.default.sep);
|
|
44
42
|
}
|
|
45
43
|
else {
|
|
@@ -49,7 +47,7 @@ async function getShell() {
|
|
|
49
47
|
}
|
|
50
48
|
async function determineWindowsShell() {
|
|
51
49
|
try {
|
|
52
|
-
const parentProcessName = (0, node_child_process_1.execSync)(`${await
|
|
50
|
+
const parentProcessName = (0, node_child_process_1.execSync)(`${await (await import('wsl-utils')).powerShellPath()} -NoProfile -Command "(Get-CimInstance Win32_Process -Filter 'ProcessID = ${process.ppid}').Name"`, { encoding: 'utf8' });
|
|
53
51
|
return parentProcessName.includes('powershell') || parentProcessName.includes('pwsh')
|
|
54
52
|
? 'powershell'
|
|
55
53
|
: (process.env.COMSPEC ?? 'cmd.exe');
|
package/lib/util/util.js
CHANGED
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.
|
|
4
|
+
"version": "4.14.0",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bugs": "https://github.com/oclif/core/issues",
|
|
7
7
|
"dependencies": {
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"chai-as-promised": "^7.1.2",
|
|
52
52
|
"commitlint": "^19",
|
|
53
53
|
"cross-env": "^7.0.3",
|
|
54
|
-
"eslint": "^
|
|
55
|
-
"eslint-config-oclif": "^
|
|
54
|
+
"eslint": "^10",
|
|
55
|
+
"eslint-config-oclif": "^7",
|
|
56
56
|
"eslint-config-prettier": "^10",
|
|
57
57
|
"husky": "^9.1.7",
|
|
58
58
|
"lint-staged": "^15",
|