From a91bab6fad66f591e63b501e94c812e3c566b48c Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 13 Jul 2025 20:00:07 +0000 Subject: [PATCH] Handle empty pnpm-workspace.yaml by throwing an informative error Co-authored-by: thijskoerselman --- src/lib/registry/helpers/find-packages-globs.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib/registry/helpers/find-packages-globs.ts b/src/lib/registry/helpers/find-packages-globs.ts index 83ad124..24263d7 100644 --- a/src/lib/registry/helpers/find-packages-globs.ts +++ b/src/lib/registry/helpers/find-packages-globs.ts @@ -20,10 +20,18 @@ export function findPackagesGlobs(workspaceRootDir: string) { switch (packageManager.name) { case "pnpm": { - const { packages: globs } = readTypedYamlSync<{ packages: string[] }>( + const workspaceConfig = readTypedYamlSync<{ packages: string[] }>( path.join(workspaceRootDir, "pnpm-workspace.yaml") ); + if (!workspaceConfig) { + throw new Error( + "pnpm-workspace.yaml file is empty. Please specify packages configuration." + ); + } + + const { packages: globs } = workspaceConfig; + log.debug("Detected pnpm packages globs:", inspectValue(globs)); return globs; }