fix: single-file static resources include all resources in delta#1219
Merged
fix: single-file static resources include all resources in delta#1219
Conversation
…ent boundary componentBasePath had inconsistent semantics: for folder resources it returned the component boundary (staticresources/MyLib), but for single-file resources it returned the type directory (staticresources). Rename to componentPath and fix the getter to always return the correct component boundary by using typeDirectoryPath/componentName when pathAfterType has only one segment.
…esource delta Single-file static resources now produce a delta with only the modified resource instead of all resources. Updates _getMetadataName() to use the fixed componentPath property. Adds tests verifying single-file resources are isolated in the delta, readDirs scans the correct directory, and deletion checks the component path.
4b20ddb to
4a280b5
Compare
slice, join, lastIndexOf are available on readonly string[] — the casts to string[] were noise.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1219 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 58 58
Lines 1542 1544 +2
Branches 194 195 +1
=========================================
+ Hits 1542 1544 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Published under $ sf plugins install sf-git-merge-driver@dev-1219 |
|
Shipped in release $ sf plugins install sfdx-git-delta@latest-rc
# Or
$ sf plugins install sfdx-git-delta@v6.32.2💡 Enjoying sfdx-git-delta? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Explain your changes
When a single static resource file is modified (e.g.,
staticresources/myFile.xlsx), the delta package incorrectly includes ALL static resources instead of just the modified one.Root cause:
MetadataElement.componentBasePathhad inconsistent semantics — for folder resources it returned the component boundary (staticresources/MyLib), but for single-file resources it returned the type directory (staticresources). This causedInResourceHandler._collectResourceCopies()to scan too broadly and match every static resource.Fix: Rename
componentBasePathtocomponentPathwith a fix that always returns the correct component boundary path. For single-file resources (pathAfterType.length == 1), it returnstypeDirectoryPath/componentNameinstead of the raw anchor-based slice. For folder resources the behavior is unchanged.Files changed:
src/utils/metadataElement.ts— rename getter, add branching logic for single-file casesrc/service/inResourceHandler.ts— use renamedcomponentPath__tests__/unit/lib/utils/metadataElement.test.ts— update assertions, add single-file coverage__tests__/unit/lib/service/inResourceHandler.test.ts— fix meta path assertion, add isolation and deletion testsDoes this close any currently open issues?
Any particular element that can be tested locally
Verify that only the modified static resource appears in the output, not all static resources.