Skip to content

Commit

Permalink
fix: handle workspaces when root isn't cwd
Browse files Browse the repository at this point in the history
  • Loading branch information
lishaduck committed Dec 1, 2024
1 parent dacacf5 commit 90729c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/type-syncer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,17 @@ export function createTypeSyncer(
globber: IGlobber,
ignoredWorkspaces: IWorkspacesArray,
) {
const root = path.dirname(filePath)
const file = await packageJSONService.readPackageFile(filePath)
const subPackages = await workspaceResolverService.getWorkspaces(
file,
path.dirname(filePath),
root,
globber,
ignoredWorkspaces,
)
const subManifests = subPackages.map((p) => path.join(p, 'package.json'))
const subManifests = subPackages.map((p) =>
path.join(root, p, 'package.json'),
)

return {
file,
Expand Down
2 changes: 1 addition & 1 deletion src/workspace-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export function createWorkspaceResolverService({
root: string,
): Promise<IWorkspacesArray | undefined> {
try {
const filePath = path.relative(root, 'pnpm-workspace.yaml')
const filePath = path.join(root, 'pnpm-workspace.yaml')
const contents = await readFileContents(filePath)
const pnpmWorkspaces = yaml.load(contents) as PnpmWorkspacesConfig

Expand Down

0 comments on commit 90729c8

Please sign in to comment.