3

More than two months ago, the VS Code command SFDX Diff File Against Org stopped working for SObject related metadata (see issue #3586 in GitHub).

Wondering what might delay a much needed fix, I have been searching for information on Google; the search turned up several mentions of sfdx force:source:diff but none of them was in the CLI documentation. Does this mean that the command is obsoleted and / or not officially supported?

On the other hand, when running the command in VS Code's Terminal window, I do get a response (newlines added by me for clarity):

ERROR running force:source:diff:  
Source diffing isn't supported for the file: C:\...\objects\MyObject__c\fields\MyField__c.field.
Only these metadata types support source diffing: 
  ApexClass
, ApexPage
, ApexComponent
, ApexTrigger
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, aura\<BundleName>\AuraDefinition
, Layout
, lwc\<BundleName>\LightningComponentResource
, lwc\<BundleName>\LightningComponentResource
, lwc\<BundleName>\LightningComponentResource
, PermissionSet
, CustomLabel

It does look a bit suspicious, doesn't it? So what is going on?

1 Answer 1

3

It's not in core CLI command documentation because it's not a part of the core package, it's a plugin that is still in beta.

sfdx force:source:diff --help

diff a local source file against the version in your org (this command is currently in a beta program for usage with the Salesforce Extensions for VSCode)

In terms of the output you're seeing, it seems to correlate with the fact that both bundles (for aura and LWC) can have several files within it that the plugin seems to support diffing:

Lightning Component Resource has 3 files

  • .html
  • .js
  • .xml

AuraDefinition has 12 available to diff (ignore deprecated and reserved for future use)

  • APPLICATION — Lightning Aura Components app
  • CONTROLLER — client-side controller
  • COMPONENT — component markup
  • EVENT — event definition
  • HELPER — client-side helper
  • INTERFACE — interface definition
  • RENDERER — client-side renderer
  • STYLE — style (CSS) resource
  • DOCUMENTATION — documentation markup
  • TOKENS — tokens collection
  • DESIGN — design definition
  • SVG — SVG graphic resource

That specific error message seems to suggest support for diffing the files you're looking to do was intentionally removed - however, I'll point out it doesn't seem to be an exhaustive list as you can diff other metadata types successfully that are not listed as supported types (ex. tab and applications metadata worked).

You can also follow the Known Issue related to the github issue you linked.

1
  • That's kind of what I thought it was, but I didn't have any links to share.
    – sfdcfox
    Dec 16, 2021 at 23:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .