-
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
Wr/delete #199
Conversation
src/commands/force/source/delete.ts
Outdated
|
||
// The DeleteResultFormatter will use SDR and scan the directory, if the files have been deleted, it will throw an error | ||
// so we'll delete the files locally now | ||
this.deleteFilesLocally(); |
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.
This feels out of place in a results formatting function, and I don't think the comment applies anymore. What if we move this to either the resolveSuccess
method or the run
method just after calling resolveSuccess()
?
src/commands/force/source/delete.ts
Outdated
if (!(await this.handlePrompt())) { | ||
// the user said 'no' to the prompt | ||
this.exit(0); | ||
} |
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.
What if we just used a private for this and resolveSuccess
would check that too? Maybe: this.canceled = true; return;
src/commands/force/source/delete.ts
Outdated
if (!this.getFlag('noprompt')) { | ||
const paths = this.sourceComponents.map((component) => component.content + '\n' + component.xml).join('\n'); | ||
const promptMessage = messages.getMessage('prompt', [paths]); | ||
const answer = (await prompt(promptMessage)) 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.
I've always wondered why CLI commands use prompt
instead of confirm
(and then have to do the extra casing, etc).
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.
Oh, it's probably just a carry-over from TB, I'll swap it for confirm
QA Notes: after running its setup (orgInit.sh) I'm getting some undefined in the warnings
|
QA Notes: same
PS: these only seem to happen when there aren't content files to go with the xml. Example of it working for an object
|
QA notes: I kinda feel the same way about "Deployed Source" on the
|
QA Notes: |
QA Notes:
when what I really want is in the --json "componentFailures": {
"changed": "false",
"componentType": "CustomField",
"created": "false",
"createdDate": "2021-09-17T15:17:18.000Z",
"deleted": "false",
"fileName": "destructiveChanges.xml",
"fullName": "destructiveChanges.xml",
"problem": "No CustomField named: Employee__c.Onboarding_Buddy__c found",
"problemType": "Warning",
"success": "false"
}, here's a more complex example where I try to delete an entire object {
"changed": "false",
"componentType": "CustomField",
"created": "false",
"createdDate": "2021-09-17T15:21:24.000Z",
"deleted": "false",
"fileName": "objects/Employee__c.object",
"fullName": "Employee__c.User_Record__c",
"problem": "This custom field is referenced elsewhere in salesforce.com. : Flow Version - 3011D0000008EFE.",
"problemType": "Error",
"success": "false"
},
{
"changed": "false",
"componentType": "CustomField",
"created": "false",
"createdDate": "2021-09-17T15:21:24.000Z",
"deleted": "false",
"fileName": "objects/Employee__c.object",
"fullName": "Employee__c.First_Name__c",
"problem": "This custom field is referenced elsewhere in salesforce.com. : Flow Version - 3011D0000008EFE. This custom field is referenced elsewhere in salesforce.com. : Apex Class - ResetOnboarding.",
"problemType": "Error",
"success": "false"
},
{
"changed": "false",
"componentType": "CustomField",
"created": "false",
"createdDate": "2021-09-17T15:21:24.000Z",
"deleted": "false",
"fileName": "objects/Employee__c.object",
"fullName": "Employee__c.Status__c",
"problem": "This custom field is referenced elsewhere in salesforce.com. : Flow Version - 3011D0000008EFE. This custom field is referenced elsewhere in salesforce.com. : Apex Class - ResetOnboarding. Referenced by the Lightning page Employee Record Page : Lightning Page.",
"problemType": "Error",
"success": "false"
},
{
"changed": "false",
"componentType": "CustomField",
"created": "false",
"createdDate": "2021-09-17T15:21:24.000Z",
"deleted": "false",
"fileName": "objects/Employee__c.object",
"fullName": "Employee__c.Last_Name__c",
"problem": "This custom field is referenced elsewhere in salesforce.com. : Flow Version - 3011D0000008EFE. This custom field is referenced elsewhere in salesforce.com. : Apex Class - ResetOnboarding.",
"problemType": "Error",
"success": "false"
},
{
"changed": "false",
"componentType": "CustomField",
"created": "false",
"createdDate": "2021-09-17T15:21:24.000Z",
"deleted": "false",
"fileName": "objects/Employee__c.object",
"fullName": "Employee__c.Phone__c",
"problem": "This custom field is referenced elsewhere in salesforce.com. : Flow Version - 3011D0000008EFE.",
"problemType": "Error",
"success": "false"
},
It looks like the componentFailures from SDR can be an array or a single object--and it's the non-Array that we're not handling properly. you do get an errors table if there are multiple failures. |
QA Notes:
this happens on LWC, too (it'll only show the bundle and its xml) which is different from toolbelt
|
QA Notes:
after confirming, it doesn't look like any attempt was made to delete the non-existent one (which seems fair). I think this should have thrown an error before trying to delete. [only applies to Also, toolbelt has the same problem with -m [one good, one not there] |
0a15295
to
a20f8b6
Compare
What does this PR do?
adds the
source:delete
commandadds unit tests
adds
delete
NUTsWhat issues does this PR fix or reference?
@W-9137776@
@W-7552573@