Skip to content

Commit 963ebfc

Browse files
authored
feat: use latest oclif/core (#566)
1 parent 55d3109 commit 963ebfc

File tree

7 files changed

+34
-19
lines changed

7 files changed

+34
-19
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
"main": "lib/index.js",
77
"bugs": "https://github.com/forcedotcom/cli/issues",
88
"dependencies": {
9-
"@oclif/core": "^1.26.1",
9+
"@oclif/core": "^2.0.7",
1010
"@salesforce/core": "^3.33.1",
1111
"@salesforce/kit": "^1.8.3",
12-
"@salesforce/sf-plugins-core": "^1.22.1",
12+
"@salesforce/sf-plugins-core": "^2.0.1",
1313
"open": "8.4.0",
1414
"tslib": "^2"
1515
},
@@ -223,4 +223,4 @@
223223
"output": []
224224
}
225225
}
226-
}
226+
}

src/commands/force/org/clone.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ export class OrgCloneCommand extends SfCommand<SandboxProcessObject> {
4848
public static readonly flags = {
4949
'target-org': requiredOrgFlagWithDeprecations,
5050
'api-version': orgApiVersionFlagWithDeprecations,
51-
type: Flags.enum({
51+
type: Flags.custom<'sandbox'>({
52+
options: ['sandbox'],
53+
})({
5254
char: 't',
5355
summary: messages.getMessage('flags.type'),
5456
required: true,
55-
options: ['sandbox'],
5657
}),
5758
definitionfile: Flags.file({
5859
char: 'f',
@@ -81,7 +82,7 @@ export class OrgCloneCommand extends SfCommand<SandboxProcessObject> {
8182
public async run(): Promise<SandboxProcessObject> {
8283
const { flags, args, argv } = await this.parse(OrgCloneCommand);
8384
const logger = await Logger.child(this.constructor.name);
84-
const varargs = parseVarArgs(args, argv);
85+
const varargs = parseVarArgs(args, argv as string[]);
8586

8687
const lifecycle = Lifecycle.getInstance();
8788
if (flags.type === OrgTypes.Sandbox) {

src/commands/force/org/create.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ export class Create extends SfCommand<CreateResult> {
6767
'target-dev-hub': optionalHubFlagWithDeprecations,
6868
'api-version': orgApiVersionFlagWithDeprecations,
6969
loglevel,
70-
type: Flags.enum({
70+
type: Flags.custom<OrgTypes>({
71+
options: [OrgTypes.Scratch, OrgTypes.Sandbox],
72+
})({
7173
char: 't',
7274
summary: messages.getMessage('flags.type'),
73-
options: [OrgTypes.Scratch, OrgTypes.Sandbox],
7475
default: OrgTypes.Scratch,
7576
}),
7677
definitionfile: Flags.file({
@@ -128,7 +129,7 @@ export class Create extends SfCommand<CreateResult> {
128129
const { flags, args, argv } = await this.parse(Create);
129130

130131
this.flags = flags;
131-
this.varArgs = parseVarArgs(args, argv);
132+
this.varArgs = parseVarArgs(args, argv as string[]);
132133
this.logger = await Logger.child(this.constructor.name);
133134
this.logger.debug('Create started with args %s ', flags);
134135

src/commands/org/create/sandbox.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,12 @@ export default class CreateSandbox extends SandboxCommandBase<SandboxProcessObje
9393
description: messages.getMessage('flags.clone.description'),
9494
exclusive: ['license-type'],
9595
}),
96-
'license-type': Flags.enum({
96+
'license-type': Flags.custom<SandboxLicenseType>({
97+
options: getLicenseTypes(),
98+
})({
9799
char: 'l',
98100
summary: messages.getMessage('flags.licenseType.summary'),
99101
exclusive: ['definition-file', 'clone'],
100-
options: getLicenseTypes(),
101102
default: SandboxLicenseType.developer,
102103
}),
103104
'target-org': Flags.requiredOrg({

src/shared/orgHooks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import { Optional } from '@salesforce/ts-types';
99
import { AuthFields } from '@salesforce/core';
10-
import { Command, Hook, Hooks } from '@oclif/core/lib/interfaces';
10+
import { Command, Interfaces, Hook } from '@oclif/core';
1111

1212
type HookOpts<T> = {
1313
options: { Command: Command.Class; argv: string[]; commandId: string };
@@ -33,12 +33,12 @@ type PostOrgCreateOpts = HookOpts<OrgCreateResult>;
3333
/**
3434
* Extends OCLIF's Hooks interface to add types for hooks that run on org commands
3535
*/
36-
export interface OrgHooks extends Hooks {
36+
export interface OrgHooks extends Interfaces.Hooks {
3737
postorgcreate: PostOrgCreateOpts;
3838
}
3939

4040
// eslint-disable-next-line @typescript-eslint/no-explicit-any
41-
export type OrgHook<T> = (this: Hook.Context, options: T extends keyof Hooks ? OrgHooks[T] : T) => any;
41+
export type OrgHook<T> = (this: Hook.Context, options: T extends keyof Interfaces.Hooks ? OrgHooks[T] : T) => any;
4242

4343
// eslint-disable-next-line no-redeclare
4444
export declare namespace OrgHook {

src/shared/sandboxProgress.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import * as os from 'os';
88
import { StatusEvent, ResultEvent, SandboxProcessObject } from '@salesforce/core';
99
import { Ux } from '@salesforce/sf-plugins-core/lib/ux';
10-
import { CliUx } from '@oclif/core';
10+
import { ux } from '@oclif/core';
1111
import { getClockForSeconds } from '../shared/timeUtils';
1212
import { StagedProgress } from './stagedProgress';
1313

@@ -118,7 +118,7 @@ export const getSandboxTableAsText = (sandboxUsername?: string, sandboxProgress?
118118
return [];
119119
}
120120
const tableRows: string[] = [];
121-
CliUx.ux.table(getTableDataFromProcessObj(sandboxProgress, sandboxUsername), columns, {
121+
ux.table(getTableDataFromProcessObj(sandboxProgress, sandboxUsername), columns, {
122122
printLine: (s: string): void => {
123123
tableRows.push(s);
124124
},

yarn.lock

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@
699699
is-wsl "^2.1.1"
700700
tslib "^2.3.1"
701701

702-
"@oclif/core@^1.20.3", "@oclif/core@^1.20.4", "@oclif/core@^1.21.0", "@oclif/core@^1.23.1", "@oclif/core@^1.26.1":
702+
"@oclif/core@^1.20.3", "@oclif/core@^1.20.4", "@oclif/core@^1.21.0", "@oclif/core@^1.23.1":
703703
version "1.26.1"
704704
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.26.1.tgz#26e46c96143d3e2b1dd9bd558ae1653fe9a4f3fa"
705705
integrity sha512-g+OWJcM7JOVI53caTEtq0BB1nPotWctRLUyFODPgvDqXhVR7QED+Qz3LwFAMD8dt7/Ar2ZNq15U3bnpnOv453A==
@@ -733,7 +733,7 @@
733733
widest-line "^3.1.0"
734734
wrap-ansi "^7.0.0"
735735

736-
"@oclif/core@^2.0.2-beta.6", "@oclif/core@^2.0.3":
736+
"@oclif/core@^2.0.2-beta.6", "@oclif/core@^2.0.3", "@oclif/core@^2.0.7":
737737
version "2.0.7"
738738
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-2.0.7.tgz#a17a85dfa105dda120fbc5647432010feaa97a9e"
739739
integrity sha512-pj7hIH8SBeH3qha47fmyqdaBdNVEqesRgnKFh8Ytdb4S41/4BYOiQuyQGuvnKgvicH6DMxp4FbM9EQEW46V9xw==
@@ -1129,7 +1129,7 @@
11291129
resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.4.0.tgz#7dff427c8059895d8108176047aee600703c82d6"
11301130
integrity sha512-BJ25uphssN42Zy6kksheFHMTLiR98AAHe/Wxnv0T4dYxtrEbUjSXVAGKZqfewJPFXA4xB5gxC+rQZtfz6xKCFg==
11311131

1132-
"@salesforce/sf-plugins-core@^1.21.5", "@salesforce/sf-plugins-core@^1.22.1":
1132+
"@salesforce/sf-plugins-core@^1.21.5":
11331133
version "1.22.2"
11341134
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-1.22.2.tgz#56aa9c490a64a53142160eb0b67bc32331ad0674"
11351135
integrity sha512-T6TsDoj5DzZTW5XvggbCropfAB3V88V48dzcZU2vsy5zI6ZQdHVO0xa6T5ylJAvuyOrmmtkVq3wlwoQj9Jz+ow==
@@ -1141,6 +1141,18 @@
11411141
chalk "^4"
11421142
inquirer "^8.2.5"
11431143

1144+
"@salesforce/sf-plugins-core@^2.0.1":
1145+
version "2.0.1"
1146+
resolved "https://registry.yarnpkg.com/@salesforce/sf-plugins-core/-/sf-plugins-core-2.0.1.tgz#079d6cc200ea53ce7fb60aafb5eaf5f2b48e46c9"
1147+
integrity sha512-vT4Y9n/4lStSWrfMAlgQB/XzwJAYK6ibcsFykHNCl86NCoebVGzg5KDIxYjHpidrt2PG/nPk7NL9iBtTH/p8Yg==
1148+
dependencies:
1149+
"@oclif/core" "^2.0.7"
1150+
"@salesforce/core" "^3.33.1"
1151+
"@salesforce/kit" "^1.8.3"
1152+
"@salesforce/ts-types" "^1.7.1"
1153+
chalk "^4"
1154+
inquirer "^8.2.5"
1155+
11441156
"@salesforce/[email protected]":
11451157
version "1.4.4"
11461158
resolved "https://registry.yarnpkg.com/@salesforce/ts-sinon/-/ts-sinon-1.4.4.tgz#ee7039f7eb6c488d58b0a3365e7196e9b1b1ebb4"

0 commit comments

Comments
 (0)