Skip to content

Commit 1e5dfd0

Browse files
CopilotLipata
andcommitted
Fix workspace glob pattern to look for src directories within workspaces
Co-authored-by: Lipata <[email protected]>
1 parent 6ee69dd commit 1e5dfd0

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

packages/core/update/Update.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,30 @@ export async function updateWorkspace(rootPath: string): Promise<boolean> {
102102
// Use glob to expand the workspace pattern
103103
const expandedWorkspaces = fs.glob(rootPath, w);
104104
expandedWorkspaces.forEach(expandedWorkspace => {
105-
// Only add if it's a directory and contains source files
105+
// Only add if it's a directory
106106
if (fs.directoryExists(expandedWorkspace)) {
107-
workspaces.push(expandedWorkspace);
107+
// For React/Webcomponents, look for src directory within workspace
108+
const srcPath = path.join(expandedWorkspace, "src");
109+
if (fs.directoryExists(srcPath)) {
110+
workspaces.push(srcPath);
111+
} else {
112+
// Fallback to workspace root if no src directory
113+
workspaces.push(expandedWorkspace);
114+
}
108115
}
109116
});
110117
} else {
111118
// Direct workspace path
112119
const workspacePath = path.join(rootPath, w);
113120
if (fs.directoryExists(workspacePath)) {
114-
workspaces.push(workspacePath);
121+
// For React/Webcomponents, look for src directory within workspace
122+
const srcPath = path.join(workspacePath, "src");
123+
if (fs.directoryExists(srcPath)) {
124+
workspaces.push(srcPath);
125+
} else {
126+
// Fallback to workspace root if no src directory
127+
workspaces.push(workspacePath);
128+
}
115129
}
116130
}
117131
});

spec/unit/update-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -800,9 +800,9 @@ export default function Home() {
800800
`
801801
}];
802802
(fsSpy.fileExists as jasmine.Spy).and.returnValue(true);
803-
// Mock directoryExists to return true for valid workspace directories
803+
// Mock directoryExists to return true for valid workspace directories and src subdirectories
804804
(fsSpy.directoryExists as jasmine.Spy).and.callFake((dirPath: string) => {
805-
return dirPath.includes("projects/charts") || dirPath.includes("projects");
805+
return dirPath.includes("projects/charts") || dirPath.includes("projects") || dirPath.endsWith("/src");
806806
});
807807

808808
// Mock glob to simulate finding workspace directories and files

0 commit comments

Comments
 (0)