From 1647d8e2f1d409d86a80775e1d9790110e41b9cc Mon Sep 17 00:00:00 2001 From: Erik Yu Date: Fri, 12 Nov 2021 18:48:56 +0800 Subject: [PATCH] fix: use workspace for store use it is enabled (#3979) close #3976 Co-authored-by: yuhuaheng Co-authored-by: Zoltan Kochan --- .changeset/early-toys-think.md | 6 ++++++ packages/store-connection-manager/src/index.ts | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changeset/early-toys-think.md diff --git a/.changeset/early-toys-think.md b/.changeset/early-toys-think.md new file mode 100644 index 0000000000..8d681871ae --- /dev/null +++ b/.changeset/early-toys-think.md @@ -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). diff --git a/packages/store-connection-manager/src/index.ts b/packages/store-connection-manager/src/index.ts index 4ebad155a9..9ff180f869 100644 --- a/packages/store-connection-manager/src/index.ts +++ b/packages/store-connection-manager/src/index.ts @@ -19,6 +19,7 @@ export type CreateStoreControllerOptions = Omit 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 })