Skip to content

Commit

Permalink
fix: node types for process exitCode don't allow string
Browse files Browse the repository at this point in the history
  • Loading branch information
iowillhoit committed May 6, 2024
1 parent 57477a8 commit 19d9aaf
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 168 deletions.
9 changes: 7 additions & 2 deletions src/formatters/deleteResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import { ensureArray } from '@salesforce/kit';
import chalk from 'chalk';
import { StandardColors } from '@salesforce/sf-plugins-core';
import { DeleteSourceJson, Formatter, TestLevel, isSdrSuccess } from '../utils/types.js';
import { fileResponseSortFn, getFileResponseSuccessProps, makePathRelative } from '../utils/output.js';
import {
exitCodeAsNumber,
fileResponseSortFn,
getFileResponseSuccessProps,
makePathRelative,
} from '../utils/output.js';
import { TestResultsFormatter } from '../formatters/testResultsFormatter.js';

export class DeleteResultFormatter extends TestResultsFormatter implements Formatter<DeleteSourceJson> {
Expand Down Expand Up @@ -43,7 +48,7 @@ export class DeleteResultFormatter extends TestResultsFormatter implements Forma

public display(): void {
this.displayTestResults();
if ([0, 69].includes(process.exitCode ?? 0)) {
if ([0, 69].includes(exitCodeAsNumber() ?? 0)) {
const successes: FileResponseSuccess[] = [];
const fileResponseSuccesses: Map<string, FileResponse> = new Map<string, FileResponse>();

Expand Down
3 changes: 2 additions & 1 deletion src/formatters/sourceConvertResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ux } from '@oclif/core';
import { ConvertResult } from '@salesforce/source-deploy-retrieve';
import { SfError, Messages } from '@salesforce/core';
import { ConvertResultJson, Formatter } from '../utils/types.js';
import { exitCodeAsNumber } from '../utils/output.js';

Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
export const convertMessages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'convert.source');
Expand All @@ -27,7 +28,7 @@ export class SourceConvertResultFormatter implements Formatter<ConvertResultJson
}

public display(): void {
if ([0, 69].includes(process.exitCode ?? 0)) {
if ([0, 69].includes(exitCodeAsNumber() ?? 0)) {
ux.log(convertMessages.getMessage('success', [this.result.packagePath]));
} else {
throw new SfError(convertMessages.getMessage('convertFailed'), 'ConvertFailed');
Expand Down
9 changes: 9 additions & 0 deletions src/utils/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ export const fileResponseSortFn = (i: FileResponse, j: FileResponse): number =>
return i.type > j.type ? 1 : -1;
};

export const exitCodeAsNumber = (): number | undefined => {
try {
return typeof process.exitCode === 'string' ? parseInt(process.exitCode, 10) : process.exitCode;
} catch {
// it *could* be a string that fails to parse to int?
return undefined;
}
};

/** oclif table doesn't like "interface" but likes "type". SDR exports an interface */
export const getFileResponseSuccessProps = (
s: FileResponseSuccess
Expand Down
178 changes: 13 additions & 165 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -606,22 +606,14 @@
"@smithy/types" "^2.12.0"
tslib "^2.6.2"

"@aws-sdk/[email protected]":
"@aws-sdk/[email protected]", "@aws-sdk/types@^3.222.0":
version "3.567.0"
resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.567.0.tgz#b2dc88e154140b1ff87e94f63c97447bdb1c1738"
integrity sha512-JBznu45cdgQb8+T/Zab7WpBmfEAh77gsk99xuF4biIb2Sw1mdseONdoGDjEJX57a25TzIv/WUJ2oABWumckz1A==
dependencies:
"@smithy/types" "^2.12.0"
tslib "^2.6.2"

"@aws-sdk/types@^3.222.0":
version "3.535.0"
resolved "https://registry.yarnpkg.com/@aws-sdk/types/-/types-3.535.0.tgz#5e6479f31299dd9df170e63f4d10fe739008cf04"
integrity sha512-aY4MYfduNj+sRR37U7XxYR8wemfbKP6lx00ze2M2uubn7mZotuVrWYAafbMSXrdEMSToE5JDhr28vArSOoLcSg==
dependencies:
"@smithy/types" "^2.12.0"
tslib "^2.6.2"

"@aws-sdk/[email protected]":
version "3.568.0"
resolved "https://registry.yarnpkg.com/@aws-sdk/util-arn-parser/-/util-arn-parser-3.568.0.tgz#6a19a8c6bbaa520b6be1c278b2b8c17875b91527"
Expand Down Expand Up @@ -1185,12 +1177,7 @@
ansi-escapes "^4.3.2"
chalk "^4.1.2"

"@inquirer/type@^1.1.6":
version "1.2.1"
resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-1.2.1.tgz#fbc7ab3a2e5050d0c150642d5e8f5e88faa066b8"
integrity sha512-xwMfkPAxeo8Ji/IxfUSqzRi0/+F2GIqJmpc5/thelgMGsjNZcjDDRBO9TLXT1s/hdx/mK5QbVIvgoLIFgXhTMQ==

"@inquirer/type@^1.3.1":
"@inquirer/type@^1.1.6", "@inquirer/type@^1.3.1":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-1.3.1.tgz#afb95ff78f44fff7e8a00e17d5820db6add2a076"
integrity sha512-Pe3PFccjPVJV1vtlfVvm9OnlbxqdnP5QcscFEFEnK5quChf1ufZtM0r8mR5ToWHMxZOh0s8o/qp9ANGRTo/DAw==
Expand Down Expand Up @@ -1273,27 +1260,7 @@
"@jridgewell/resolve-uri" "3.1.0"
"@jridgewell/sourcemap-codec" "1.4.14"

"@jsforce/jsforce-node@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@jsforce/jsforce-node/-/jsforce-node-3.1.0.tgz#7f1b4ba60c0c84b870af8e43d713907b10ed8152"
integrity sha512-xsn6Qj36YyhG7uCL9DOswZhqN/OVIpXm5s8AWD7V9hSJfp5ReebEsjT7a52ztEMmkUAYjWvZC5alBJr7jJCJig==
dependencies:
"@sindresorhus/is" "^4"
"@types/node" "^18.15.3"
abort-controller "^3.0.0"
base64url "^3.0.1"
csv-parse "^5.5.2"
csv-stringify "^6.4.4"
faye "^1.4.0"
form-data "^4.0.0"
fs-extra "^8.1.0"
https-proxy-agent "^5.0.0"
multistream "^3.1.0"
node-fetch "^2.6.1"
strip-ansi "^6.0.0"
xml2js "^0.6.2"

"@jsforce/jsforce-node@^3.2.0":
"@jsforce/jsforce-node@^3.1.0", "@jsforce/jsforce-node@^3.2.0":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@jsforce/jsforce-node/-/jsforce-node-3.2.0.tgz#4b104613fc9bb74e0e38d2c00936ea2b228ba73a"
integrity sha512-3GjWNgWs0HFajVhIhwvBPb0B45o500wTBNEBYxy8XjeeRra+qw8A9xUrfVU7TAGev8kXuKhjJwaTiSzThpEnew==
Expand Down Expand Up @@ -1432,23 +1399,7 @@
istanbul-lib-report "^3.0.1"
istanbul-reports "^3.1.6"

"@salesforce/cli-plugins-testkit@^5.3.1":
version "5.3.1"
resolved "https://registry.yarnpkg.com/@salesforce/cli-plugins-testkit/-/cli-plugins-testkit-5.3.1.tgz#6ff1d6a7d1923e7905a2ddd67905458e8f5bcb6d"
integrity sha512-UBTFfG0pxcqMSJjdf7xpRhv5TCC3cf3/CDijjWXzYH/JGryeb0XWZIRKoT8kXzXgEDW2s4O/dNdVvMGnZEN3Aw==
dependencies:
"@salesforce/core" "^7.3.1"
"@salesforce/kit" "^3.1.1"
"@salesforce/ts-types" "^2.0.9"
"@types/shelljs" "^0.8.15"
debug "^4.3.1"
jszip "^3.10.1"
shelljs "^0.8.4"
sinon "^17.0.1"
strip-ansi "6.0.1"
ts-retry-promise "^0.8.0"

"@salesforce/cli-plugins-testkit@^5.3.2":
"@salesforce/cli-plugins-testkit@^5.3.1", "@salesforce/cli-plugins-testkit@^5.3.2":
version "5.3.2"
resolved "https://registry.yarnpkg.com/@salesforce/cli-plugins-testkit/-/cli-plugins-testkit-5.3.2.tgz#39b12513baf230cbfa2a831d1e1ad567512dcb18"
integrity sha512-/0ZR9PrRpmbtYzkGee7Sc8b1qzNyojq1Smk0RY7gM439rDKS90Tqq8W3b9hNXtTzHNe98MxQUGq819mCxok+Mw==
Expand All @@ -1464,30 +1415,7 @@
strip-ansi "6.0.1"
ts-retry-promise "^0.8.0"

"@salesforce/core@^7.2.0", "@salesforce/core@^7.3.0", "@salesforce/core@^7.3.1":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.1.tgz#cda324f7a5ff1be6d7381943b15b23dbe3cd5dec"
integrity sha512-jdc0GOUlV4xvyF9dPbBKNPDvQc06uj5YHFEHvdhCAFtCvqgtubpDzlyDppac2kdKujh4c7UH2KreboNvJ3LsoQ==
dependencies:
"@jsforce/jsforce-node" "^3.1.0"
"@salesforce/kit" "^3.1.1"
"@salesforce/schemas" "^1.7.0"
"@salesforce/ts-types" "^2.0.9"
ajv "^8.12.0"
change-case "^4.1.2"
faye "^1.4.0"
form-data "^4.0.0"
js2xmlparser "^4.0.1"
jsonwebtoken "9.0.2"
jszip "3.10.1"
pino "^8.19.0"
pino-abstract-transport "^1.1.0"
pino-pretty "^10.3.1"
proper-lockfile "^4.1.2"
semver "^7.6.0"
ts-retry-promise "^0.7.1"

"@salesforce/core@^7.3.3", "@salesforce/core@^7.3.4", "@salesforce/core@^7.3.5":
"@salesforce/core@^7.2.0", "@salesforce/core@^7.3.0", "@salesforce/core@^7.3.1", "@salesforce/core@^7.3.3", "@salesforce/core@^7.3.4", "@salesforce/core@^7.3.5":
version "7.3.5"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-7.3.5.tgz#0dccb4d8ddd36cde449d67a482dfb52e63de1c9f"
integrity sha512-9hkK4EyV1Z7T1mDyb/Rj1dO0Owp3f2PNGXSyQhCG2nozSCxAQlPeFFqn2L3d7kJJxdhlr58P4QXiFCoJVVvbLQ==
Expand Down Expand Up @@ -1596,20 +1524,7 @@
resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.7.0.tgz#b7e0af3ee414ae7160bce351c0184d77ccb98fe3"
integrity sha512-Z0PiCEV55khm0PG+DsnRYCjaDmacNe3HDmsoSm/CSyYvJJm+D5vvkHKN9/PKD/gaRe8XAU836yfamIYFblLINw==

"@salesforce/sf-plugins-core@^9.0.5":
version "9.0.5"
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-9.0.5.tgz#34732af855a6b3205e89765a446ea01024cad227"
integrity sha512-il3/mKhmoDMbTdlX5G2YJw3LaJd1D3FlsPEr4gg8sXK1/gxRz0SCqcaXsjWa4Fo6i12zkW8Qgsd5vQ3N6ojiXA==
dependencies:
"@inquirer/confirm" "^2.0.17"
"@inquirer/password" "^1.1.16"
"@oclif/core" "^3.26.2"
"@salesforce/core" "^7.3.0"
"@salesforce/kit" "^3.1.0"
"@salesforce/ts-types" "^2.0.9"
chalk "^5.3.0"

"@salesforce/sf-plugins-core@^9.0.7":
"@salesforce/sf-plugins-core@^9.0.5", "@salesforce/sf-plugins-core@^9.0.7":
version "9.0.7"
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-9.0.7.tgz#77ffc67df994e0cec205827462811f521e3086ba"
integrity sha512-5F6/ax7welNZrizpl9QSQmGADqlCzFDB8t8I5P/n2LplMb3CwJRrZPcOZxJNnhlfXNlLrYtoShv2C+yrxgqYUA==
Expand All @@ -1622,25 +1537,7 @@
"@salesforce/ts-types" "^2.0.9"
chalk "^5.3.0"

"@salesforce/source-deploy-retrieve@^11.0.1":
version "11.3.0"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-11.3.0.tgz#7487734f115fe8c92c432955b58116abc646c400"
integrity sha512-NsiDL1i+CWXcCOGYtQtggrtJuFIr5zHdoyn5atcgFuHk2X9H7Czf3kletpvZh0D2T0CHy6Q9ktf+Vv/UjFmxPw==
dependencies:
"@salesforce/core" "^7.3.1"
"@salesforce/kit" "^3.1.1"
"@salesforce/ts-types" "^2.0.9"
fast-levenshtein "^3.0.0"
fast-xml-parser "^4.3.6"
got "^11.8.6"
graceful-fs "^4.2.11"
ignore "^5.3.1"
jszip "^3.10.1"
mime "2.6.0"
minimatch "^5.1.6"
proxy-agent "^6.4.0"

"@salesforce/source-deploy-retrieve@^11.3.0", "@salesforce/source-deploy-retrieve@^11.4.0":
"@salesforce/source-deploy-retrieve@^11.0.1", "@salesforce/source-deploy-retrieve@^11.3.0", "@salesforce/source-deploy-retrieve@^11.4.0":
version "11.4.0"
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-11.4.0.tgz#b174f168d41ec3a15a3454732da09e8d7672a576"
integrity sha512-9r6eb2N1i3n1Sr4SWzDje8a8blD3k49kMSRLX1rPTpEtmcvFTs76JlVn1IJeIyK3hXtvNyb6UA/6+EClsr853A==
Expand Down Expand Up @@ -2426,10 +2323,10 @@
dependencies:
"@types/node" "*"

"@types/node@*", "@types/node@^20.10.7":
version "20.12.5"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.5.tgz#74c4f31ab17955d0b5808cdc8fd2839526ad00b3"
integrity sha512-BD+BjQ9LS/D8ST9p5uqBxghlN+S42iuNxjsUGjeZobe/ciXzk2qb1B6IXc6AnRLS+yFJRpN2IPEHMzwspfDJNw==
"@types/node@*", "@types/node@^20.10.7", "@types/node@^20.12.7":
version "20.12.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.7.tgz#04080362fa3dd6c5822061aa3124f5c152cff384"
integrity sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==
dependencies:
undici-types "~5.26.4"

Expand All @@ -2440,13 +2337,6 @@
dependencies:
undici-types "~5.26.4"

"@types/node@^20.12.7":
version "20.12.7"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.7.tgz#04080362fa3dd6c5822061aa3124f5c152cff384"
integrity sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==
dependencies:
undici-types "~5.26.4"

"@types/normalize-package-data@^2.4.0":
version "2.4.1"
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301"
Expand Down Expand Up @@ -2642,17 +2532,7 @@ ajv@^6.12.4:
json-schema-traverse "^0.4.1"
uri-js "^4.2.2"

ajv@^8.11.0, ajv@^8.12.0:
version "8.12.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.12.0.tgz#d1a0527323e22f53562c567c00991577dfbe19d1"
integrity sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==
dependencies:
fast-deep-equal "^3.1.1"
json-schema-traverse "^1.0.0"
require-from-string "^2.0.2"
uri-js "^4.2.2"

ajv@^8.13.0:
ajv@^8.11.0, ajv@^8.13.0:
version "8.13.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.13.0.tgz#a3939eaec9fb80d217ddf0c3376948c023f28c91"
integrity sha512-PRA911Blj99jR5RMeTunVbNXMF6Lp4vZXnk5GQjcnUWUTsrXtekg/pnmFFI2u/I36Y/2bITGS30GZCXei6uNkA==
Expand Down Expand Up @@ -6453,15 +6333,7 @@ pify@^4.0.1:
resolved "https://registry.yarnpkg.com/pify/-/pify-4.0.1.tgz#4b2cd25c50d598735c50292224fd8c6df41e3231"
integrity sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==

pino-abstract-transport@^1.0.0, pino-abstract-transport@^1.1.0, [email protected]:
version "1.1.0"
resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-1.1.0.tgz#083d98f966262164504afb989bccd05f665937a8"
integrity sha512-lsleG3/2a/JIWUtf9Q5gUNErBqwIu1tUKTT3dUzaf5DySw9ra1wcqKjJjLX1VTY64Wk1eEOYsVGSaGfCK85ekA==
dependencies:
readable-stream "^4.0.0"
split2 "^4.0.0"

pino-abstract-transport@^1.2.0:
pino-abstract-transport@^1.0.0, pino-abstract-transport@^1.1.0, pino-abstract-transport@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-1.2.0.tgz#97f9f2631931e242da531b5c66d3079c12c9d1b5"
integrity sha512-Guhh8EZfPCfH+PMXAb6rKOjGQEoy0xlAIn+irODG5kgfYV+BQ0rGYYWTIel3P5mmyXqkYkPmdIkywsn6QKUR1Q==
Expand Down Expand Up @@ -6494,23 +6366,6 @@ pino-std-serializers@^6.0.0:
resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-6.2.2.tgz#d9a9b5f2b9a402486a5fc4db0a737570a860aab3"
integrity sha512-cHjPPsE+vhj/tnhCy/wiMh3M3z3h/j15zHQX+S9GkTBgqJuTuJzYJ4gUyACLhDaJ7kk9ba9iRDmbH2tJU03OiA==

pino@^8.19.0:
version "8.19.0"
resolved "https://registry.yarnpkg.com/pino/-/pino-8.19.0.tgz#ccc15ef736f103ec02cfbead0912bc436dc92ce4"
integrity sha512-oswmokxkav9bADfJ2ifrvfHUwad6MLp73Uat0IkQWY3iAw5xTRoznXbXksZs8oaOUMpmhVWD+PZogNzllWpJaA==
dependencies:
atomic-sleep "^1.0.0"
fast-redact "^3.1.1"
on-exit-leak-free "^2.1.0"
pino-abstract-transport v1.1.0
pino-std-serializers "^6.0.0"
process-warning "^3.0.0"
quick-format-unescaped "^4.0.3"
real-require "^0.2.0"
safe-stable-stringify "^2.3.1"
sonic-boom "^3.7.0"
thread-stream "^2.0.0"

pino@^8.21.0:
version "8.21.0"
resolved "https://registry.yarnpkg.com/pino/-/pino-8.21.0.tgz#e1207f3675a2722940d62da79a7a55a98409f00d"
Expand Down Expand Up @@ -7461,13 +7316,6 @@ text-table@^0.2.0:
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==

thread-stream@^2.0.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-2.3.0.tgz#4fc07fb39eff32ae7bad803cb7dd9598349fed33"
integrity sha512-kaDqm1DET9pp3NXwR8382WHbnpXnRkN9xGN9dQt3B2+dmXiW8X1SOwmFOxAErEQ47ObhZ96J6yhZNXuyCOL7KA==
dependencies:
real-require "^0.2.0"

thread-stream@^2.6.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-2.7.0.tgz#d8a8e1b3fd538a6cca8ce69dbe5d3d097b601e11"
Expand Down

0 comments on commit 19d9aaf

Please sign in to comment.