fix: use workspace for store use it is enabled (#3979)

close #3976

Co-authored-by: yuhuaheng <yuhuaheng@bytedance.com>
Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
Erik Yu
2021-11-12 18:48:56 +08:00
committed by GitHub
parent 783cc1051c
commit 1647d8e2f1
2 changed files with 8 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/store-connection-manager": patch
"pnpm": patch
---
When the store location is a relative location, pick the store location relative to the workspace root directory location [#3976](https://github.com/pnpm/pnpm/issues/3976).

View File

@@ -19,6 +19,7 @@ export type CreateStoreControllerOptions = Omit<CreateNewStoreControllerOptions,
| 'dir'
| 'useRunningStoreServer'
| 'useStoreServer'
| 'workspaceDir'
>
export async function createOrConnectStoreControllerCached (
@@ -38,7 +39,7 @@ export async function createOrConnectStoreController (
ctrl: StoreController
dir: string
}> {
const storeDir = await storePath(opts.dir, opts.storeDir)
const storeDir = await storePath(opts.workspaceDir ?? opts.dir, opts.storeDir)
const connectionInfoDir = serverConnectionInfoDir(storeDir)
const serverJsonPath = path.join(connectionInfoDir, 'server.json')
let serverJson = await tryLoadServerJson({ serverJsonPath, shouldRetryOnNoent: false })