Skip to content

Including more files than should for LWC components? #1117

@matdodgson

Description

@matdodgson

Issue verification check:

  • is the current repository fully deployable at the commit SHA provided with the 'from' parameter of the command?

What is the problem?

I have this dir structure in my SF project:

force-app / main / default / lwc / component1 (contains lwc component)
force-app / main / default / lwc / component1Card (contains related component)
force-app / main / default / lwc / component1Artile (contains another related component)
etc

So I have a base component named component1 and other related components which have the same directory name as the other but has a different suffix.

When I make a change to the javascript file in the component1 dir, all files from all components listed above get included in the package.

What is the parameter and the value you used with it?

sf sgd source delta --from 'HEAD~1' --to 'HEAD' --output-dir dist -d

What is the expected result?

I would expect that the package only contains the files from component1. However all files from all components where the component dir name starts with 'component1' are included.

What is the actual result?

There are too many files in the package. I change one component and components that were not changed are included.

Steps to reproduce

I think the issue is in this function:

const staticResourcePath = this.metadataName!.substring(

I did some console logging in that function:

metadataName: force-app/main/default/lwc/component1
staticResourcePath: force-app/main/default/lwc

Here's the filtering:

file.startsWith(this.metadataName!)

Because the filter doesn't include the path separator suffix, it will match any directory that starts with the same directory as the one with the change.

Comments

Is this a bug or expected behaviour? If it's a bug I can try to make a PR to fix it.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions