-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: devScripts update #1261
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ import { | |
RetrieveResult, | ||
RetrieveVersionData, | ||
} from '@salesforce/source-deploy-retrieve'; | ||
import { Optional, ensure } from '@salesforce/ts-types'; | ||
import { Optional, ensure, ensureString } from '@salesforce/ts-types'; | ||
import { Flags, loglevel, requiredOrgFlagWithDeprecations, Ux } from '@salesforce/sf-plugins-core'; | ||
import { Interfaces } from '@oclif/core'; | ||
import { resolveZipFileName, SourceCommand } from '../../../sourceCommand.js'; | ||
|
@@ -100,7 +100,7 @@ export class Retrieve extends SourceCommand { | |
|
||
protected retrieveResult: RetrieveResult | undefined; | ||
private sourceDir: string | undefined; | ||
private retrieveTargetDir: string | undefined; | ||
private retrieveTargetDir!: string; | ||
private zipFileName: string | undefined; | ||
private unzip: boolean | undefined; | ||
// will be set to `flags.wait` (which has a default value) when executed. | ||
|
@@ -111,6 +111,7 @@ export class Retrieve extends SourceCommand { | |
private org!: Org | undefined; | ||
public async run(): Promise<RetrieveCommandCombinedResult> { | ||
this.flags = (await this.parse(Retrieve)).flags; | ||
this.retrieveTargetDir = this.resolveOutputDir(this.flags.retrievetargetdir); | ||
this.org = this.flags['target-org']; | ||
await this.retrieve(); | ||
this.resolveSuccess(); | ||
|
@@ -185,7 +186,7 @@ export class Retrieve extends SourceCommand { | |
unzip: this.unzip, | ||
}); | ||
|
||
this.log(`Retrieve ID: ${this.mdapiRetrieve.id}`); | ||
this.log(`Retrieve ID: ${this.mdapiRetrieve.id ?? ''}`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. preserves existing behavior (no value present) |
||
|
||
if (this.isAsync) { | ||
this.spinner.stop('queued'); | ||
|
@@ -216,11 +217,11 @@ export class Retrieve extends SourceCommand { | |
protected formatResult(): RetrieveCommandResult | RetrieveCommandAsyncResult { | ||
// async result | ||
if (this.isAsync) { | ||
let cmdFlags = `--jobid ${this.mdapiRetrieve?.id} --retrievetargetdir ${this.retrieveTargetDir}`; | ||
const targetusernameFlag = this.flags['target-org']; | ||
if (targetusernameFlag) { | ||
cmdFlags += ` --targetusername ${targetusernameFlag.getUsername()}`; | ||
} | ||
const targetUsername = this.flags['target-org'].getUsername(); | ||
|
||
const cmdFlags = `--jobid ${ensureString(this.mdapiRetrieve?.id)} --retrievetargetdir ${this.retrieveTargetDir}${ | ||
targetUsername ? ` --targetusername ${targetUsername}` : '' | ||
}`; | ||
this.log(''); | ||
this.log(messages.getMessage('checkStatus', [cmdFlags])); | ||
return { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,7 +114,7 @@ const resultConverter = (input: StatusOutputRow): StatusResult => { | |
type, | ||
// this string became the place to store information. | ||
// The JSON now breaks out that info but preserves this property for backward compatibility | ||
state: `${origin} ${actualState}${conflict ? ' (Conflict)' : ''}` as StatusStateString, | ||
state: `${origin} ${actualState as string}${conflict ? ' (Conflict)' : ''}` as StatusStateString, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the map is complete, but Map.get() doesn't guarantee presence |
||
ignored, | ||
filePath, | ||
origin, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ export class DeployCancelResultFormatter extends ResultFormatter { | |
} | ||
|
||
public display(): void { | ||
const deployId = getString(this.result, 'response.id'); | ||
const deployId = this.result.response.id; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. now that we have types we don't need the goofy |
||
if (this.isSuccess()) { | ||
this.ux.log(`Successfully canceled ${deployId}`); | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,10 +69,10 @@ export class DeployProgressStatusFormatter extends ProgressFormatter { | |
const testsTotal = getNumber(data, 'numberTestsTotal'); | ||
const testsCompleted = getNumber(data, 'numberTestsCompleted'); | ||
const testErrors = getNumber(data, 'numberTestErrors'); | ||
const deploys = `${componentsDeployed}/${componentsTotal} components deployed.`; | ||
const deployErrors = componentErrors === 1 ? `${componentErrors} error.` : `${componentErrors} errors.`; | ||
const tests = `${testsCompleted}/${testsTotal} tests completed.`; | ||
const testErrs = testErrors === 1 ? `${testErrors} error.` : `${testErrors} errors.`; | ||
const deploys = `${componentsDeployed ?? 0}/${componentsTotal ?? 0} components deployed.`; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. zeros seemed right? |
||
const deployErrors = componentErrors === 1 ? `${componentErrors} error.` : `${componentErrors ?? 0} errors.`; | ||
const tests = `${testsCompleted ?? 0}/${testsTotal ?? 0} tests completed.`; | ||
const testErrs = testErrors === 1 ? `${testErrors} error.` : `${testErrors ?? 0} errors.`; | ||
this.ux.log(`${deploys} ${deployErrors}`); | ||
this.ux.log(`${tests} ${testErrs}`); | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,7 +138,7 @@ const processConflicts = (conflicts: ChangeResult[], ux: Ux, message: string): v | |
const conflictMap = new Map<string, ConflictResponse>(); | ||
conflicts.forEach((c) => { | ||
c.filenames?.forEach((f) => { | ||
conflictMap.set(`${c.name}#${c.type}#${f}`, { | ||
conflictMap.set(`${c.name ?? ''}#${c.type ?? ''}#${f}`, { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also preserve existing behaior |
||
state: 'Conflict', | ||
fullName: c.name as string, | ||
type: c.type as string, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moving the setting of this to the top of the run method will justify
!