diff --git a/package.json b/package.json index 284131e6..6c691ebd 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ "author": "Salesforce", "bugs": "https://github.com/forcedotcom/cli/issues", "dependencies": { - "@oclif/core": "^1.23.2", + "@oclif/core": "^2.0.7", "@salesforce/core": "^3.32.11", "@salesforce/kit": "^1.8.2", - "@salesforce/sf-plugins-core": "^1.21.8", + "@salesforce/sf-plugins-core": "^2.0.1", "chalk": "^4", "change-case": "^4.1.2", "open": "^8.4.0", @@ -128,4 +128,4 @@ "access": "public" }, "main": "lib/index.js" -} \ No newline at end of file +} diff --git a/schemas/env-create-scratch.json b/schemas/env-create-scratch.json index 379fe978..ab849aed 100644 --- a/schemas/env-create-scratch.json +++ b/schemas/env-create-scratch.json @@ -24,7 +24,11 @@ "type": "string" } }, - "required": ["scratchOrgInfo", "warnings", "orgId"], + "required": [ + "scratchOrgInfo", + "warnings", + "orgId" + ], "additionalProperties": false }, "ScratchOrgInfo": { @@ -86,7 +90,11 @@ }, "Release": { "type": "string", - "enum": ["Current", "Previous", "Preview"] + "enum": [ + "Current", + "Previous", + "Preview" + ] }, "ScratchOrg": { "type": "string" @@ -102,7 +110,13 @@ }, "Status": { "type": "string", - "enum": ["New", "Creating", "Active", "Error", "Deleted"] + "enum": [ + "New", + "Creating", + "Active", + "Error", + "Deleted" + ] }, "SignupEmail": { "type": "string" @@ -142,14 +156,16 @@ } } }, - "required": ["enabled", "disabled"], + "required": [ + "enabled", + "disabled" + ], "additionalProperties": false } }, "required": [ "LoginUrl", "AuthCode", - "Snapshot", "Status", "SignupEmail", "SignupUsername", @@ -195,7 +211,12 @@ "description": "Any valid JSON value." }, "JsonPrimitive": { - "type": ["null", "boolean", "number", "string"], + "type": [ + "null", + "boolean", + "number", + "string" + ], "description": "Any valid JSON primitive value." }, "JsonCollection": { @@ -312,7 +333,10 @@ "type": "string" }, "namespacePrefix": { - "type": ["string", "null"] + "type": [ + "string", + "null" + ] }, "isSandbox": { "type": "boolean" @@ -321,11 +345,14 @@ "type": "boolean" }, "trailExpirationDate": { - "type": ["string", "null"] + "type": [ + "string", + "null" + ] } }, "additionalProperties": false, "description": "Fields for authorization, org, and local information." } } -} +} \ No newline at end of file diff --git a/schemas/env-resume-scratch.json b/schemas/env-resume-scratch.json index 379fe978..ab849aed 100644 --- a/schemas/env-resume-scratch.json +++ b/schemas/env-resume-scratch.json @@ -24,7 +24,11 @@ "type": "string" } }, - "required": ["scratchOrgInfo", "warnings", "orgId"], + "required": [ + "scratchOrgInfo", + "warnings", + "orgId" + ], "additionalProperties": false }, "ScratchOrgInfo": { @@ -86,7 +90,11 @@ }, "Release": { "type": "string", - "enum": ["Current", "Previous", "Preview"] + "enum": [ + "Current", + "Previous", + "Preview" + ] }, "ScratchOrg": { "type": "string" @@ -102,7 +110,13 @@ }, "Status": { "type": "string", - "enum": ["New", "Creating", "Active", "Error", "Deleted"] + "enum": [ + "New", + "Creating", + "Active", + "Error", + "Deleted" + ] }, "SignupEmail": { "type": "string" @@ -142,14 +156,16 @@ } } }, - "required": ["enabled", "disabled"], + "required": [ + "enabled", + "disabled" + ], "additionalProperties": false } }, "required": [ "LoginUrl", "AuthCode", - "Snapshot", "Status", "SignupEmail", "SignupUsername", @@ -195,7 +211,12 @@ "description": "Any valid JSON value." }, "JsonPrimitive": { - "type": ["null", "boolean", "number", "string"], + "type": [ + "null", + "boolean", + "number", + "string" + ], "description": "Any valid JSON primitive value." }, "JsonCollection": { @@ -312,7 +333,10 @@ "type": "string" }, "namespacePrefix": { - "type": ["string", "null"] + "type": [ + "string", + "null" + ] }, "isSandbox": { "type": "boolean" @@ -321,11 +345,14 @@ "type": "boolean" }, "trailExpirationDate": { - "type": ["string", "null"] + "type": [ + "string", + "null" + ] } }, "additionalProperties": false, "description": "Fields for authorization, org, and local information." } } -} +} \ No newline at end of file diff --git a/src/commands/env/create/sandbox.ts b/src/commands/env/create/sandbox.ts index 4d7df853..47204e4f 100644 --- a/src/commands/env/create/sandbox.ts +++ b/src/commands/env/create/sandbox.ts @@ -16,30 +16,13 @@ import { SandboxRequest, SfError, } from '@salesforce/core'; -import { Duration } from '@salesforce/kit'; import { Ux } from '@salesforce/sf-plugins-core/lib/ux'; -import * as Interfaces from '@oclif/core/lib/interfaces'; +import { Interfaces } from '@oclif/core'; import { SandboxCommandBase } from '../../../shared/sandboxCommandBase'; Messages.importMessagesDirectory(__dirname); const messages = Messages.loadMessages('@salesforce/plugin-env', 'create.sandbox'); -type CmdFlags = { - 'definition-file': string; - 'set-default': boolean; - alias: string; - async: boolean; - 'poll-interval': Duration; - wait: Duration; - name: string; - 'license-type': string; - 'no-prompt': boolean; - 'target-org': Org; - clone: string; - json: boolean; - 'no-track-source': boolean; -}; - export enum SandboxLicenseType { developer = 'Developer', developerPro = 'Developer_Pro', @@ -56,8 +39,7 @@ export default class CreateSandbox extends SandboxCommandBase> = { + public static flags = { // needs to change when new flags are available 'definition-file': Flags.file({ exists: true, @@ -117,7 +99,7 @@ export default class CreateSandbox extends SandboxCommandBase; public async run(): Promise { this.sandboxRequestConfig = await this.getSandboxRequestConfig(); - this.flags = (await this.parse(CreateSandbox)).flags as CmdFlags; + this.flags = (await this.parse(CreateSandbox)).flags; this.debug('Create started with args %s ', this.flags); this.validateFlags(); return this.createSandbox(); diff --git a/src/commands/env/list.ts b/src/commands/env/list.ts index 45d94ec3..e514531f 100644 --- a/src/commands/env/list.ts +++ b/src/commands/env/list.ts @@ -5,6 +5,7 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ +import { Interfaces } from '@oclif/core'; import { Messages } from '@salesforce/core'; import { Flags, SfCommand, JsonObject, SfHook, EnvList as Env } from '@salesforce/sf-plugins-core'; import { toKey, toValue } from '../../utils'; @@ -78,17 +79,7 @@ export default class EnvList extends SfCommand { }), }; - private flags!: { - all: boolean; - columns: string[]; - csv: boolean; - filter: string; - json: boolean; - 'no-header': boolean; - 'no-truncate': boolean; - output: string; - sort: string; - }; + private flags!: Interfaces.InferredFlags; public async run(): Promise { this.flags = (await this.parse(EnvList)).flags; diff --git a/src/commands/env/resume/sandbox.ts b/src/commands/env/resume/sandbox.ts index 5b515339..36ad3ec2 100644 --- a/src/commands/env/resume/sandbox.ts +++ b/src/commands/env/resume/sandbox.ts @@ -20,26 +20,18 @@ import { SfError, } from '@salesforce/core'; import { Duration } from '@salesforce/kit'; -import * as Interfaces from '@oclif/core/lib/interfaces'; +import { Interfaces } from '@oclif/core'; import { SandboxCommandBase } from '../../../shared/sandboxCommandBase'; Messages.importMessagesDirectory(__dirname); const messages = Messages.loadMessages('@salesforce/plugin-env', 'resume.sandbox'); -type CmdFlags = { - wait: Duration; - name: string; - 'job-id': string; - 'target-org': Org; - 'use-most-recent': boolean; -}; - export default class ResumeSandbox extends SandboxCommandBase { public static summary = messages.getMessage('summary'); public static description = messages.getMessage('description'); public static examples = messages.getMessages('examples'); - public static flags: Interfaces.FlagInput = { + public static flags = { wait: Flags.duration({ char: 'w', summary: messages.getMessage('flags.wait.summary'), @@ -79,7 +71,7 @@ export default class ResumeSandbox extends SandboxCommandBase; public async run(): Promise { this.sandboxRequestConfig = await this.getSandboxRequestConfig(); diff --git a/src/shared/orgHooks.ts b/src/shared/orgHooks.ts index ea9ae76f..b80b2b1a 100644 --- a/src/shared/orgHooks.ts +++ b/src/shared/orgHooks.ts @@ -7,7 +7,7 @@ import { Optional } from '@salesforce/ts-types'; import { AuthFields } from '@salesforce/core'; -import { Command, Hook, Hooks } from '@oclif/core/lib/interfaces'; +import { Command, Interfaces, Hook } from '@oclif/core'; type HookOpts = { options: { Command: Command.Class; argv: string[]; commandId: string }; @@ -33,12 +33,12 @@ type PostOrgCreateOpts = HookOpts; /** * Extends OCLIF's Hooks interface to add types for hooks that run on org commands */ -export interface OrgHooks extends Hooks { +export interface OrgHooks extends Interfaces.Hooks { postorgcreate: PostOrgCreateOpts; } // eslint-disable-next-line @typescript-eslint/no-explicit-any -export type OrgHook = (this: Hook.Context, options: T extends keyof Hooks ? OrgHooks[T] : T) => any; +export type OrgHook = (this: Hook.Context, options: T extends keyof Interfaces.Hooks ? OrgHooks[T] : T) => any; // eslint-disable-next-line no-redeclare export declare namespace OrgHook { diff --git a/src/shared/sandboxProgress.ts b/src/shared/sandboxProgress.ts index 905365f3..df6f11db 100644 --- a/src/shared/sandboxProgress.ts +++ b/src/shared/sandboxProgress.ts @@ -7,7 +7,7 @@ import * as os from 'os'; import { StatusEvent, ResultEvent, SandboxProcessObject } from '@salesforce/core'; import { Ux } from '@salesforce/sf-plugins-core/lib/ux'; -import { CliUx } from '@oclif/core'; +import { ux } from '@oclif/core'; import { getClockForSeconds } from '../utils/timeUtils'; import { StagedProgress } from './stagedProgress'; @@ -85,7 +85,7 @@ export class SandboxProgress extends StagedProgress { return []; } const tableRows: string[] = []; - CliUx.ux.table(this.getTableDataFromProcessObj(sandboxUsername, sandboxProgress), columns, { + ux.table(this.getTableDataFromProcessObj(sandboxUsername, sandboxProgress), columns, { printLine: (s: string): void => { tableRows.push(s); }, diff --git a/test/commands/env/create/createSandbox.test.ts b/test/commands/env/create/createSandbox.test.ts index b00c76a5..da464e64 100644 --- a/test/commands/env/create/createSandbox.test.ts +++ b/test/commands/env/create/createSandbox.test.ts @@ -56,8 +56,6 @@ describe('env:create:sandbox', () => { return this.run(); } public setProject(project: SfProject) { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore this.project = project; } } diff --git a/test/tsconfig.json b/test/tsconfig.json index 85d849ec..b5face3e 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -8,7 +8,8 @@ "baseUrl": ".", "paths": { "@oclif/core": ["../node_modules/@oclif/core"], - "@salesforce/kit": ["../node_modules/@salesforce/kit"] + "@salesforce/kit": ["../node_modules/@salesforce/kit"], + "@salesforce/core": ["../node_modules/@salesforce/core"] } } } diff --git a/tsconfig.json b/tsconfig.json index 7207a00e..df8d291c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,7 @@ "baseUrl": ".", "paths": { "@oclif/core": ["node_modules/@oclif/core"], + "@salesforce/core": ["node_modules/@salesforce/core"], "@salesforce/kit": ["node_modules/@salesforce/kit"] } }, diff --git a/yarn.lock b/yarn.lock index 821595b7..c3aee520 100644 --- a/yarn.lock +++ b/yarn.lock @@ -793,7 +793,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.24.0", "@oclif/core@^1.6.0", "@oclif/core@^1.6.3": +"@oclif/core@^1.20.3", "@oclif/core@^1.20.4", "@oclif/core@^1.21.0", "@oclif/core@^1.23.1", "@oclif/core@^1.24.0", "@oclif/core@^1.6.0", "@oclif/core@^1.6.3": version "1.24.0" resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.24.0.tgz#e94e2f3a1259ebb3cc867d04b12c5bfc31c21f50" integrity sha512-J41suyV4fLfLcRRySZdtgFYSjIlpYqD90SY01Fm4+ZJUMcfDh/eQAD4sogyYOsIT0bfEzYOyYCjmfHmgcoX5aA== @@ -827,7 +827,7 @@ widest-line "^3.1.0" wrap-ansi "^7.0.0" -"@oclif/core@^2.0.2-beta.10", "@oclif/core@^2.0.3": +"@oclif/core@^2.0.2-beta.10", "@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== @@ -1151,7 +1151,7 @@ semver "^7.3.5" ts-retry-promise "^0.6.0" -"@salesforce/core@^3.11.0", "@salesforce/core@^3.24.0", "@salesforce/core@^3.32.11", "@salesforce/core@^3.32.12": +"@salesforce/core@^3.11.0", "@salesforce/core@^3.24.0", "@salesforce/core@^3.32.12": version "3.32.12" resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.32.12.tgz#853cc5b6a5f95d4896b2d34a40a6042ef9aa6d2c" integrity sha512-27rqSiQWul7b/OkJs19FYDv2M/S4oI4efiGv+6sR7UWv7D7CG1P+0XpgLS3d9xRYF30h98n6VQr4W2a+BWFRvA== @@ -1174,6 +1174,29 @@ jsonwebtoken "9.0.0" ts-retry-promise "^0.7.0" +"@salesforce/core@^3.32.11", "@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.0.1": version "3.1.0" resolved "https://registry.yarnpkg.com/@salesforce/dev-config/-/dev-config-3.1.0.tgz#8eb5b35860ff60d1c1dc3fd9329b01a28475d5b9" @@ -1227,6 +1250,15 @@ shx "^0.3.3" tslib "^2.2.0" +"@salesforce/kit@^1.8.3": + version "1.8.3" + resolved "https://registry.yarnpkg.com/@salesforce/kit/-/kit-1.8.3.tgz#b590b78a8618494c51534598a7eb0683ba0da3f2" + integrity sha512-p+0tWR2pyCAIjZwDXGhrYFPuLckX9fP3Xa6Jync9POeQBfDGyK9CRd1eaiWj+6BeDS9kwvgm5M6o+OptIEhEjw== + dependencies: + "@salesforce/ts-types" "^1.7.2" + shx "^0.3.3" + tslib "^2.2.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" @@ -1298,7 +1330,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.8", "@salesforce/sf-plugins-core@^1.7.2", "@salesforce/sf-plugins-core@^1.9.0": +"@salesforce/sf-plugins-core@^1.21.5", "@salesforce/sf-plugins-core@^1.7.2", "@salesforce/sf-plugins-core@^1.9.0": 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== @@ -1310,6 +1342,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/templates@^55.1.0": version "55.1.0" resolved "https://registry.yarnpkg.com/@salesforce/templates/-/templates-55.1.0.tgz#b928a384c4d7f7cadd25671bff0783a028e96f1a" @@ -1341,6 +1385,13 @@ dependencies: tslib "^2.4.1" +"@salesforce/ts-types@^1.7.2": + version "1.7.2" + resolved "https://registry.yarnpkg.com/@salesforce/ts-types/-/ts-types-1.7.2.tgz#ab40399d291c7eca57efc9890daf2fa2632197ec" + integrity sha512-eCpWKEb03UCKBJ6Svp0Vwcwt+fG6BQbopO4x5wt6CYeT8Rjt0dbDQicZPmVL59j2qyt3Q4Y4EYsxXUGZmdfvDw== + dependencies: + tslib "^2.4.1" + "@sindresorhus/is@^4.0.0": version "4.6.0" resolved "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f"