cli icon indicating copy to clipboard operation
cli copied to clipboard

Nested sfdx project doesn't work with @salesforce/source-tracking lib

Open aly76 opened this issue 3 years ago • 7 comments

Summary

For a nested sfdx project, the source tracking library gets local changes from the root project instead of the project directory of the nested sfdx project.

Steps To Reproduce:

  1. Create a source tracking instance
this.sfdxProject = await SfdxProject.resolve("path/to/nested/sfdx/project");

await SourceTracking.create({
  org: this.org,
  project: this.sfdxProject
});
  1. Get local changes as component set
const componentSets = await this.tracking.localChangesAsComponentSet(false);

Expected result

The local changes as component set should be from the nested sfdx project.

Actual result

The local changes as component set are from the root project.

System Information

@salesforce/source-tracking": "1.3.1"

Additional information

The metadata resolver used to create the component set is passed a relative path to the changed file, which is resolved using the working directory.

https://github.com/forcedotcom/source-tracking/blob/8ace55f48ffa9ce3af5cc37b87a57f071dab27b2/src/sourceTracking.ts#L161

aly76 avatar Apr 05 '22 01:04 aly76

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

github-actions[bot] avatar Apr 05 '22 01:04 github-actions[bot]

@aly76 - I'm seeing what I think is a result of this behavior when executing force:source:pull with projects where there is more than one package directory.

force:source:push seems to be working correctly and pushes source from all package directories. Unfortunately, ALL subsequent force:source:pull commands will only retrieve files into the default package directory.

I'm using sfdx-cli/7.144.2 darwin-x64 node-v16.14.2

VivekMChawla avatar Apr 05 '22 04:04 VivekMChawla

We ran into the exact same issue as @VivekMChawla described with force:source:pull Same version sfdx-cli/7.144.2 darwin-x64 node-v16.14.2

ChristianMenzinger avatar Apr 05 '22 12:04 ChristianMenzinger

@VivekMChawla @ChristianMenzinger That would be a different issue (an MPD related one). We raised this particularly from a perspective of using source tracking library (The issue tab was disabled for the repository). This is for our plugins where we need to push from a temporary directory to facilitate preparation of pools https://github.com/Accenture/sfpowerscripts/blob/develop/decision%20records/prepare/001-prepare-source-tracking.md

azlam-abdulsalam avatar Apr 05 '22 14:04 azlam-abdulsalam

For those of you running the source:pull command, have you setup pushPackageDirectoriesSequentially?

WillieRuemmele avatar Apr 05 '22 16:04 WillieRuemmele

We did not specify pushPackageDirectoriesSequentially and pushing worked as expected. The problem is that pull does not update already existing metadata components - a duplicate is generated in the defaultDirectory. So we are talking about multiple package directories defined in the sfdx-project.json

ChristianMenzinger avatar Apr 05 '22 18:04 ChristianMenzinger

This issue has not received a response in 60 days. It will auto-close in 7 days unless a response is posted.

github-actions[bot] avatar Sep 21 '22 19:09 github-actions[bot]