Skip to content

Commit 136e721

Browse files
authored
fix(js): handle when there are no package manager workspaces' patterns (#30666)
## Current Behavior The helper to add a project to the package manager workspaces' configuration doesn't handle correctly when there are no patterns and this results in the error `Invalid glob pattern` being thrown. ## Expected Behavior The helper to add a project to the package manager workspaces' configuration should handle when there are no patterns. ## Related Issue(s) Fixes #
1 parent 77e60c3 commit 136e721

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/js/src/utils/typescript/ts-solution-setup.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ export async function addProjectToTsSolutionWorkspace(
230230
let pattern = projectDir;
231231
if (baseDir !== '.') {
232232
const patterns = getPackageManagerWorkspacesPatterns(tree);
233-
const projectsBefore = await globAsync(tree, patterns);
233+
const projectsBefore =
234+
patterns.length > 0 ? await globAsync(tree, patterns) : [];
234235
patterns.push(`${baseDir}/*/package.json`);
235236
const projectsAfter = await globAsync(tree, patterns);
236237

0 commit comments

Comments
 (0)