Skip to content

Commit 06ef385

Browse files
authored
fix: node types for process exitCode don't allow string (#1175)
1 parent 209cd79 commit 06ef385

File tree

5 files changed

+36
-62
lines changed

5 files changed

+36
-62
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dependencies": {
88
"@oclif/core": "^3.26.2",
99
"@salesforce/apex-node": "^6.0.0",
10-
"@salesforce/core": "^7.3.3",
10+
"@salesforce/core": "^7.3.5",
1111
"@salesforce/kit": "^3.1.0",
1212
"@salesforce/sf-plugins-core": "^9.0.4",
1313
"@salesforce/source-deploy-retrieve": "^11.3.0",

src/formatters/source/pullFormatter.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
} from '@salesforce/source-deploy-retrieve';
2020
import { Ux } from '@salesforce/sf-plugins-core';
2121
import { ResultFormatter, ResultFormatterOptions } from '../resultFormatter.js';
22+
import { exitCodeAsNumber } from './statusFormatter.js';
2223

2324
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
2425
const messages = Messages.loadMessages('@salesforce/plugin-source', 'pull');
@@ -59,7 +60,7 @@ export class PullResultFormatter extends ResultFormatter {
5960
*/
6061
public getJson(): PullResponse {
6162
if (!this.isSuccess()) {
62-
const error = new SfError('Pull failed.', 'PullFailed', [], process.exitCode);
63+
const error = new SfError('Pull failed.', 'PullFailed', [], exitCodeAsNumber());
6364
error.setData(
6465
this.fileResponses.map(({ state, fullName, type, filePath }) => ({ state, fullName, type, filePath }))
6566
);

src/formatters/source/pushResultFormatter.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { isString } from '@salesforce/ts-types';
2323
import { ensureArray } from '@salesforce/kit';
2424
import { Ux } from '@salesforce/sf-plugins-core';
2525
import { ResultFormatter, ResultFormatterOptions } from '../resultFormatter.js';
26+
import { exitCodeAsNumber } from './statusFormatter.js';
2627

2728
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
2829
const messages = Messages.loadMessages('@salesforce/plugin-source', 'push');
@@ -60,7 +61,7 @@ export class PushResultFormatter extends ResultFormatter {
6061
const error = SfError.create({
6162
context: 'Push',
6263
name: 'DeployFailed',
63-
exitCode: process.exitCode,
64+
exitCode: exitCodeAsNumber(),
6465
message: messages.getMessage('sourcepushFailed', ['']),
6566
data: errorData,
6667
});

src/formatters/source/statusFormatter.ts

+9
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ const rowSortFunction = (a: StatusResult, b: StatusResult): number => {
3939
return a.state.toLowerCase() < b.state.toLowerCase() ? -1 : 1;
4040
};
4141

42+
export const exitCodeAsNumber = (): number | undefined => {
43+
try {
44+
return typeof process.exitCode === 'string' ? parseInt(process.exitCode, 10) : process.exitCode;
45+
} catch {
46+
// it *could* be a string that fails to parse to int?
47+
return undefined;
48+
}
49+
};
50+
4251
export class StatusFormatter extends ResultFormatter {
4352
public constructor(ux: Ux, options: ResultFormatterOptions, private statusRows: StatusResult[]) {
4453
super(ux, options);

yarn.lock

+22-59
Original file line numberDiff line numberDiff line change
@@ -910,15 +910,15 @@
910910
"@smithy/types" "^2.12.0"
911911
tslib "^2.6.2"
912912

913-
"@aws-sdk/[email protected]", "@aws-sdk/types@^3.222.0":
913+
"@aws-sdk/[email protected]":
914914
version "3.535.0"
915915
resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.535.0.tgz#5e6479f31299dd9df170e63f4d10fe739008cf04"
916916
integrity sha512-aY4MYfduNj+sRR37U7XxYR8wemfbKP6lx00ze2M2uubn7mZotuVrWYAafbMSXrdEMSToE5JDhr28vArSOoLcSg==
917917
dependencies:
918918
"@smithy/types" "^2.12.0"
919919
tslib "^2.6.2"
920920

921-
"@aws-sdk/[email protected]":
921+
"@aws-sdk/[email protected]", "@aws-sdk/types@^3.222.0":
922922
version "3.567.0"
923923
resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.567.0.tgz#b2dc88e154140b1ff87e94f63c97447bdb1c1738"
924924
integrity sha512-JBznu45cdgQb8+T/Zab7WpBmfEAh77gsk99xuF4biIb2Sw1mdseONdoGDjEJX57a25TzIv/WUJ2oABWumckz1A==
@@ -1539,12 +1539,7 @@
15391539
ansi-escapes "^4.3.2"
15401540
chalk "^4.1.2"
15411541

1542-
"@inquirer/type@^1.1.6", "@inquirer/type@^1.2.1":
1543-
version "1.2.1"
1544-
resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-1.2.1.tgz#fbc7ab3a2e5050d0c150642d5e8f5e88faa066b8"
1545-
integrity sha512-xwMfkPAxeo8Ji/IxfUSqzRi0/+F2GIqJmpc5/thelgMGsjNZcjDDRBO9TLXT1s/hdx/mK5QbVIvgoLIFgXhTMQ==
1546-
1547-
"@inquirer/type@^1.3.1":
1542+
"@inquirer/type@^1.1.6", "@inquirer/type@^1.2.1", "@inquirer/type@^1.3.1":
15481543
version "1.3.1"
15491544
resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-1.3.1.tgz#afb95ff78f44fff7e8a00e17d5820db6add2a076"
15501545
integrity sha512-Pe3PFccjPVJV1vtlfVvm9OnlbxqdnP5QcscFEFEnK5quChf1ufZtM0r8mR5ToWHMxZOh0s8o/qp9ANGRTo/DAw==
@@ -1772,16 +1767,16 @@
17721767
strip-ansi "6.0.1"
17731768
ts-retry-promise "^0.8.0"
17741769

1775-
"@salesforce/core@^7.0.0", "@salesforce/core@^7.2.0", "@salesforce/core@^7.3.0", "@salesforce/core@^7.3.1", "@salesforce/core@^7.3.3":
1776-
version "7.3.3"
1777-
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.3.tgz#4b84aba806264dd13716f4c4774bd5a417259662"
1778-
integrity sha512-THjYnOrfj0vW+qvlm70NDasH3RHD03cm884yi1+1axA4ugS4FFxXrPDPWAEU5ve5B4vnT7CJfuD/Q56l67ug8w==
1770+
"@salesforce/core@^7.0.0", "@salesforce/core@^7.2.0", "@salesforce/core@^7.3.0", "@salesforce/core@^7.3.1", "@salesforce/core@^7.3.5":
1771+
version "7.3.5"
1772+
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.5.tgz#0dccb4d8ddd36cde449d67a482dfb52e63de1c9f"
1773+
integrity sha512-9hkK4EyV1Z7T1mDyb/Rj1dO0Owp3f2PNGXSyQhCG2nozSCxAQlPeFFqn2L3d7kJJxdhlr58P4QXiFCoJVVvbLQ==
17791774
dependencies:
17801775
"@jsforce/jsforce-node" "^3.2.0"
17811776
"@salesforce/kit" "^3.1.1"
17821777
"@salesforce/schemas" "^1.7.0"
17831778
"@salesforce/ts-types" "^2.0.9"
1784-
ajv "^8.12.0"
1779+
ajv "^8.13.0"
17851780
change-case "^4.1.2"
17861781
faye "^1.4.0"
17871782
form-data "^4.0.0"
@@ -2670,10 +2665,10 @@
26702665
dependencies:
26712666
"@types/node" "*"
26722667

2673-
"@types/node@*", "@types/node@^20.10.7", "@types/node@^20.12.4":
2674-
version "20.12.5"
2675-
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.5.tgz#74c4f31ab17955d0b5808cdc8fd2839526ad00b3"
2676-
integrity sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==
2668+
"@types/node@*", "@types/node@^20.10.7", "@types/node@^20.12.4", "@types/node@^20.12.7":
2669+
version "20.12.8"
2670+
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.8.tgz#35897bf2bfe3469847ab04634636de09552e8256"
2671+
integrity sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==
26772672
dependencies:
26782673
undici-types "~5.26.4"
26792674

@@ -2689,13 +2684,6 @@
26892684
dependencies:
26902685
undici-types "~5.26.4"
26912686

2692-
"@types/node@^20.12.7":
2693-
version "20.12.8"
2694-
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.8.tgz#35897bf2bfe3469847ab04634636de09552e8256"
2695-
integrity sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==
2696-
dependencies:
2697-
undici-types "~5.26.4"
2698-
26992687
"@types/normalize-package-data@^2.4.0":
27002688
version "2.4.4"
27012689
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz#56e2cc26c397c038fab0e3a917a12d5c5909e901"
@@ -2898,15 +2886,15 @@ ajv@^6.12.4:
28982886
json-schema-traverse "^0.4.1"
28992887
uri-js "^4.2.2"
29002888

2901-
ajv@^8.11.0, ajv@^8.12.0:
2902-
version "8.12.0"
2903-
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1"
2904-
integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==
2889+
ajv@^8.11.0, ajv@^8.13.0:
2890+
version "8.13.0"
2891+
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.13.0.tgz#a3939eaec9fb80d217ddf0c3376948c023f28c91"
2892+
integrity sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==
29052893
dependencies:
2906-
fast-deep-equal "^3.1.1"
2894+
fast-deep-equal "^3.1.3"
29072895
json-schema-traverse "^1.0.0"
29082896
require-from-string "^2.0.2"
2909-
uri-js "^4.2.2"
2897+
uri-js "^4.4.1"
29102898

29112899
29122900
version "4.1.1"
@@ -7553,16 +7541,7 @@ srcset@^5.0.0:
75537541
resolved "https://registry.yarnpkg.com/srcset/-/srcset-5.0.0.tgz#9df6c3961b5b44a02532ce6ae4544832609e2e3f"
75547542
integrity sha512-SqEZaAEhe0A6ETEa9O1IhSPC7MdvehZtCnTR0AftXk3QhY2UNgb+NApFOUPZILXk/YTDfFxMTNJOBpzrJsEdIA==
75557543

7556-
"string-width-cjs@npm:string-width@^4.2.0":
7557-
version "4.2.3"
7558-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
7559-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
7560-
dependencies:
7561-
emoji-regex "^8.0.0"
7562-
is-fullwidth-code-point "^3.0.0"
7563-
strip-ansi "^6.0.1"
7564-
7565-
string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
7544+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
75667545
version "4.2.3"
75677546
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
75687547
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -7621,14 +7600,7 @@ string_decoder@~1.1.1:
76217600
dependencies:
76227601
safe-buffer "~5.1.0"
76237602

7624-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
7625-
version "6.0.1"
7626-
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
7627-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
7628-
dependencies:
7629-
ansi-regex "^5.0.1"
7630-
7631-
[email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1:
7603+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", [email protected], strip-ansi@^6.0.0, strip-ansi@^6.0.1:
76327604
version "6.0.1"
76337605
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
76347606
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -8028,7 +8000,7 @@ upper-case@^2.0.2:
80288000
dependencies:
80298001
tslib "^2.0.3"
80308002

8031-
uri-js@^4.2.2:
8003+
uri-js@^4.2.2, uri-js@^4.4.1:
80328004
version "4.4.1"
80338005
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
80348006
integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==
@@ -8177,7 +8149,7 @@ [email protected]:
81778149
resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343"
81788150
integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==
81798151

8180-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
8152+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
81818153
version "7.0.0"
81828154
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
81838155
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -8195,15 +8167,6 @@ wrap-ansi@^6.2.0:
81958167
string-width "^4.1.0"
81968168
strip-ansi "^6.0.0"
81978169

8198-
wrap-ansi@^7.0.0:
8199-
version "7.0.0"
8200-
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
8201-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
8202-
dependencies:
8203-
ansi-styles "^4.0.0"
8204-
string-width "^4.1.0"
8205-
strip-ansi "^6.0.0"
8206-
82078170
wrap-ansi@^8.1.0:
82088171
version "8.1.0"
82098172
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)