Skip to content

Commit 9dc216c

Browse files
committed
fix(config): Optimize monorepo detection logic
1 parent b2d3c76 commit 9dc216c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/config.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,17 @@ const defaultConfig: IConfigOptions = {
3030
export const isMonorepo = async (
3131
config: IConfigOptions,
3232
): Promise<IConfigOptions['monorepo']> => {
33-
let path = await findUp('pnpm-workspace.yaml', {
33+
const path = await findUp('pnpm-workspace.yaml', {
3434
cwd: config.cwd,
3535
}) as string
3636

37-
const is = !!path
37+
const workspaceYaml = path ? parse(readFileSync(path, 'utf-8')) : { packages: [] }
3838

39-
if (!is)
40-
path = ''
39+
const is = !!workspaceYaml?.packages.length
4140

4241
return {
4342
is,
44-
path,
43+
path: path || '',
4544
}
4645
}
4746

0 commit comments

Comments
 (0)