Skip to content

Commit aaa6c38

Browse files
committed
fix: use new SDR registry property supportsPartialDelete
1 parent ec7dbd5 commit aaa6c38

File tree

5 files changed

+37
-23
lines changed

5 files changed

+37
-23
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"dependencies": {
4646
"@salesforce/core": "^3.31.19",
4747
"@salesforce/kit": "^1.8.0",
48-
"@salesforce/source-deploy-retrieve": "^7.5.9",
48+
"@salesforce/source-deploy-retrieve": "^7.5.12",
4949
"graceful-fs": "^4.2.10",
5050
"isomorphic-git": "1.17.0",
5151
"ts-retry-promise": "^0.7.0"

src/shared/functions.ts

+1-10
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,7 @@ export const getKeyFromObject = (element: RemoteChangeElement | ChangeResult): s
2020
throw new Error(`unable to complete key from ${JSON.stringify(element)}`);
2121
};
2222

23-
// Return whether a component is part of a bundle. Note that this applies to SDR bundle
24-
// types, but it also applies to some special types that are not technically classified
25-
// in SDR as bundles, such as DigitalExperienceBundle, ExperienceBundle, and StaticResources.
26-
// These types share characteristics of bundle types.
27-
export const isBundle = (cmp: SourceComponent): boolean => {
28-
const cmpTypeAdapter = cmp.type.strategies?.adapter;
29-
const cmpTypeName = cmp.type.name;
30-
const bundleLikeTypes = ['DigitalExperience', 'DigitalExperienceBundle', 'ExperienceBundle', 'StaticResource'];
31-
return cmpTypeAdapter === 'bundle' || bundleLikeTypes.includes(cmpTypeName);
32-
};
23+
export const supportsPartialDelete = (cmp: SourceComponent): boolean => !!cmp.type.supportsPartialDelete;
3324

3425
export const isLwcLocalOnlyTest = (filePath: string): boolean =>
3526
filePath.includes('__utam__') || filePath.includes('__tests__');

src/shared/localComponentSetArray.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
DestructiveChangesType,
1515
} from '@salesforce/source-deploy-retrieve';
1616
import { sourceComponentGuard } from './guards';
17-
import { isBundle, pathIsInFolder } from './functions';
17+
import { supportsPartialDelete, pathIsInFolder } from './functions';
1818

1919
interface GroupedFileInput {
2020
packageDirs: NamedPackageDir[];
@@ -76,9 +76,9 @@ export const getComponentSets = (groupings: GroupedFile[], sourceApiVersion?: st
7676
.flatMap((filename) => resolverForDeletes.getComponentsFromPath(filename))
7777
.filter(sourceComponentGuard)
7878
.map((component) => {
79-
// if the component is part of a bundle AND there are files from the bundle that are not deleted,
80-
// set the bundle for deploy, not for delete.
81-
if (isBundle(component) && component.content && fs.existsSync(component.content)) {
79+
// if the component supports partial delete AND there are files that are not deleted,
80+
// set the component for deploy, not for delete.
81+
if (supportsPartialDelete(component) && component.content && fs.existsSync(component.content)) {
8282
// all bundle types have a directory name
8383
try {
8484
resolverForNonDeletes

src/sourceTracking.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ import {
4141
RemoteChangeElement,
4242
} from './shared/types';
4343
import { sourceComponentGuard } from './shared/guards';
44-
import { isBundle, pathIsInFolder, ensureRelative } from './shared/functions';
44+
import { supportsPartialDelete, pathIsInFolder, ensureRelative } from './shared/functions';
4545
import { registrySupportsType } from './shared/metadataKeys';
4646
import { hasSfdxTrackingFiles } from './compatibility';
4747
import { populateFilePaths } from './shared/populateFilePaths';
@@ -403,7 +403,7 @@ export class SourceTracking extends AsyncCreatable {
403403
const bundlesWithDeletedFiles = (
404404
await this.getChanges({ origin: 'local', state: 'delete', format: 'SourceComponent' })
405405
)
406-
.filter(isBundle)
406+
.filter(supportsPartialDelete)
407407
.filter((cmp) => deployedFilesAsVirtualComponentSet.has({ type: cmp.type, fullName: cmp.fullName }))
408408
.map((cmp) => cmp.content)
409409
.filter(isString);

yarn.lock

+29-6
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@
673673
strip-ansi "6.0.1"
674674
ts-retry-promise "^0.7.0"
675675

676-
"@salesforce/core@^3.30.9", "@salesforce/core@^3.31.17", "@salesforce/core@^3.31.19":
676+
"@salesforce/core@^3.30.9", "@salesforce/core@^3.31.19":
677677
version "3.31.19"
678678
resolved "https://registry.yarnpkg.com/@salesforce/core/-/core-3.31.19.tgz#29366aee1e9e271d3bef6d0a5e60204f3885daf7"
679679
integrity sha512-Qx4F7n+1eENICD9yvTrSI5+HVbjZ/B3vzNjdjZ4aNHO5MvEgg93vs1KeGujfGU4lzaEj5Wuy7delp5wJC0a1aA==
@@ -696,6 +696,29 @@
696696
jsonwebtoken "8.5.1"
697697
ts-retry-promise "^0.7.0"
698698

699+
"@salesforce/core@^3.32.1":
700+
version "3.32.1"
701+
resolved "https://registry.npmjs.org/@salesforce/core/-/core-3.32.1.tgz#1a338a1985c58c1be819f99c6b33b24b32817cbe"
702+
integrity sha512-hVcweKGy1CS3t0duS+0jxGVou5ZoQMXRZPQmcz1FyW31Oef5U07rhs3wTrwJqhCPHL817R/gm5V9wSRNcYdDtA==
703+
dependencies:
704+
"@salesforce/bunyan" "^2.0.0"
705+
"@salesforce/kit" "^1.8.0"
706+
"@salesforce/schemas" "^1.1.0"
707+
"@salesforce/ts-types" "^1.5.21"
708+
"@types/graceful-fs" "^4.1.5"
709+
"@types/semver" "^7.3.9"
710+
ajv "^8.11.0"
711+
archiver "^5.3.0"
712+
change-case "^4.1.2"
713+
debug "^3.2.7"
714+
faye "^1.4.0"
715+
form-data "^4.0.0"
716+
graceful-fs "^4.2.9"
717+
js2xmlparser "^4.0.1"
718+
jsforce "^2.0.0-beta.19"
719+
jsonwebtoken "8.5.1"
720+
ts-retry-promise "^0.7.0"
721+
699722
"@salesforce/dev-config@^3.0.0", "@salesforce/dev-config@^3.1.0":
700723
version "3.1.0"
701724
resolved "https://registry.yarnpkg.com/@salesforce/dev-config/-/dev-config-3.1.0.tgz#8eb5b35860ff60d1c1dc3fd9329b01a28475d5b9"
@@ -759,12 +782,12 @@
759782
resolved "https://registry.yarnpkg.com/@salesforce/schemas/-/schemas-1.1.3.tgz#fce83f55c7557d47b9c814d5d02978ad734300b3"
760783
integrity sha512-XWohlOT2oQDqAJH00OXS3f2MGjkwZ6pr4emnnkHSQbg7UdGW0rvGpEnRKqBbDUfZ4K5YKSo9Gj216ZtaP3JLXg==
761784

762-
"@salesforce/source-deploy-retrieve@^7.5.9":
763-
version "7.5.9"
764-
resolved "https://registry.yarnpkg.com/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-7.5.9.tgz#8919f186d434bee0a406db59bd0aae0a597c733f"
765-
integrity sha512-NFB2ogQvwdpzjf3+c0MewXDgmY4B6uA1DRsf/fwIriNYsN3f96WI/BG5cf72HeHrhndaZ8/eBZp7yEPNLJTjjA==
785+
"@salesforce/source-deploy-retrieve@^7.5.12":
786+
version "7.5.12"
787+
resolved "https://registry.npmjs.org/@salesforce/source-deploy-retrieve/-/source-deploy-retrieve-7.5.12.tgz#6926f06b399d620268245316305dd4d772c5099f"
788+
integrity sha512-fj8b33UtfH3cW2pEYPIs6UOFADy7dK2LwjAgCm2lzPDWwlAuBIhYDrnuuZaH8/fMoz4p7k81QXWXbLo3sMDntw==
766789
dependencies:
767-
"@salesforce/core" "^3.31.17"
790+
"@salesforce/core" "^3.32.1"
768791
"@salesforce/kit" "^1.8.0"
769792
"@salesforce/ts-types" "^1.7.1"
770793
archiver "^5.3.1"

0 commit comments

Comments
 (0)