Skip to content

Commit

Permalink
fix: move sf command to this repo
Browse files Browse the repository at this point in the history
@W-9708749@
  • Loading branch information
peternhale committed Sep 14, 2021
1 parent ab26af0 commit 968f80f
Show file tree
Hide file tree
Showing 4 changed files with 105 additions and 31 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@
}
},
"dependencies": {
"@oclif/core": "^0.5.35",
"@salesforce/core": "^3.6.0",
"@salesforce/kit": "^1.5.8",
"@salesforce/ts-types": "^1.5.13",
"cli-ux": "^5.6.2",
"@oclif/core": "^0.5.36",
"@salesforce/core": "^3.6.1",
"@salesforce/kit": "^1.5.17",
"@salesforce/ts-types": "^1.5.20",
"cli-ux": "^5.6.3",
"inquirer": "^8.1.1"
},
"devDependencies": {
"@salesforce/dev-config": "^2.0.0",
"@salesforce/dev-scripts": "^0.9.15",
"@salesforce/dev-scripts": "^0.9.18",
"@salesforce/prettier-config": "^0.0.1",
"@salesforce/ts-sinon": "^1.2.3",
"@types/inquirer": "^7.3.2",
Expand Down
2 changes: 2 additions & 0 deletions src/exported.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ export { Deauthorizer } from './deauthorizer';
export { Prompter } from './prompter';
export { SfHook } from './hooks';
export * from './types';
export { SfCommand, SfCommandInterface } from './sfCommand';
export { Flags } from '@oclif/core';
62 changes: 62 additions & 0 deletions src/sfCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (c) 2020, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { Command, HelpSection, Interfaces } from '@oclif/core';

export interface SfCommandInterface extends Interfaces.Command {
configurationVariablesSection?: HelpSection;
envVariablesSection?: HelpSection;
errorCodes?: HelpSection;
}

/**
* A base command that provides convenient access to CLI help
* output formatting. Extend this command and set specific properties
* to add help sections to the command's help output.
*
* @extends @oclif/command
* @see https://github.com/oclif/command
*/

export abstract class SfCommand<T> extends Command {
public static configurationVariablesSection?: HelpSection;
public static envVariablesSection?: HelpSection;
public static errorCodes?: HelpSection;

protected toSuccessJson(result: T): SfCommand.Json<T> {
return {
status: process.exitCode ?? 0,
result,
};
}

protected toErrorJson(error: Error): SfCommand.Error {
return {
status: process.exitCode ?? 1,
stack: error.stack,
name: error.name,
message: error.message,
};
}

public abstract run(): Promise<T>;
}

export namespace SfCommand {
export interface Json<T> {
status: number;
result: T;
warnings?: string[];
}

export interface Error {
status: number;
name: string;
message: string;
stack: string | undefined;
warnings?: string[];
}
}
60 changes: 35 additions & 25 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,10 @@
is-wsl "^2.1.1"
tslib "^2.0.0"

"@oclif/core@^0.5.35":
version "0.5.35"
resolved "https://registry.npmjs.org/@oclif/core/-/core-0.5.35.tgz#20d6dd2be4c78449227c2912aa23e4d451d7add5"
integrity sha512-5nTd+lOcDh1QPa9mM74qFChmApp5oHnP3EqYGYwqhfA3ad4qIfyYEn8pKxf0MlrYoPA8j2PrmceuRZThstKssA==
"@oclif/core@^0.5.36":
version "0.5.36"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-0.5.36.tgz#e90c087de12db777ebe22272078138ad0587a786"
integrity sha512-HUUko/BcBjtgVcR6/yLq1nA/uEiNWdMon5/zS3bVRmXoKDnb1/VyQXtfvYhpaiUOgavvrqSGEO+NHCVxQcY6sQ==
dependencies:
"@oclif/linewrap" "^1.0.0"
chalk "^4.1.0"
Expand Down Expand Up @@ -531,10 +531,10 @@
mv "~2"
safe-json-stringify "~1"

"@salesforce/core@^3.6.0":
version "3.6.0"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.6.0.tgz#66041d71dfd44ba10e8f5072eab5ecca80100770"
integrity sha512-VEfxfMAmWNfEBaTFYhIPBbXB/pR7qoNsY8WerWMQgoUQrQaGH7Mu2o1OV1tm7lLmDArS3avdjcgXfk+HilQuqA==
"@salesforce/core@^3.6.1":
version "3.6.1"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.6.1.tgz#2f5fb779036008d08cf2fa213dece1f808d29f4e"
integrity sha512-TIrlx7k3paTi162Wlqkk6Bnu6MEJxUkuW0fKuqPPnc0uuRzXg+apGmL/G7Mk6E/FQEnWY+0TCPnUJwdn5SWoqw==
dependencies:
"@salesforce/bunyan" "^2.0.0"
"@salesforce/kit" "^1.5.8"
Expand All @@ -558,10 +558,10 @@
resolved "https://registry.npmjs.org/@salesforce/dev-config/-/dev-config-2.1.2.tgz#b4e206f860e87065d068bf8ba3994a032389ad81"
integrity sha512-1swy07rynHoTRk8lj6nuC0JceRBo300OuWnovQe2OMvLpQM5Dh1SUnv1SE8012PsrK9BC1WqGXp4BUyMo04x7w==

"@salesforce/dev-scripts@^0.9.15":
version "0.9.15"
resolved "https://registry.npmjs.org/@salesforce/dev-scripts/-/dev-scripts-0.9.15.tgz#91dda26142d5a61e5d0bc7601c62b1a4b3832475"
integrity sha512-uoWzMN/aU1IaRtJ1RjImzh7SxPTXYRhxXLN6QJCDE5G+zkpQ9yfKLqThu4M+j5SbkAMrqAK7drv5LauZi9Vh4A==
"@salesforce/dev-scripts@^0.9.18":
version "0.9.18"
resolved "https://registry.yarnpkg.com/@salesforce/dev-scripts/-/dev-scripts-0.9.18.tgz#a76a7d283980c39813394b1550d0cef20e26857e"
integrity sha512-roIa2A+o6DMvRQeAI7u5UfTZY+fdan1IyJUa+3ishcBG160Nt4hWJS9DZgXmRWY/BAuXXcnzQ7YS6Aaa2Vr73w==
dependencies:
"@commitlint/cli" "^12.1.4"
"@commitlint/config-conventional" "^10.0.0"
Expand All @@ -571,7 +571,7 @@
"@types/chai" "^4.2.11"
"@types/mocha" "^8.2.2"
"@types/node" "^15.6.1"
"@types/sinon" "^9.0.4"
"@types/sinon" "10.0.0"
chai "^4.2.0"
chalk "^4.0.0"
cosmiconfig "^7.0.0"
Expand Down Expand Up @@ -599,6 +599,14 @@
typescript "^4.1.3"
xunit-file "^1.0.0"

"@salesforce/kit@^1.5.17":
version "1.5.17"
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-1.5.17.tgz#4fd9c50ba2e072c50d319654f86f86808c544795"
integrity sha512-Uuh+v7WPSo+L21moVprl+jbDTl3ndmcJM5et/vFLZW4ur6CCJCJSoReM9ttF1qZuQskyCyhVZo6/aMZrVUe+rQ==
dependencies:
"@salesforce/ts-types" "^1.5.20"
tslib "^2.2.0"

"@salesforce/kit@^1.5.8":
version "1.5.14"
resolved "https://registry.npmjs.org/@salesforce/kit/-/kit-1.5.14.tgz#013853ffc53e10e7add2abfa266372b29fda8317"
Expand Down Expand Up @@ -659,6 +667,13 @@
dependencies:
"@sinonjs/commons" "^1.7.0"

"@sinonjs/fake-timers@^7.0.4":
version "7.1.2"
resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-7.1.2.tgz#2524eae70c4910edccf99b2f4e6efc5894aff7b5"
integrity sha512-iQADsW4LBMISqZ6Ci1dupJL9pprqwcVFTcOsEmQOEhW+KLCVn/Y4Jrvg2k19fIHCp+iFprriYPTdRcQR8NbUPg==
dependencies:
"@sinonjs/commons" "^1.7.0"

"@sinonjs/formatio@^2.0.0":
version "2.0.0"
resolved "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-2.0.0.tgz#84db7e9eb5531df18a8c5e0bfb6e449e55e654b2"
Expand Down Expand Up @@ -804,17 +819,12 @@
resolved "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
integrity sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==

"@types/sinon@^9.0.4":
version "9.0.11"
resolved "https://registry.npmjs.org/@types/sinon/-/sinon-9.0.11.tgz#7af202dda5253a847b511c929d8b6dda170562eb"
integrity sha512-PwP4UY33SeeVKodNE37ZlOsR9cReypbMJOhZ7BVE0lB+Hix3efCOxiJWiE5Ia+yL9Cn2Ch72EjFTRze8RZsNtg==
"@types/sinon@10.0.0":
version "10.0.0"
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-10.0.0.tgz#eecc3847af03d45ffe53d55aaaaf6ecb28b5e584"
integrity sha512-jDZ55oCKxqlDmoTBBbBBEx+N8ZraUVhggMZ9T5t+6/Dh8/4NiOjSUfpLrPiEwxQDlAe3wpAkoXhWvE6LibtsMQ==
dependencies:
"@types/sinonjs__fake-timers" "*"

"@types/sinonjs__fake-timers@*":
version "6.0.2"
resolved "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.2.tgz#3a84cf5ec3249439015e14049bd3161419bf9eae"
integrity sha512-dIPoZ3g5gcx9zZEszaxLSVTvMReD3xxyyDnQUjA6IYDG9Ba2AV0otMPs+77sG9ojB4Qr2N2Vk5RnKeuA0X/0bg==
"@sinonjs/fake-timers" "^7.0.4"

"@types/through@*":
version "0.0.30"
Expand Down Expand Up @@ -1429,7 +1439,7 @@ cli-spinners@^2.5.0:
resolved "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.6.0.tgz#36c7dc98fb6a9a76bd6238ec3f77e2425627e939"
integrity sha512-t+4/y50K/+4xcCRosKkA7W4gTr1MySvLV0q+PxmG7FJ5g+66ChKurYjxBCjHggHH3HA5Hh9cy+lcUGWDqVH+4Q==

cli-ux@^5.1.0:
cli-ux@^5.1.0, cli-ux@^5.6.3:
version "5.6.3"
resolved "https://registry.npmjs.org/cli-ux/-/cli-ux-5.6.3.tgz#eecdb2e0261171f2b28f2be6b18c490291c3a287"
integrity sha512-/oDU4v8BiDjX2OKcSunGH0iGDiEtj2rZaGyqNuv9IT4CgcSMyVWAMfn0+rEHaOc4n9ka78B0wo1+N1QX89f7mw==
Expand Down Expand Up @@ -1461,7 +1471,7 @@ cli-ux@^5.1.0:
supports-hyperlinks "^2.1.0"
tslib "^2.0.0"

cli-ux@^5.2.1, cli-ux@^5.6.2:
cli-ux@^5.2.1:
version "5.6.2"
resolved "https://registry.npmjs.org/cli-ux/-/cli-ux-5.6.2.tgz#c78b953b14cdf95b4bb6aae8db0ab6745333405c"
integrity sha512-CuiamOCfPaOTjbuAQXdFsfZLQmO6XSmCDxulq4y8pIets1hZ3eaysHppPKGdrcdgLugUGUap5+bXd3IukJASBA==
Expand Down

0 comments on commit 968f80f

Please sign in to comment.