Skip to content

Commit

Permalink
feat: update sf-plugins-core and oclif/core (#272)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley authored Jan 30, 2023
1 parent d06cb9d commit fce59ce
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 72 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^1.23.2",
"@oclif/core": "^2.0.7",
"@octokit/rest": "^19.0.5",
"@salesforce/core": "^3.32.12",
"@salesforce/kit": "^1.8.2",
"@salesforce/sf-plugins-core": "^1.21.7",
"@salesforce/sf-plugins-core": "^2.0.1",
"change-case": "^4.1.2",
"fast-glob": "^3.2.12",
"got": "^11.8.5",
Expand All @@ -25,7 +25,7 @@
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^3.3.0",
"@oclif/test": "^2.2.20",
"@oclif/test": "^2.3.4",
"@salesforce/cli-plugins-testkit": "^3.2.17",
"@salesforce/dev-config": "^3.1.0",
"@salesforce/dev-scripts": "^3.1.0",
Expand Down Expand Up @@ -56,7 +56,7 @@
"lint-staged": "^11.2.6",
"mocha": "^9.1.3",
"nyc": "^15.1.0",
"oclif": "^3.4.2",
"oclif": "^3.6.1",
"prettier": "^2.8.2",
"pretty-quick": "^3.1.3",
"shx": "^0.3.3",
Expand Down Expand Up @@ -137,4 +137,4 @@
"publishConfig": {
"access": "public"
}
}
}
6 changes: 3 additions & 3 deletions src/commands/dev/configure/secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* eslint-disable camelcase */

import * as fs from 'fs';
import { CliUx } from '@oclif/core';
import { ux } from '@oclif/core';

import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
Expand Down Expand Up @@ -179,7 +179,7 @@ const secretCheck = async (
} catch (e) {
const typedError = e as OctokitError;
if (typedError.response.data) {
CliUx.ux.log(`check repo secrets for ${secretName}: ${typedError.response.data.message}`);
ux.log(`check repo secrets for ${secretName}: ${typedError.response.data.message}`);
}
// secret doesn't exist locally, keep looking.
}
Expand Down Expand Up @@ -212,7 +212,7 @@ const secretCheck = async (
const typedError = e as OctokitError;

if (typedError.response.data) {
CliUx.ux.log(`check org secrets for ${secretName}: ${typedError.response.data.message}`);
ux.log(`check org secrets for ${secretName}: ${typedError.response.data.message}`);
}
return 'does not exist in org';
}
Expand Down
5 changes: 3 additions & 2 deletions src/commands/dev/generate/flag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
import { Duration } from '@salesforce/kit';

import { Config, Interfaces, toStandardizedId } from '@oclif/core';
// eslint-disable-next-line sf-plugin/no-oclif-flags-command-import
import { Config, Command, toStandardizedId } from '@oclif/core';
import * as fg from 'fast-glob';
import { fileExists, FlagBuilder } from '../../../util';
import { FlagAnswers } from '../../../types';
Expand Down Expand Up @@ -299,7 +300,7 @@ export default class DevGenerateFlag extends SfCommand<void> {
]);
}

private async loadExistingFlags(commandId: string): Promise<Record<string, Interfaces.Command.Flag>> {
private async loadExistingFlags(commandId: string): Promise<Record<string, Command.Flag.Any>> {
const config = new Config({ root: process.cwd() });
config.root = config.options.root;
await config.load();
Expand Down
15 changes: 7 additions & 8 deletions src/commands/dev/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { Hook as OclifHook } from '@oclif/core';
import { Args, Hook as OclifHook } from '@oclif/core';
import { Messages } from '@salesforce/core';
import { SfCommand, SfHook, Flags } from '@salesforce/sf-plugins-core';
import { AnyJson } from '@salesforce/ts-types';
Expand Down Expand Up @@ -33,22 +33,21 @@ export default class Hook extends SfCommand<OclifHook.Result<unknown>> {
}),
};

public static args = [
{
name: 'hook',
public static args = {
hook: Args.string({
description: 'Name of hook to execute.',
required: true,
},
];
}),
};

public async run(): Promise<OclifHook.Result<unknown>> {
const { args, flags } = await this.parse(Hook);
if (flags.plugin) {
// if a plugin is specified, delete the hook in all the other plugins so that
// it doesn't run in those.
this.config.plugins.forEach((plugin) => {
if ((plugin?.hooks ?? {})[args.hook as string]) {
if (plugin.name !== flags.plugin) delete plugin.hooks[args.hook as string];
if ((plugin?.hooks ?? {})[args.hook]) {
if (plugin.name !== flags.plugin) delete plugin.hooks[args.hook];
}
});
}
Expand Down
1 change: 0 additions & 1 deletion src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export class FlagBuilder {
flagOptions.push(`default: ${this.answers.integerDefault}`);
if (this.answers.integerDefault && this.answers.multiple)
flagOptions.push(`default: [${this.answers.integerDefault}]`);
if (this.answers.type === 'enum') flagOptions.push('options: []');

const flagName = this.answers.name.includes('-') ? `'${this.answers.name}'` : this.answers.name;
const newFlag = [
Expand Down
31 changes: 0 additions & 31 deletions test/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,37 +369,6 @@ describe('FlagBuilder', () => {
});
});

describe('enum', () => {
it('should build a flag with all the options', async () => {
const answers: FlagAnswers = {
type: 'enum',
name: 'my-flag',
summary: 'Summary of flag.',
char: 's',
required: true,
multiple: true,
};

sandbox.stub(FlagBuilder.prototype, 'readFile').resolves(templateCommand);
const flagBuilder = new FlagBuilder(answers, 'test.ts');
const flag = flagBuilder.build();

expect(flag).to.deep.equal([
" 'my-flag': Flags.enum({",
" summary: messages.getMessage('flags.my-flag.summary'),",
" char: 's',",
' required: true,',
' multiple: true,',
' options: [],',
' }),',
]);

const updatedFile = await flagBuilder.apply(flag);
expect(updatedFile).to.include("'flags.my-flag.summary',");
expect(updatedFile).to.include("'my-flag': Flags.enum({");
});
});

describe('integer', () => {
it('should build a flag with all the options', async () => {
const answers: FlagAnswers = {
Expand Down
128 changes: 106 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@
is-wsl "^2.1.1"
tslib "^2.3.1"

"@oclif/core@^1.20.3", "@oclif/core@^1.20.4", "@oclif/core@^1.21.0", "@oclif/core@^1.23.1", "@oclif/core@^1.23.2":
"@oclif/core@^1.20.3", "@oclif/core@^1.20.4", "@oclif/core@^1.21.0", "@oclif/core@^1.23.1":
version "1.23.2"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.23.2.tgz#6779f412d787ddc885b507cb00927dae71b641da"
integrity sha512-NdaOaUDTRc6g1yTkOAKiEVOiQhc5CNcWNXa0QF4IS4yTjNqp4DOzgtF9Dwe585nPEKzSbTBiz1wyLOa4qIHSRQ==
Expand Down Expand Up @@ -767,6 +767,40 @@
wordwrap "^1.0.0"
wrap-ansi "^7.0.0"

"@oclif/core@^2.0.3", "@oclif/core@^2.0.7":
version "2.0.7"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.0.7.tgz#a17a85dfa105dda120fbc5647432010feaa97a9e"
integrity sha512-pj7hIH8SBeH3qha47fmyqdaBdNVEqesRgnKFh8Ytdb4S41/4BYOiQuyQGuvnKgvicH6DMxp4FbM9EQEW46V9xw==
dependencies:
"@types/cli-progress" "^3.11.0"
ansi-escapes "^4.3.2"
ansi-styles "^4.3.0"
cardinal "^2.1.1"
chalk "^4.1.2"
clean-stack "^3.0.1"
cli-progress "^3.10.0"
debug "^4.3.4"
ejs "^3.1.6"
fs-extra "^9.1.0"
get-package-type "^0.1.0"
globby "^11.1.0"
hyperlinker "^1.0.0"
indent-string "^4.0.0"
is-wsl "^2.2.0"
js-yaml "^3.14.1"
natural-orderby "^2.0.3"
object-treeify "^1.1.33"
password-prompt "^1.1.2"
semver "^7.3.7"
string-width "^4.2.3"
strip-ansi "^6.0.1"
supports-color "^8.1.1"
supports-hyperlinks "^2.2.0"
tslib "^2.4.1"
widest-line "^3.1.0"
wordwrap "^1.0.0"
wrap-ansi "^7.0.0"

"@oclif/dev-cli@^1":
version "1.26.10"
resolved "https://registry.yarnpkg.com/@oclif/dev-cli/-/dev-cli-1.26.10.tgz#d8df3a79009b68552f5e7f249d1d19ca52278382"
Expand Down Expand Up @@ -897,13 +931,13 @@
resolved "https://registry.yarnpkg.com/@oclif/screen/-/screen-3.0.4.tgz#663db0ecaf23f3184e7f01886ed578060e4a7f1c"
integrity sha512-IMsTN1dXEXaOSre27j/ywGbBjrzx0FNd1XmuhCWCB9NTPrhWI1Ifbz+YLSEcstfQfocYsrbrIessxXb2oon4lA==

"@oclif/test@^2.2.20":
version "2.2.20"
resolved "https://registry.yarnpkg.com/@oclif/test/-/test-2.2.20.tgz#c5c76f9ab3eeb6df3c1af81a95428c95fb0065e9"
integrity sha512-SaSMgeB9DKcfRRIvh461eK1eEkjgV/iYHWU5XhWli8psAnqKFgxar3ESpMfQKwYjVMxKdKSjOhEFHaHMOgPJOQ==
"@oclif/test@^2.3.4":
version "2.3.4"
resolved "https://registry.yarnpkg.com/@oclif/test/-/test-2.3.4.tgz#eddeda4e13a5665c9fd65e06f34cd2faca14caee"
integrity sha512-sIuDKKw108NQxPbo+j/TY6HBe1j2tbtjEOJ9aHpU7U+hwsTL3/zyU1YZgiGekdQ/OA0PULz3VLafSs+IioWHmw==
dependencies:
"@oclif/core" "^1.23.1"
fancy-test "^2.0.11"
"@oclif/core" "^2.0.7"
fancy-test "^2.0.12"

"@octokit/auth-token@^2.4.4":
version "2.5.0"
Expand Down Expand Up @@ -1164,6 +1198,29 @@
jsonwebtoken "9.0.0"
ts-retry-promise "^0.7.0"

"@salesforce/core@^3.33.1":
version "3.33.1"
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.33.1.tgz#3dd0a44ba22763e8e0c2c97df03393e5c2c845d9"
integrity sha512-jaed8rK+NhSxB6MjYUN8f/2VkvtbFN/Ce/l6JvgFE+cvOf2g+lPv1pSsnKKlaSiiYcXkOvIRDT9d9ns1RLJzUw==
dependencies:
"@salesforce/bunyan" "^2.0.0"
"@salesforce/kit" "^1.8.0"
"@salesforce/schemas" "^1.4.0"
"@salesforce/ts-types" "^1.7.2"
"@types/graceful-fs" "^4.1.5"
"@types/semver" "^7.3.13"
ajv "^8.11.2"
archiver "^5.3.0"
change-case "^4.1.2"
debug "^3.2.7"
faye "^1.4.0"
form-data "^4.0.0"
graceful-fs "^4.2.9"
js2xmlparser "^4.0.1"
jsforce "^2.0.0-beta.19"
jsonwebtoken "9.0.0"
ts-retry-promise "^0.7.0"

"@salesforce/dev-config@^3.0.0", "@salesforce/dev-config@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@salesforce/dev-config/-/dev-config-3.1.0.tgz#8eb5b35860ff60d1c1dc3fd9329b01a28475d5b9"
Expand Down Expand Up @@ -1217,6 +1274,15 @@
shx "^0.3.3"
tslib "^2.2.0"

"@salesforce/kit@^1.8.3":
version "1.8.4"
resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-1.8.4.tgz#19918938d5f89ecb4e78a363b38605a529bcd7d4"
integrity sha512-H2KWT2soWEDf+QbcMLYBNt2iHEEDIihxoWufphu8FGySiAibEZcl2SPZJ87nbUW/Yu+dLqPEKTUZxvDEx7t3UQ==
dependencies:
"@salesforce/ts-types" "^1.7.2"
shx "^0.3.3"
tslib "^2.5.0"

"@salesforce/plugin-command-reference@^2.2.9":
version "2.2.9"
resolved "https://registry.yarnpkg.com/@salesforce/plugin-command-reference/-/plugin-command-reference-2.2.9.tgz#0d56e2acff6486db86312fd4982b0a8a0161d291"
Expand Down Expand Up @@ -1244,7 +1310,7 @@
resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.4.0.tgz#7dff427c8059895d8108176047aee600703c82d6"
integrity sha512-BJ25uphssN42Zy6kksheFHMTLiR98AAHe/Wxnv0T4dYxtrEbUjSXVAGKZqfewJPFXA4xB5gxC+rQZtfz6xKCFg==

"@salesforce/sf-plugins-core@^1.21.5", "@salesforce/sf-plugins-core@^1.21.7":
"@salesforce/sf-plugins-core@^1.21.5":
version "1.22.1"
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-1.22.1.tgz#58c445aa8c72ae7ddd6ec39269ae1d944d059e9b"
integrity sha512-UAAi7I753+t9zVJDHMzk81XCsYU5q2kq7aSgFbokdvnnPx45i3NptyaKNCRDeOBxp3eYCuNG6iFZ+xzC+v8cfA==
Expand All @@ -1256,6 +1322,18 @@
chalk "^4"
inquirer "^8.2.5"

"@salesforce/sf-plugins-core@^2.0.1":
version "2.0.1"
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-2.0.1.tgz#079d6cc200ea53ce7fb60aafb5eaf5f2b48e46c9"
integrity sha512-vT4Y9n/4lStSWrfMAlgQB/XzwJAYK6ibcsFykHNCl86NCoebVGzg5KDIxYjHpidrt2PG/nPk7NL9iBtTH/p8Yg==
dependencies:
"@oclif/core" "^2.0.7"
"@salesforce/core" "^3.33.1"
"@salesforce/kit" "^1.8.3"
"@salesforce/ts-types" "^1.7.1"
chalk "^4"
inquirer "^8.2.5"

"@salesforce/ts-sinon@1.4.4":
version "1.4.4"
resolved "https://registry.yarnpkg.com/@salesforce/ts-sinon/-/ts-sinon-1.4.4.tgz#ee7039f7eb6c488d58b0a3365e7196e9b1b1ebb4"
Expand Down Expand Up @@ -3714,18 +3792,18 @@ extract-stack@^2.0.0:
resolved "https://registry.yarnpkg.com/extract-stack/-/extract-stack-2.0.0.tgz#11367bc865bfcd9bc0db3123e5edb57786f11f9b"
integrity sha512-AEo4zm+TenK7zQorGK1f9mJ8L14hnTDi2ZQPR+Mub1NX8zimka1mXpV5LpH8x9HoUmFSHZCfLHqWvp0Y4FxxzQ==

fancy-test@^2.0.11:
version "2.0.11"
resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-2.0.11.tgz#27eb9fd5076114c609bd5ee6f5b9c8bd8ec67689"
integrity sha512-R98gMuHy/tsGUmChkehXvq4PmzdhUKl1SDyYkrvh4Vhc+8fjUUQWu2pts4Y4BStjkltPtQtccNYN63sjs/a3Xw==
fancy-test@^2.0.12:
version "2.0.12"
resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-2.0.12.tgz#a93cd92ffc23f70b069c39f19940d34f64c6ca67"
integrity sha512-S7qVQNaViLTMzn71huZvrUCV59ldq+enQ1EQOkdNbl4q4Om97gwqbYKvZoglsnzCWRRFaFP+qHynpdqaLdiZqg==
dependencies:
"@types/chai" "*"
"@types/lodash" "*"
"@types/node" "*"
"@types/sinon" "*"
lodash "^4.17.13"
mock-stdin "^1.0.0"
nock "^13.0.0"
nock "^13.3.0"
stdout-stderr "^0.1.9"

fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
Expand Down Expand Up @@ -5943,10 +6021,10 @@ no-case@^3.0.4:
lower-case "^2.0.2"
tslib "^2.0.3"

nock@^13.0.0:
version "13.2.9"
resolved "https://registry.yarnpkg.com/nock/-/nock-13.2.9.tgz#4faf6c28175d36044da4cfa68e33e5a15086ad4c"
integrity sha512-1+XfJNYF1cjGB+TKMWi29eZ0b82QOvQs2YoLNzbpWGqFMtRQHTa57osqdGj4FrFPgkO4D4AZinzUJR9VvW3QUA==
nock@^13.3.0:
version "13.3.0"
resolved "https://registry.yarnpkg.com/nock/-/nock-13.3.0.tgz#b13069c1a03f1ad63120f994b04bfd2556925768"
integrity sha512-HHqYQ6mBeiMc+N038w8LkMpDCRquCHWeNmN3v6645P3NhN2+qXOBqvPqo7Rt1VyCMzKhJ733wZqw5B7cQVFNPg==
dependencies:
debug "^4.1.0"
json-stringify-safe "^5.0.1"
Expand Down Expand Up @@ -6201,12 +6279,12 @@ obliterator@^2.0.2:
resolved "https://registry.yarnpkg.com/obliterator/-/obliterator-2.0.4.tgz#fa650e019b2d075d745e44f1effeb13a2adbe816"
integrity sha512-lgHwxlxV1qIg1Eap7LgIeoBWIMFibOjbrYPIPJZcI1mmGAI2m3lNYpK12Y+GBdPQ0U1hRwSord7GIaawz962qQ==

oclif@^3.4.2:
version "3.4.2"
resolved "https://registry.yarnpkg.com/oclif/-/oclif-3.4.2.tgz#718d6a52107bdab0ca861cd63acdf73eb049a2bc"
integrity sha512-YF7zqHCEWiRvfuXkqyPuQsC4PiEJuXLQWIMXOtdJgOnIKqBh9Sp3e4xFsSal9QheVsCwO5kM3Nhe+G430hk/mA==
oclif@^3.6.1:
version "3.6.1"
resolved "https://registry.yarnpkg.com/oclif/-/oclif-3.6.1.tgz#157ac35f1e634af745879a55c3fa39bf724a5e69"
integrity sha512-zedbQqxAzC8WlH/T2D/CbGCTWIXHMV7wGs2av+M3KPG4SfB9/lwn1zXGjft/3NNy3X6KCEoGCYWqYYMZOf2Fgg==
dependencies:
"@oclif/core" "^1.20.4"
"@oclif/core" "^2.0.3"
"@oclif/plugin-help" "^5.1.19"
"@oclif/plugin-not-found" "^2.3.7"
"@oclif/plugin-warn-if-update-available" "^2.0.14"
Expand All @@ -6220,6 +6298,7 @@ oclif@^3.4.2:
lodash "^4.17.21"
normalize-package-data "^3.0.3"
semver "^7.3.8"
shelljs "^0.8.5"
tslib "^2.3.1"
yeoman-environment "^3.11.1"
yeoman-generator "^5.6.1"
Expand Down Expand Up @@ -7775,6 +7854,11 @@ tslib@^2, tslib@^2.0.0, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.2.0, tslib@^2.3.1,
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.1.tgz#0d0bfbaac2880b91e22df0768e55be9753a5b17e"
integrity sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==

tslib@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==

tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
Expand Down

0 comments on commit fce59ce

Please sign in to comment.