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: don't cast opts to boolean #862

Merged
merged 3 commits into from
Jan 5, 2024
Merged

fix: don't cast opts to boolean #862

merged 3 commits into from
Jan 5, 2024

Conversation

cristiand391
Copy link
Member

@cristiand391 cristiand391 commented Jan 2, 2024

What does this PR do?

Update empty component set check to not cast deploy opts from boolean | undefined to boolean when using the ?? operator.

It was changed to casting + ?? operator here:
ad2cb25#diff-38ace718cac3391d646985bcdd7fd17d4114a116432f5c6846db797b46552080R157

So if you don't pass these flags these are undefined at runtime, then casted to boolean so the ?? op will always return false unless the flag was specified.

Repro:

  1. clone dreamhouse & create scratch org
  2. create package.xml with this content:
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <version>59.0</version>
</Package>
  1. try deploy using latest (below I'm using latest-rc with no linked plugins):
➜  dreamhouse-lwc git:(main) ✗ sf -v
@salesforce/cli/2.22.7 darwin-x64 node-v20.10.0
➜  dreamhouse-lwc git:(main) ✗ sf project deploy start --manifest package.xml --dry-run
No changes to deploy
➜  dreamhouse-lwc git:(main) ✗ echo $?
0
  1. now link this branch of PDR and repeat step 3, should see:
➜  dreamhouse-lwc git:(main) ✗ sf project deploy start --manifest package.xml --dry-run
 ›   Warning: @salesforce/plugin-deploy-retrieve is a linked ESM module and cannot be auto-transpiled. Existing compiled source will be used instead.
Error (1): No local changes to deploy.

Try this:

To see conflicts and ignored files, run "sf project deploy preview" with any of the manifest, directory, or metadata flags.
➜  dreamhouse-lwc git:(main) ✗ echo $?
1

This regression was introduced in PDR v1.20.0, @salesforce/cli@2.17.14.

What issues does this PR fix or reference?

Fixes: forcedotcom/cli#2621
@W-14739817@

@mshanemc
Copy link
Contributor

mshanemc commented Jan 5, 2024

QA:

[not repeating the package.xml test from the nut]
project deploy start with no params still returns 0 when there are no changes
project deploy start -d force-app returns 1 when there are no changes

@mshanemc mshanemc merged commit cbffe96 into main Jan 5, 2024
38 checks passed
@mshanemc mshanemc deleted the cd/fix-regression branch January 5, 2024 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants