Skip to content
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

fix: use projectDir when getting API version #1307

Merged
merged 5 commits into from
May 10, 2024

Conversation

cristiand391
Copy link
Member

@cristiand391 cristiand391 commented May 8, 2024

What does this PR do?

Pass this.projectDirectory to SfProject.resolve when resolving the manifest API version from sfdx-project for a deploy.
This was the last place where SDR tries to resolve the sfdx project from process.cwd, which fails for consumers running code outside of a project (vscode/devops center).

What issues does this PR fix or reference?

@W-12488179@
@W-15734097@

Functionality Before

if you didn't specify sourceapiversion when building a component set, on a deploy it would do an upward dir search for sfdx-project.json starting from process.cwd just to read the API version from it.
For code not running from the project it would throw "couldn't find the project" err even if you passed the projectDir to the component set.

Functionality After

the project will be resolved from projectDir if available.

sf CLI was already doing this so we shouldn't see any behavior change:
https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3417931c3fbbe31d76a7875bbed372529c9a1cbd/src/utils/deploy.ts#L94
https://github.com/salesforcecli/plugin-deploy-retrieve/blob/3417931c3fbbe31d76a7875bbed372529c9a1cbd/src/utils/project.ts#L16

Pass `this.projectDirectory` to `SfProject.resolve` when resolving
the manifest API version from `sfdx-project`.
@cristiand391 cristiand391 marked this pull request as ready for review May 9, 2024 15:53
@cristiand391 cristiand391 requested a review from a team as a code owner May 9, 2024 15:53
@cristiand391
Copy link
Member Author

I updated the snapshots rather than setting the sourceApiVersion when building the component set for the tests so that snap tests also fail if this change.

@mshanemc mshanemc merged commit a79023a into main May 10, 2024
68 checks passed
@mshanemc mshanemc deleted the cd/sf-project-use-project-dir branch May 10, 2024 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants