Skip to content

Commit 491486f

Browse files
committed
avoid double path.join
1 parent e10c6df commit 491486f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/presets/util/monorepo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ export const getLeafPackages = (repoRoot: string | undefined, filename: string,
2727

2828
const parseLernaJson = () => readJsonFile<{packages: string[]}>('lerna.json')?.packages
2929
const parsePnpmWorkspace = () =>
30-
readYamlFile<{packages: string[]}>(path.join(contextDir, 'pnpm-workspace.yaml'))?.packages
30+
readYamlFile<{packages: string[]}>('pnpm-workspace.yaml')?.packages
3131

3232
const pkg = readJsonFile<{workspaces?: {packages?: string[]}}>('package.json')
3333
const packageGlobs = pkg.workspaces?.packages || pkg.workspaces || parseLernaJson() || parsePnpmWorkspace()
3434

3535
if (!Array.isArray(packageGlobs)) {
36-
throw new TypeError(`Expected to find workspaces array, got ${inspect(packageGlobs)})}`)
36+
throw new TypeError(`Expected to find workspaces array from package.json, lerna.json or pnpm-workspace.yaml, got ${inspect(packageGlobs)})}`)
3737
}
3838

3939
const packages = lodash

test/presets/monorepo-toc.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ test('invalid workspaces', () => {
165165
...params,
166166
options: {},
167167
}),
168-
).toThrow(/Expected to find workspaces array, got 'package.json - not an array'/)
168+
).toThrow(/Expected to find workspaces array from package.json, lerna.json or pnpm-workspace.yaml, got 'package.json - not an array'/)
169169
})
170170

171171
test('toplogical sort', () => {

0 commit comments

Comments
 (0)