fix: use projectDir
when getting API version
#1307
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Pass
this.projectDirectory
toSfProject.resolve
when resolving the manifest API version fromsfdx-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 forsfdx-project.json
starting fromprocess.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